Skip to content

Commit

Permalink
Version 0.79.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Lefore committed Nov 10, 2023
1 parent 804db7e commit c869676
Show file tree
Hide file tree
Showing 44 changed files with 1,729 additions and 668 deletions.
2 changes: 1 addition & 1 deletion abacusai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from .streaming_client import StreamingClient


__version__ = "0.78.5"
__version__ = "0.79.0"
1 change: 1 addition & 0 deletions abacusai/api_class/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ class DocumentProcessingConfig(ApiClass):
use_doctr: bool = False
remove_watermarks: bool = None
use_full_ocr: bool = None
layout_analysis: bool = False
9 changes: 9 additions & 0 deletions abacusai/api_class/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ProblemType(ApiEnum):
DOCUMENT_VISUALIZATION = 'nlp_document_visualization'
PERSONALIZATION = 'personalization'
PREDICTIVE_MODELING = 'regression'
FINETUNED_LLM = 'finetuned_llm'
FORECASTING = 'forecasting'
CUSTOM_TRAINED_MODEL = 'plug_and_play'
CUSTOM_ALGORITHM = 'trainable_plug_and_play'
Expand Down Expand Up @@ -387,6 +388,8 @@ class MonitorAlertType(ApiEnum):
FEATURE_DRIFT = 'FeatureDrift'
DATA_INTEGRITY_VIOLATIONS = 'DataIntegrityViolations'
BIAS_VIOLATIONS = 'BiasViolations'
HISTORY_LENGTH_DRIFT = 'HistoryLengthDrift'
TARGET_DRIFT = 'TargetDrift'


class FeatureDriftType(ApiEnum):
Expand All @@ -413,3 +416,9 @@ class BiasType(ApiEnum):

class AlertActionType(ApiEnum):
EMAIL = 'Email'


class PythonFunctionType(ApiEnum):
FEATURE_GROUP = 'FEATURE_GROUP'
PLOTLY_FIG = 'PLOTLY_FIG'
STEP_FUNCTION = 'STEP_FUNCTION'
11 changes: 9 additions & 2 deletions abacusai/api_class/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,20 @@ class PersonalizationTrainingConfig(TrainingConfig):
disable_transformer (bool): Disable training the transformer algorithm.
disable_gpu (boo): Disable training on GPU.
filter_history (bool): Do not recommend items the user has already interacted with.
action_types_exclusion_days (Dict[str, float]): Mapping from action type to number of days for which we exclude previously interacted items from prediction
session_dedupe_mins (float): Minimum number of minutes between two sessions for a user.
max_history_length (int): Maximum length of user-item history to include user in training examples.
compute_rerank_metrics (bool): Compute metrics based on rerank results.
add_time_features (bool): Include interaction time as a feature.
disable_timestamp_scalar_features (bool): Exclude timestamp scalar features.
compute_session_metrics (bool): Evaluate models based on how well they are able to predict the next session of interactions.
max_user_history_len_percentile (int): Filter out users with history length above this percentile.
downsample_item_popularity_percentile (float): Downsample items more popular than this percentile.
<<<<<<< HEAD
allow_duplicate_action_types (List[str]): event types which will not be deduplicated.
use_user_id_feature (bool): Use user id as a feature in CTR models.
=======
>>>>>>> e5f12c159c (add config options for session dedupe and recommendation exclusion)
"""
# top-level params
objective: enums.PersonalizationObjective = dataclasses.field(default=None)
Expand All @@ -67,7 +73,6 @@ class PersonalizationTrainingConfig(TrainingConfig):
target_action_types: List[str] = dataclasses.field(default=None)
target_action_weights: Dict[str, float] = dataclasses.field(default=None)
session_event_types: List[str] = dataclasses.field(default=None)
allow_duplicate_action_types: List[str] = dataclasses.field(default=None)

# data split
test_split: int = dataclasses.field(default=None)
Expand All @@ -92,6 +97,7 @@ class PersonalizationTrainingConfig(TrainingConfig):

# prediction
filter_history: bool = dataclasses.field(default=None)
action_types_exclusion_days: Dict[str, float] = dataclasses.field(default=None)

# data distribution
max_history_length: int = dataclasses.field(default=None)
Expand All @@ -101,6 +107,8 @@ class PersonalizationTrainingConfig(TrainingConfig):
compute_session_metrics: bool = dataclasses.field(default=None)
query_column: str = dataclasses.field(default=None)
item_query_column: str = dataclasses.field(default=None)
use_user_id_feature: bool = dataclasses.field(default=None)
session_dedupe_mins: float = dataclasses.field(default=None)

# outliers
max_user_history_len_percentile: int = dataclasses.field(default=None)
Expand Down Expand Up @@ -156,7 +164,6 @@ class RegressionTrainingConfig(TrainingConfig):
data_split_feature_group_table_name (str): Specify the table name of the feature group to export training data with the fold column.
custom_loss_functions (List[str]): Registered custom losses available for selection.
custom_metrics (List[str]): Registered custom metrics available for selection.
"""
objective: enums.RegressionObjective = dataclasses.field(default=None)
sort_objective: enums.RegressionObjective = dataclasses.field(default=None)
Expand Down
34 changes: 34 additions & 0 deletions abacusai/api_class/monitor_alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,47 @@ class FeatureDriftConditionConfig(AlertConditionConfig):
feature_drift_type (FeatureDriftType): Feature drift type to apply the threshold on to determine whether a column has drifted significantly enough to be a violation.
threshold (float): Threshold for when to consider a column to be in violation. The alert will only fire when the drift value is strictly greater than the threshold.
minimum_violations (int): Number of columns that must exceed the specified threshold to trigger an alert.
feature_names (List[str]): List of feature names to monitor for this alert.
"""
feature_drift_type: enums.FeatureDriftType = dataclasses.field(default=None)
threshold: float = dataclasses.field(default=None)
minimum_violations: int = dataclasses.field(default=None)
feature_names: List[str] = dataclasses.field(default=None)

def __post_init__(self):
self.alert_type = enums.MonitorAlertType.FEATURE_DRIFT


@dataclasses.dataclass
class TargetDriftConditionConfig(AlertConditionConfig):
"""
Target Drift Condition Config for Monitor Alerts
Args:
feature_drift_type (FeatureDriftType): Target drift type to apply the threshold on to determine whether a column has drifted significantly enough to be a violation.
threshold (float): Threshold for when to consider the target column to be in violation. The alert will only fire when the drift value is strictly greater than the threshold.
"""
feature_drift_type: enums.FeatureDriftType = dataclasses.field(default=None)
threshold: float = dataclasses.field(default=None)

def __post_init__(self):
self.alert_type = enums.MonitorAlertType.TARGET_DRIFT


@dataclasses.dataclass
class HistoryLengthDriftConditionConfig(AlertConditionConfig):
"""
History Length Drift Condition Config for Monitor Alerts
Args:
feature_drift_type (FeatureDriftType): History length drift type to apply the threshold on to determine whether the history length has drifted significantly enough to be a violation.
threshold (float): Threshold for when to consider the history length to be in violation. The alert will only fire when the drift value is strictly greater than the threshold.
"""
feature_drift_type: enums.FeatureDriftType = dataclasses.field(default=None)
threshold: float = dataclasses.field(default=None)

def __post_init__(self):
self.alert_type = enums.MonitorAlertType.HISTORY_LENGTH_DRIFT


@dataclasses.dataclass
class DataIntegrityViolationConditionConfig(AlertConditionConfig):
"""
Expand Down Expand Up @@ -86,6 +118,8 @@ class _AlertConditionConfigFactory(_ApiClassFactory):
enums.MonitorAlertType.FEATURE_DRIFT: FeatureDriftConditionConfig,
enums.MonitorAlertType.DATA_INTEGRITY_VIOLATIONS: DataIntegrityViolationConditionConfig,
enums.MonitorAlertType.BIAS_VIOLATIONS: BiasViolationConditionConfig,
enums.MonitorAlertType.TARGET_DRIFT: TargetDriftConditionConfig,
enums.MonitorAlertType.HISTORY_LENGTH_DRIFT: HistoryLengthDriftConditionConfig,
}


