abacusai.model_version

Module Contents

Classes

ModelVersion

A version of a model

class abacusai.model_version.ModelVersion(client, modelVersion=None, status=None, modelId=None, modelConfig=None, modelPredictionConfig=None, trainingStartedAt=None, trainingCompletedAt=None, datasetVersions=None, featureGroupVersions=None, error=None, pendingDeploymentIds=None, failedDeploymentIds=None, cpuSize=None, memory=None, automlComplete=None, trainingFeatureGroupIds=None, deployableAlgorithms=None, bestAlgorithm=None, defaultAlgorithm=None, featureAnalysisStatus=None, dataClusterInfo=None, codeSource={})

Bases: abacusai.return_class.AbstractApiClass

A version of a model

Parameters:
  • client (ApiClient) – An authenticated API Client instance

  • modelVersion (str) – The unique identifier of a model version.

  • status (str) – The current status of the model.

  • modelId (str) – A reference to the model this version belongs to.

  • modelConfig (dict) – The training config options used to train this model.

  • modelPredictionConfig (dict) – The prediction config options for the model.

  • trainingStartedAt (str) – The start time and date of the training process.

  • trainingCompletedAt (str) – The end time and date of the training process.

  • datasetVersions (list of unique string identifiers) – Comma separated list of Dataset version IDs used for model training.

  • featureGroupVersions (list of unique string identifiers) – Comma separated list of Feature Group version IDs used for model training.

  • error (str) – Relevant error if the status is FAILED.

  • pendingDeploymentIds (list) – List of deployment IDs where deployment is pending.

  • failedDeploymentIds (list) – List of failed deployment IDs.

  • cpuSize (str) – Cpu size specified for the python model training.

  • memory (int) – Memory in GB specified for the python model training.

  • automlComplete (bool) – If true, all algorithms have completed training

  • trainingFeatureGroupIds (list of unique string identifiers) – The unique identifiers of the feature group used as the inputs during training to create this ModelVersion.

  • deployableAlgorithms (dict) – List of deployable algorithms

  • bestAlgorithm (dict) – Best performing algorithm

  • defaultAlgorithm (dict) – Default algorithm that the user has selected

  • featureAnalysisStatus (str) – lifecycle of the feature analysis stage

  • dataClusterInfo (dict) – Information about the models for different data clusters

  • codeSource (CodeSource) – If a python model, information on where the source code

__repr__()

Return repr(self).

to_dict()

Get a dict representation of the parameters in this class

Returns:

The dict value representation of the class parameters

Return type:

dict

describe_train_test_data_split_feature_group_version()

Get the train and test data split for a trained model by model_version. Only supported for models with custom algorithms.

Parameters:

model_version (str) – The unique version ID of the model version

Returns:

The feature group version containing the training data and folds information.

Return type:

FeatureGroupVersion

set_model_objective(metric)

Sets the best model for all model instances of the model based on the specified metric, and updates the training config to use the specified metric for any future model versions.

Parameters:

metric (str) – The metric to use to determine the best model

delete()

Deletes the specified model version. Model Versions which are currently used in deployments cannot be deleted.

Parameters:

model_version (str) – The ID of the model version to delete.

export_model_artifact_as_feature_group(table_name, artifact_type)

Exports metric artifact data for a model as a feature group.

Parameters:
  • table_name (str) – The name of the feature group table to create.

  • artifact_type (str) – An EvalArtifact enum of which artifact to export.

Returns:

The created feature group.

Return type:

FeatureGroup

refresh()

Calls describe and refreshes the current object’s fields

Returns:

The current object

Return type:

ModelVersion

describe()

Retrieves a full description of the specified model version

Parameters:

model_version (str) – The unique version ID of the model version

Returns:

A model version.

Return type:

ModelVersion

get_feature_importance_by()

Gets the feature importance calculated by various methods for the model

Parameters:

model_version (str) – The version of the model.

Returns:

The feature importances for the model.

Return type:

FeatureImportance

get_training_data_logs()

Retrieves the data preparation logs during model training.

Parameters:

model_version (str) – The unique version ID of the model version

Returns:

A list of logs.

Return type:

DataPrepLogs

get_training_logs(stdout=False, stderr=False)

Returns training logs for the model.

Parameters:
  • stdout (bool) – Set True to get info logs

  • stderr (bool) – Set True to get error logs

Returns:

A function logs.

Return type:

FunctionLogs

ignore_lofo_features(threshold=None, top_n=0)
Parameters:
wait_for_training(timeout=None)

A waiting call until model gets trained.

Parameters:

timeout (int, optional) – The waiting time given to the call to finish, if it doesn’t finish by the allocated time, the call is said to be timed out.

wait_for_full_automl(timeout=None)

A waiting call until full AutoML cycle is completed.

Parameters:

timeout (int, optional) – The waiting time given to the call to finish, if it doesn’t finish by the allocated time, the call is said to be timed out.

get_status()

Gets the status of the model version under training.

Returns:

A string describing the status of a model training (pending, complete, etc.).

Return type:

str

get_train_test_feature_group_as_pandas()

Get the model train test data split feature group of the model version as pandas data frame.

Returns:

A pandas dataframe for the training data with fold column.

Return type:

pandas.Dataframe