abacusai.model_version
======================

.. py:module:: abacusai.model_version


Classes
-------

.. autoapisummary::

   abacusai.model_version.ModelVersion


Module Contents
---------------

.. py:class:: ModelVersion(client, modelVersion=None, modelConfigType=None, status=None, modelId=None, modelPredictionConfig=None, trainingStartedAt=None, trainingCompletedAt=None, featureGroupVersions=None, customAlgorithms=None, builtinAlgorithms=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: :py:obj:`abacusai.return_class.AbstractApiClass`


   A version of a model

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param modelVersion: The unique identifier of a model version.
   :type modelVersion: str
   :param modelConfigType: Name of the TrainingConfig class of the model_config.
   :type modelConfigType: str
   :param status: The current status of the model.
   :type status: str
   :param modelId: A reference to the model this version belongs to.
   :type modelId: str
   :param modelPredictionConfig: The prediction config options for the model.
   :type modelPredictionConfig: dict
   :param trainingStartedAt: The start time and date of the training process in ISO-8601 format.
   :type trainingStartedAt: str
   :param trainingCompletedAt: The end time and date of the training process in ISO-8601 format.
   :type trainingCompletedAt: str
   :param featureGroupVersions: A list of Feature Group version IDs used for model training.
   :type featureGroupVersions: list
   :param customAlgorithms: List of user-defined algorithms used for model training.
   :type customAlgorithms: list
   :param builtinAlgorithms: List of algorithm names builtin algorithms provided by Abacus.AI used for model training.
   :type builtinAlgorithms: list
   :param error: Relevant error if the status is FAILED.
   :type error: str
   :param pendingDeploymentIds: List of deployment IDs where deployment is pending.
   :type pendingDeploymentIds: list
   :param failedDeploymentIds: List of failed deployment IDs.
   :type failedDeploymentIds: list
   :param cpuSize: CPU size specified for the python model training.
   :type cpuSize: str
   :param memory: Memory in GB specified for the python model training.
   :type memory: int
   :param automlComplete: If true, all algorithms have completed training.
   :type automlComplete: bool
   :param trainingFeatureGroupIds: The unique identifiers of the feature groups used as inputs during training to create this ModelVersion.
   :type trainingFeatureGroupIds: list
   :param trainingDocumentRetrieverVersions: The document retriever version IDs used as inputs during training to create this ModelVersion.
   :type trainingDocumentRetrieverVersions: list
   :param documentRetrieverMappings: mapping of document retriever version to their respective information.
   :type documentRetrieverMappings: dict
   :param bestAlgorithm: Best performing algorithm.
   :type bestAlgorithm: dict
   :param defaultAlgorithm: Default algorithm that the user has selected.
   :type defaultAlgorithm: dict
   :param featureAnalysisStatus: Lifecycle of the feature analysis stage.
   :type featureAnalysisStatus: str
   :param dataClusterInfo: Information about the models for different data clusters.
   :type dataClusterInfo: dict
   :param customAlgorithmConfigs: User-defined configs for each of the user-defined custom algorithms.
   :type customAlgorithmConfigs: dict
   :param trainedModelTypes: List of trained model types.
   :type trainedModelTypes: list
   :param useGpu: Whether this model version is using gpu
   :type useGpu: bool
   :param partialComplete: If true, all required algorithms have completed training.
   :type partialComplete: bool
   :param modelFeatureGroupSchemaMappings: mapping of feature group to schema version
   :type modelFeatureGroupSchemaMappings: dict
   :param trainingConfigUpdated: If the training config has been updated since the instance was created.
   :type trainingConfigUpdated: bool
   :param codeSource: If a python model, information on where the source code is located.
   :type codeSource: CodeSource
   :param modelConfig: The training config options used to train this model.
   :type modelConfig: TrainingConfig
   :param deployableAlgorithms: List of deployable algorithms.
   :type deployableAlgorithms: DeployableAlgorithm


   .. py:method:: __repr__()

      Return repr(self).



   .. py:method:: to_dict()

      Get a dict representation of the parameters in this class

      :returns: The dict value representation of the class parameters
      :rtype: dict



   .. py:method:: 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.

      :param model_version: The unique version ID of the model version.
      :type model_version: str

      :returns: The feature group version containing the training data and folds information.
      :rtype: FeatureGroupVersion



   .. py:method:: 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


      :param metric: The metric to use to determine the best model.
      :type metric: str



   .. py:method:: get_feature_group_schemas_for()

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

      :param model_version: Unique string identifier for the version of the model.
      :type model_version: str

      :returns: List of schema for all feature groups used in the model version.
      :rtype: list[ModelVersionFeatureGroupSchema]



   .. py:method:: delete()

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

      :param model_version: The unique identifier of the model version to delete.
      :type model_version: str



   .. py:method:: export_model_artifact_as_feature_group(table_name, artifact_type = None)

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

      :param table_name: Name of the feature group table to create.
      :type table_name: str
      :param artifact_type: eval artifact type to export.
      :type artifact_type: EvalArtifactType

      :returns: The created feature group.
      :rtype: FeatureGroup



   .. py:method:: refresh()

      Calls describe and refreshes the current object's fields

      :returns: The current object
      :rtype: ModelVersion



   .. py:method:: describe()

      Retrieves a full description of the specified model version.

      :param model_version: Unique string identifier of the model version.
      :type model_version: str

      :returns: A model version.
      :rtype: ModelVersion



   .. py:method:: get_feature_importance_by()

      Gets the feature importance calculated by various methods for the model.

      :param model_version: Unique string identifier for the model version.
      :type model_version: str

      :returns: Feature importances for the model.
      :rtype: FeatureImportance



   .. py:method:: get_training_data_logs()

      Retrieves the data preparation logs during model training.

      :param model_version: The unique version ID of the model version.
      :type model_version: str

      :returns: A list of logs.
      :rtype: list[DataPrepLogs]



   .. py:method:: get_training_logs(stdout = False, stderr = False)

      Returns training logs for the model.

      :param stdout: Set True to get info logs.
      :type stdout: bool
      :param stderr: Set True to get error logs.
      :type stderr: bool

      :returns: A function logs object.
      :rtype: FunctionLogs



   .. py:method:: export_custom(output_location, algorithm = None)

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

      :param output_location: Location to export the model artifacts results. For example, s3://a-bucket/
      :type output_location: str
      :param algorithm: The algorithm to be exported. Optional if there's only one custom algorithm in the model version.
      :type algorithm: str

      :returns: Object describing the export and its status.
      :rtype: ModelArtifactsExport



   .. py:method:: wait_for_training(timeout=None)

      A waiting call until model gets trained.

      :param timeout: 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.
      :type timeout: int



   .. py:method:: wait_for_full_automl(timeout=None)

      A waiting call until full AutoML cycle is completed.

      :param timeout: 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.
      :type timeout: int



   .. py:method:: get_status()

      Gets the status of the model version under training.

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



   .. py:method:: 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.
      :rtype: pandas.Dataframe



