abacusai.model — AbacusAI documentation

# abacusai.model

## Classes

`AgentInterface` | Generic enumeration.
`TrainingConfig` | An abstract class for the training config options used to train the model.
`WorkflowGraph` | An Agent workflow graph. The edges define the node invokation order. The workflow must follow linear invokation order.
`CodeSource` | Code source for python-based custom feature groups and models
`DatabaseConnector` | A connector to an external service
`ModelLocation` | Provide location information for the plug-and-play model.
`ModelVersion` | A version of a model
`RefreshSchedule` | A refresh schedule for an object. Defines when the next version of the object will be created
`AbstractApiClass` |
`Model` | A model

## Module Contents

class abacusai.model.AgentInterface

  Bases: `ApiEnum`

  Generic enumeration.

  Derive from this class to define new enumerations.

  DEFAULT = 'DEFAULT'
  CHAT = 'CHAT'

class abacusai.model.TrainingConfig

  Bases: `abacusai.api_class.abstract.ApiClass`

  An abstract class for the training config options used to train the model.

  _upper_snake_case_keys: bool
  _support_kwargs: bool
  kwargs: dict
  problem_type: abacusai.api_class.enums.ProblemType
  algorithm: str
  classmethod _get_builder()

class abacusai.model.WorkflowGraph

  Bases: `abacusai.api_class.abstract.ApiClass`

  An Agent workflow graph. The edges define the node invokation order. The workflow must follow linear invokation order.

  Parameters:

    - nodes (List[WorkflowGraphNode]) – A list of nodes in the workflow graph.

    - edges (List[WorkflowGraphEdge]) – A list of edges in the workflow graph, where each edge is a tuple of source, target and details.

  nodes: List[WorkflowGraphNode]
  edges: List[WorkflowGraphEdge]
  to_dict()

    Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.

  classmethod from_dict(graph)
    Parameters:

      graph (dict)

class abacusai.model.CodeSource(client, sourceType=None, sourceCode=None, applicationConnectorId=None, applicationConnectorInfo=None, packageRequirements=None, status=None, error=None, publishingMsg=None, moduleDependencies=None)

  Bases: `abacusai.return_class.AbstractApiClass`

  Code source for python-based custom feature groups and models

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - sourceType (str) – The type of the source, one of TEXT, PYTHON, FILE_UPLOAD, or APPLICATION_CONNECTOR

    - sourceCode (str) – If the type of the source is TEXT, the raw text of the function

    - applicationConnectorId (str) – The Application Connector to fetch the code from

    - applicationConnectorInfo (str) – Args passed to the application connector to fetch the code

    - packageRequirements (list) – The pip package dependencies required to run the code

    - status (str) – The status of the code and validations

    - error (str) – If the status is failed, an error message describing what went wrong

    - publishingMsg (dict) – Warnings in the source code

    - moduleDependencies (list) – The list of internal modules dependencies required to run the 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

  import_as_cell()

    Adds the source code as an unexecuted cell in the notebook.

class abacusai.model.DatabaseConnector(client, databaseConnectorId=None, service=None, name=None, status=None, auth=None, createdAt=None)

  Bases: `abacusai.return_class.AbstractApiClass`

  A connector to an external service

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - databaseConnectorId (str) – A unique string identifier for the connection.

    - service (str) – An enum string indicating the service this connection connects to.

    - name (str) – A user-friendly name for the service.

    - status (str) – The status of the database connector.

    - auth (dict) – Non-secret connection information for this connector.

    - createdAt (str) – The ISO-8601 string indicating when the API key was created.

  __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

  list_objects(fetch_raw_data=False)

    Lists querable objects in the database connector.

    Parameters:

      fetch_raw_data (bool) – If true, return unfiltered objects.

  get_object_schema(object_name=None, fetch_raw_data=False)

    Get the schema of an object in an database connector.

    Parameters:

      - object_name (str) – Unique identifier for the object in the external system.

      - fetch_raw_data (bool) – If true, return unfiltered list of columns.

    Returns:

      The schema of the object.

    Return type:

      DatabaseConnectorSchema

  rename(name)

    Renames a Database Connector

    Parameters:

      name (str) – The new name for the Database Connector.

  verify()

    Checks if Abacus.AI can access the specified database.

    Parameters:

      database_connector_id (str) – Unique string identifier for the database connector.

  delete()

    Delete a database connector.

    Parameters:

      database_connector_id (str) – The unique identifier for the database connector.

  query(query)

    Runs a query in the specified database connector.

    Parameters:

      query (str) – The query to be run in the database connector.