Expand Down
12 changes: 7 additions & 5 deletions abacusai/app_user_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ class AppUserGroup(AbstractApiClass):
name (str): The name of the user group.
userGroupId (str): The unique identifier of the user group.
externalApplicationIds (list[str]): The ids of the external applications the group has access to.
invitedUserEmails (list[str]): The emails of the users invited to the user group who have not yet accepted the invite.
users (User): The users in the user group.
"""

def __init__(self, client, name=None, userGroupId=None, externalApplicationIds=None, users={}):
def __init__(self, client, name=None, userGroupId=None, externalApplicationIds=None, invitedUserEmails=None, users={}):
super().__init__(client, None)
self.name = name
self.user_group_id = userGroupId
self.external_application_ids = externalApplicationIds
self.invited_user_emails = invitedUserEmails
self.users = client._build_class(User, users)

def __repr__(self):
repr_dict = {f'name': repr(self.name), f'user_group_id': repr(
self.user_group_id), f'external_application_ids': repr(self.external_application_ids), f'users': repr(self.users)}
repr_dict = {f'name': repr(self.name), f'user_group_id': repr(self.user_group_id), f'external_application_ids': repr(
self.external_application_ids), f'invited_user_emails': repr(self.invited_user_emails), f'users': repr(self.users)}
class_name = "AppUserGroup"
repr_str = ',\n '.join([f'{key}={value}' for key, value in repr_dict.items(
) if getattr(self, key, None) is not None])
Expand All @@ -36,6 +38,6 @@ def to_dict(self):
Returns:
dict: The dict value representation of the class parameters
"""
resp = {'name': self.name, 'user_group_id': self.user_group_id,
'external_application_ids': self.external_application_ids, 'users': self._get_attribute_as_dict(self.users)}
resp = {'name': self.name, 'user_group_id': self.user_group_id, 'external_application_ids': self.external_application_ids,
'invited_user_emails': self.invited_user_emails, 'users': self._get_attribute_as_dict(self.users)}
return {key: value for key, value in resp.items() if value is not None}
Loading

0 comments on commit c869676

Please sign in to comment.