:py:mod:`abacusai.model_version`
================================

.. py:module:: abacusai.model_version


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

Classes
~~~~~~~

.. autoapisummary::

   abacusai.model_version.ModelVersion




.. py:class:: 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, customAlgorithmConfigs=None, useGpu=None, codeSource={})

   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 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 modelConfig: The training config options used to train this model.
   :type modelConfig: dict
   :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 datasetVersions: A list of Dataset version IDs used for model training.
   :type datasetVersions: list
   :param featureGroupVersions: A list of Feature Group version IDs used for model training.
   :type featureGroupVersions: 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 deployableAlgorithms: List of deployable algorithms.
   :type deployableAlgorithms: list
   :param bestAlgorithm: Best performing algorithm.
   :type bestAlgorithm: str
   :param defaultAlgorithm: Default algorithm that the user has selected.
   :type defaultAlgorithm: str
   :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 useGpu: Whether this model version is using gpu
   :type useGpu: bool
   :param codeSource: If a python model, information on where the source code is located.
   :type codeSource: CodeSource

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

      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.

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


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

      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: EvalArtifact enum specifying which artifact to export.
      :type artifact_type: str

      :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: 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, optional


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


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