class abacusai.model.ModelLocation(client, location=None, artifactNames=None)

  Bases: `abacusai.return_class.AbstractApiClass`

  Provide location information for the plug-and-play model.

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - location (str) – Location of the plug-and-play model.

    - artifactNames (dict) – Representations of the names of the artifacts used to create the model.

  __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

class abacusai.model.ModelVersion(client, modelVersion=None, modelConfigType=None, status=None, modelId=None, modelPredictionConfig=None, trainingStartedAt=None, trainingCompletedAt=None, featureGroupVersions=None, error=None, pendingDeploymentIds=None, failedDeploymentIds=None, cpuSize=None, memory=None, automlComplete=None, trainingFeatureGroupIds=None, trainingDocumentRetrieverVersions=None, documentRetrieverMappings=None, bestAlgorithm=None, defaultAlgorithm=None, featureAnalysisStatus=None, dataClusterInfo=None, customAlgorithmConfigs=None, trainedModelTypes=None, useGpu=None, partialComplete=None, modelFeatureGroupSchemaMappings=None, trainingConfigUpdated=None, codeSource={}, modelConfig={}, deployableAlgorithms={})

  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.

    - modelConfigType (str) – Name of the TrainingConfig class of the model_config.

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

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

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

    - trainingStartedAt (str) – The start time and date of the training process in ISO-8601 format.

    - trainingCompletedAt (str) – The end time and date of the training process in ISO-8601 format.

    - featureGroupVersions (list) – A 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) – The unique identifiers of the feature groups used as inputs during training to create this ModelVersion.

    - trainingDocumentRetrieverVersions (list) – The document retriever version IDs used as inputs during training to create this ModelVersion.

    - documentRetrieverMappings (dict) – mapping of document retriever version to their respective information.

    - 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.

    - customAlgorithmConfigs (dict) – User-defined configs for each of the user-defined custom algorithms.

    - trainedModelTypes (list) – List of trained model types.

    - useGpu (bool) – Whether this model version is using gpu

    - partialComplete (bool) – If true, all required algorithms have completed training.

    - modelFeatureGroupSchemaMappings (dict) – mapping of feature group to schema version

    - trainingConfigUpdated (bool) – If the training config has been updated since the instance was created.

    - codeSource (CodeSource) – If a python model, information on where the source code is located.

    - modelConfig (TrainingConfig) – The training config options used to train this model.

    - deployableAlgorithms (DeployableAlgorithm) – List of deployable algorithms.

  __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. This is 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=None)

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

    If metric is set to None, then just use the default selection

    Parameters:

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

  get_feature_group_schemas_for()

    Gets the schema (including feature mappings) for all feature groups used in the model version.

    Parameters:

      model_version (str) – Unique string identifier for the version of the model.

    Returns:

      List of schema for all feature groups used in the model version.

    Return type:

      list[ModelVersionFeatureGroupSchema]

  delete()

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

    Parameters:

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

  export_model_artifact_as_feature_group(table_name, artifact_type=None)

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

    Parameters:

      - table_name (str) – Name of the feature group table to create.

      - artifact_type (EvalArtifactType) – eval artifact type 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) – Unique string identifier 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) – Unique string identifier for the model version.

    Returns:

      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:

      list[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 object.

    Return type:

      FunctionLogs

  export_custom(output_location, algorithm=None)

    Bundle custom model artifacts to a zip file, and export to the specified location.

    Parameters:

      - output_location (str) – Location to export the model artifacts results. For example, s3://a-bucket/

      - algorithm (str) – The algorithm to be exported. Optional if there’s only one custom algorithm in the model version.

    Returns:

      Object describing the export and its status.

    Return type:

      ModelArtifactsExport

  wait_for_training(timeout=None)

    A waiting call until model gets trained.

    Parameters:

      timeout (int) – 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) – 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

class abacusai.model.RefreshSchedule(client, refreshPolicyId=None, nextRunTime=None, cron=None, refreshType=None, error=None)

  Bases: `abacusai.return_class.AbstractApiClass`

  A refresh schedule for an object. Defines when the next version of the object will be created

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - refreshPolicyId (str) – The unique identifier of the refresh policy

    - nextRunTime (str) – The next run time of the refresh policy. If null, the policy is paused.

    - cron (str) – A cron-style string that describes the when this refresh policy is to be executed in UTC

    - refreshType (str) – The type of refresh that will be run

    - error (str) – An error message for the last pipeline run of a policy

  __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

class abacusai.model.AbstractApiClass(client, id)
  __eq__(other)

    Return self==value.

  _get_attribute_as_dict(attribute)

class abacusai.model.Model(client, name=None, modelId=None, modelConfigType=None, modelPredictionConfig=None, createdAt=None, projectId=None, shared=None, sharedAt=None, trainFunctionName=None, predictFunctionName=None, predictManyFunctionName=None, initializeFunctionName=None, trainingInputTables=None, sourceCode=None, cpuSize=None, memory=None, trainingFeatureGroupIds=None, algorithmModelConfigs=None, trainingVectorStoreVersions=None, documentRetrievers=None, documentRetrieverIds=None, isPythonModel=None, defaultAlgorithm=None, customAlgorithmConfigs=None, restrictedAlgorithms=None, useGpu=None, notebookId=None, trainingRequired=None, dataLlmFeatureGroups=None, location={}, refreshSchedules={}, codeSource={}, databaseConnector={}, latestModelVersion={}, modelConfig={})

  Bases: `abacusai.return_class.AbstractApiClass`

  A model

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - name (str) – The user-friendly name for the model.

    - modelId (str) – The unique identifier of the model.

    - modelConfigType (str) – Name of the TrainingConfig class of the model_config.

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

    - createdAt (str) – Date and time at which the model was created.

    - projectId (str) – The project this model belongs to.

    - shared (bool) – If model is shared to the Abacus.AI model showcase.

    - sharedAt (str) – The date and time at which the model was shared to the model showcase

    - trainFunctionName (str) – Name of the function found in the source code that will be executed to train the model. It is not executed when this function is run.

    - predictFunctionName (str) – Name of the function found in the source code that will be executed run predictions through model. It is not executed when this function is run.

    - predictManyFunctionName (str) – Name of the function found in the source code that will be executed to run batch predictions trhough the model.

    - initializeFunctionName (str) – Name of the function found in the source code to initialize the trained model before using it to make predictions using the model

    - trainingInputTables (list) – List of feature groups that are supplied to the train function as parameters. Each of the parameters are materialized Dataframes (same type as the functions return value).

    - sourceCode (str) – Python code used to make the model.

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

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

    - trainingFeatureGroupIds (list of unique string identifiers) – The unique identifiers of the feature groups used as the inputs to train this model on.

    - algorithmModelConfigs (list[dict]) – List of algorithm specific training configs.

    - trainingVectorStoreVersions (list) – The vector store version IDs used as inputs during training to create this ModelVersion.

    - documentRetrievers (list) – List of document retrievers use to create this model.

    - documentRetrieverIds (list) – List of document retriever IDs used to create this model.

    - isPythonModel (bool) – If this model is handled as python model

    - defaultAlgorithm (str) – If set, this algorithm will always be used when deploying the model regardless of the model metrics

    - customAlgorithmConfigs (dict) – User-defined configs for each of the user-defined custom algorithm

    - restrictedAlgorithms (dict) – User-selected algorithms to train.

    - useGpu (bool) – If this model uses gpu.

    - notebookId (str) – The notebook associated with this model.

    - trainingRequired (bool) – If training is required to keep the model up-to-date.

    - dataLlmFeatureGroups (list[featuregroup]) – List of feature groups used by the model for queries

    - latestModelVersion (ModelVersion) – The latest model version.

    - location (ModelLocation) – Location information for models that are imported.

    - refreshSchedules (RefreshSchedule) – List of refresh schedules that indicate when the next model version will be trained

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

    - databaseConnector (DatabaseConnector) – Database connector used by the model.

    - modelConfig (TrainingConfig) – The training config options used to train this model.

  __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()

    Get the train and test data split for a trained model by its unique identifier. This is only supported for models with custom algorithms.

    Parameters:

      model_id (str) – The unique ID of the model. By default, the latest model version will be returned if no version is specified.

    Returns:

      The feature group containing the training data and fold information.

    Return type:

      FeatureGroup

  refresh()

    Calls describe and refreshes the current object’s fields

    Returns:

      The current object

    Return type:

      Model

  describe()

    Retrieves a full description of the specified model.

    Parameters:

      model_id (str) – Unique string identifier associated with the model.

    Returns:

      Description of the model.

    Return type:

      Model

  rename(name)

    Renames a model

    Parameters:

      name (str) – The new name to assign to the model.

  update_python(function_source_code=None, train_function_name=None, predict_function_name=None, predict_many_function_name=None, initialize_function_name=None, training_input_tables=None, cpu_size=None, memory=None, package_requirements=None, use_gpu=None, is_thread_safe=None, training_config=None)

    Updates an existing Python Model using user-provided Python code. If a list of input feature groups is supplied, they will be provided as arguments to the train and predict functions with the materialized feature groups for those input feature groups.

    This method expects functionSourceCode to be a valid language source file which contains the functions named trainFunctionName and predictFunctionName. trainFunctionName returns the ModelVersion that is the result of training the model using trainFunctionName. predictFunctionName has no well-defined return type, as it returns the prediction made by the predictFunctionName, which can be anything.

    Parameters:

      - function_source_code (str) – Contents of a valid Python source code file. The source code should contain the functions named trainFunctionName and predictFunctionName. A list of allowed import and system libraries for each language is specified in the user functions documentation section.

      - train_function_name (str) – Name of the function found in the source code that will be executed to train the model. It is not executed when this function is run.

      - predict_function_name (str) – Name of the function found in the source code that will be executed to run predictions through the model. It is not executed when this function is run.

      - predict_many_function_name (str) – Name of the function found in the source code that will be executed to run batch predictions through the model. It is not executed when this function is run.

      - initialize_function_name (str) – Name of the function found in the source code to initialize the trained model before using it to make predictions using the model.

      - training_input_tables (list) – List of feature groups that are supplied to the train function as parameters. Each of the parameters are materialized DataFrames (same type as the functions return value).

      - cpu_size (str) – Size of the CPU for the model training function.

      - memory (int) – Memory (in GB) for the model training function.

      - package_requirements (list) – List of package requirement strings. For example: [‘numpy==1.2.3’, ‘pandas>=1.4.0’].

      - use_gpu (bool) – Whether this model needs gpu

      - is_thread_safe (bool) – Whether this model is thread safe

      - training_config (TrainingConfig) – The training config used to train this model.

    Returns:

      The updated model.

    Return type:

      Model

  update_python_zip(train_function_name=None, predict_function_name=None, predict_many_function_name=None, train_module_name=None, predict_module_name=None, training_input_tables=None, cpu_size=None, memory=None, package_requirements=None, use_gpu=None)

    Updates an existing Python Model using a provided zip file. If a list of input feature groups are supplied, they will be provided as arguments to the train and predict functions with the materialized feature groups for those input feature groups.

    This method expects trainModuleName and predictModuleName to be valid language source files which contain the functions named trainFunctionName and predictFunctionName, respectively. trainFunctionName returns the ModelVersion that is the result of training the model using trainFunctionName, and predictFunctionName has no well-defined return type, as it returns the prediction made by the predictFunctionName, which can be anything.

    Parameters:

      - train_function_name (str) – Name of the function found in the train module that will be executed to train the model. It is not executed when this function is run.

      - predict_function_name (str) – Name of the function found in the predict module that will be executed to run predictions through the model. It is not executed when this function is run.

      - predict_many_function_name (str) – Name of the function found in the predict module that will be executed to run batch predictions through the model. It is not executed when this function is run.

      - train_module_name (str) – Full path of the module that contains the train function from the root of the zip.

      - predict_module_name (str) – Full path of the module that contains the predict function from the root of the zip.

      - training_input_tables (list) – List of feature groups that are supplied to the train function as parameters. Each of the parameters are materialized Dataframes (same type as the function’s return value).

      - cpu_size (str) – Size of the CPU for the model training function.

      - memory (int) – Memory (in GB) for the model training function.

      - package_requirements (list) – List of package requirement strings. For example: [‘numpy==1.2.3’, ‘pandas>=1.4.0’].

      - use_gpu (bool) – Whether this model needs gpu

    Returns:

      The updated model.

    Return type:

      Upload

  update_python_git(application_connector_id=None, branch_name=None, python_root=None, train_function_name=None, predict_function_name=None, predict_many_function_name=None, train_module_name=None, predict_module_name=None, training_input_tables=None, cpu_size=None, memory=None, use_gpu=None)

    Updates an existing Python model using an existing Git application connector. If a list of input feature groups are supplied, these will be provided as arguments to the train and predict functions with the materialized feature groups for those input feature groups.

    This method expects trainModuleName and predictModuleName to be valid language source files which contain the functions named trainFunctionName and predictFunctionName, respectively. trainFunctionName returns the ModelVersion that is the result of training the model using trainFunctionName, and predictFunctionName has no well-defined return type, as it returns the prediction made by the predictFunctionName, which can be anything.

    Parameters:

      - application_connector_id (str) – The unique ID associated with the Git application connector.

      - branch_name (str) – Name of the branch in the Git repository to be used for training.

      - python_root (str) – Path from the top level of the Git repository to the directory containing the Python source code. If not provided, the default is the root of the Git repository.

      - train_function_name (str) – Name of the function found in train module that will be executed to train the model. It is not executed when this function is run.

      - predict_function_name (str) – Name of the function found in the predict module that will be executed to run predictions through model. It is not executed when this function is run.

      - predict_many_function_name (str) – Name of the function found in the predict module that will be executed to run batch predictions through model. It is not executed when this function is run.

      - train_module_name (str) – Full path of the module that contains the train function from the root of the zip.

      - predict_module_name (str) – Full path of the module that contains the predict function from the root of the zip.

      - training_input_tables (list) – List of feature groups that are supplied to the train function as parameters. Each of the parameters are materialized Dataframes (same type as the functions return value).

      - cpu_size (str) – Size of the CPU for the model training function.

      - memory (int) – Memory (in GB) for the model training function.

      - use_gpu (bool) – Whether this model needs gpu

    Returns:

      The updated model.

    Return type:

      Model

  set_training_config(training_config, feature_group_ids=None)

    Edits the default model training config

    Parameters:

      - training_config (TrainingConfig) – The training config used to train this model.

      - feature_group_ids (List) – The list of feature groups used as input to the model.

    Returns:

      The model object corresponding to the updated training config.

    Return type:

      Model

  set_prediction_params(prediction_config)

    Sets the model prediction config for the model

    Parameters:

      prediction_config (dict) – Prediction configuration for the model.

    Returns:

      Model object after the prediction configuration is applied.

    Return type:

      Model

  get_metrics(model_version=None, return_graphs=False, validation=False)

    Retrieves metrics for all the algorithms trained in this model version.

    If only the model’s unique identifier (model_id) is specified, the latest trained version of the model (model_version) is used.

    Parameters:

      - model_version (str) – Version of the model.

      - return_graphs (bool) – If true, will return the information used for the graphs on the model metrics page such as PR Curve per label.

      - validation (bool) – If true, will return the validation metrics instead of the test metrics.

    Returns:

      An object containing the model metrics and explanations for what each metric means.

    Return type:

      ModelMetrics

  list_versions(limit=100, start_after_version=None)

    Retrieves a list of versions for a given model.

    Parameters:

      - limit (int) – Maximum length of the list of all dataset versions.

      - start_after_version (str) – Unique string identifier of the version after which the list starts.

    Returns:

      An array of model versions.

    Return type:

      list[ModelVersion]

  retrain(deployment_ids=None, feature_group_ids=None, custom_algorithms=None, builtin_algorithms=None, custom_algorithm_configs=None, cpu_size=None, memory=None, training_config=None, algorithm_training_configs=None)

    Retrains the specified model, with an option to choose the deployments to which the retraining will be deployed.

    Parameters:

      - deployment_ids (List) – List of unique string identifiers of deployments to automatically deploy to.

      - feature_group_ids (List) – List of feature group IDs provided by the user to train the model on.

      - custom_algorithms (list) – List of user-defined algorithms to train. If not set, will honor the runs from the last time and applicable new custom algorithms.

      - builtin_algorithms (list) – List of algorithm names or algorithm IDs of Abacus.AI built-in algorithms to train. If not set, will honor the runs from the last time and applicable new built-in algorithms.

      - custom_algorithm_configs (dict) – User-defined training configs for each custom algorithm.

      - cpu_size (str) – Size of the CPU for the user-defined algorithms during training.

      - memory (int) – Memory (in GB) for the user-defined algorithms during training.

      - training_config (TrainingConfig) – The training config used to train this model.

      - algorithm_training_configs (list) – List of algorithm specifc training configs that will be part of the model training AutoML run.

    Returns:

      The model that is being retrained.

    Return type:

      Model

  delete()

    Deletes the specified model and all its versions. Models which are currently used in deployments cannot be deleted.

    Parameters:

      model_id (str) – Unique string identifier of the model to delete.

  set_default_algorithm(algorithm=None, data_cluster_type=None)

    Sets the model’s algorithm to default for all new deployments

    Parameters:

      - algorithm (str) – Algorithm to pin in the model.

      - data_cluster_type (str) – Data cluster type to set the lead model for.

  list_artifacts_exports(limit=25)

    List all the model artifacts exports.

    Parameters:

      limit (int) – Maximum length of the list of all exports.

    Returns:

      List of model artifacts exports.

    Return type:

      list[ModelArtifactsExport]

  get_training_types_for_deployment(model_version=None, algorithm=None)

    Returns types of models that can be deployed for a given model instance ID.

    Parameters:

      - model_version (str) – The unique ID associated with the model version to deploy.

      - algorithm (str) – The unique ID associated with the algorithm to deploy.

    Returns:

      Model training types for deployment.

    Return type:

      ModelTrainingTypeForDeployment

  update_agent(function_source_code=None, agent_function_name=None, memory=None, package_requirements=None, description=None, enable_binary_input=None, agent_input_schema=None, agent_output_schema=None, workflow_graph=None, agent_interface=None)

    Updates an existing AI Agent. A new version of the agent will be created and published.

    Parameters:

      - memory (int) – Memory (in GB) for the agent.

      - description (str) – A description of the agent, including its purpose and instructions.

      - workflow_graph (WorkflowGraph) – The workflow graph for the agent.

      - agent_interface (AgentInterface) – The interface that the agent will be deployed with.

      - function_source_code (str)

      - agent_function_name (str)

      - package_requirements (list)

      - enable_binary_input (bool)

      - agent_input_schema (dict)

      - agent_output_schema (dict)

    Returns:

      The updated agent.

    Return type:

      Agent

  wait_for_training(timeout=None)

    A waiting call until model is trained.

    Parameters:

      timeout (int) – 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_evaluation(timeout=None)

    A waiting call until model is evaluated completely.

    Parameters:

      timeout (int) – 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_publish(timeout=None)

    A waiting call until agent is published.

    Parameters:

      timeout (int) – 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) – 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(get_automl_status=False)

    Gets the status of the model training.

    Returns:

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

    Return type:

      str

    Parameters:

      get_automl_status (bool)

  create_refresh_policy(cron)

    To create a refresh policy for a model.

    Parameters:

      cron (str) – A cron style string to set the refresh time.

    Returns:

      The refresh policy object.

    Return type:

      RefreshPolicy

  list_refresh_policies()

    Gets the refresh policies in a list.

    Returns:

      A list of refresh policy objects.

    Return type:

      List[RefreshPolicy]

  get_train_test_feature_group_as_pandas()

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

    Returns:

      A pandas dataframe for the training data with fold column.

    Return type:

      pandas.Dataframe