:py:mod:`abacusai.batch_prediction`
===================================

.. py:module:: abacusai.batch_prediction


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

Classes
~~~~~~~

.. autoapisummary::

   abacusai.batch_prediction.BatchPrediction




.. py:class:: BatchPrediction(client, batchPredictionId=None, createdAt=None, name=None, deploymentId=None, fileConnectorOutputLocation=None, databaseConnectorId=None, databaseOutputConfiguration=None, explanations=None, fileOutputFormat=None, connectorType=None, legacyInputLocation=None, featureGroupTableName=None, summaryFeatureGroupTableName=None, csvInputPrefix=None, csvPredictionPrefix=None, csvExplanationsPrefix=None, outputIncludesMetadata=None, resultInputColumns=None, modelMonitorId=None, modelVersion=None, algorithm=None, batchInputs={}, latestBatchPredictionVersion={}, refreshSchedules={}, globalPredictionArgs={})

   Bases: :py:obj:`abacusai.return_class.AbstractApiClass`

   Make batch predictions.

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param batchPredictionId: The unique identifier of the batch prediction request.
   :type batchPredictionId: str
   :param createdAt: When the batch prediction was created, in ISO-8601 format.
   :type createdAt: str
   :param name: Name given to the batch prediction object.
   :type name: str
   :param deploymentId: The deployment used to make the predictions.
   :type deploymentId: str
   :param fileConnectorOutputLocation: Contains information about where the batch predictions are written to.
   :type fileConnectorOutputLocation: str
   :param databaseConnectorId: The database connector to write the results to.
   :type databaseConnectorId: str
   :param databaseOutputConfiguration: Contains information about where the batch predictions are written to.
   :type databaseOutputConfiguration: dict
   :param explanations: If true, explanations for each prediction will be created.
   :type explanations: bool
   :param fileOutputFormat: The format of the batch prediction output (CSV or JSON).
   :type fileOutputFormat: str
   :param connectorType: Null if writing to internal console, else FEATURE_GROUP | FILE_CONNECTOR | DATABASE_CONNECTOR.
   :type connectorType: str
   :param legacyInputLocation: The location of the input data.
   :type legacyInputLocation: str
   :param featureGroupTableName: The table name of the Batch Prediction feature group.
   :type featureGroupTableName: str
   :param summaryFeatureGroupTableName: The table name of the metrics summary feature group output by Batch Prediction.
   :type summaryFeatureGroupTableName: str
   :param csvInputPrefix: A prefix to prepend to the input columns, only applies when output format is CSV.
   :type csvInputPrefix: str
   :param csvPredictionPrefix: A prefix to prepend to the prediction columns, only applies when output format is CSV.
   :type csvPredictionPrefix: str
   :param csvExplanationsPrefix: A prefix to prepend to the explanation columns, only applies when output format is CSV.
   :type csvExplanationsPrefix: str
   :param outputIncludesMetadata: If true, output will contain columns including prediction start time, batch prediction version, and model version.
   :type outputIncludesMetadata: bool
   :param resultInputColumns: If present, will limit result files or feature groups to only include columns present in this list.
   :type resultInputColumns: list
   :param modelMonitorId: The model monitor for this batch prediction.
   :type modelMonitorId: str
   :param modelVersion: The model instance used in the deployment for the batch prediction.
   :type modelVersion: str
   :param algorithm: The algorithm that is currently deployed.
   :type algorithm: str
   :param batchInputs: Inputs to the batch prediction.
   :type batchInputs: PredictionInput
   :param latestBatchPredictionVersion: The latest batch prediction version.
   :type latestBatchPredictionVersion: BatchPredictionVersion
   :param refreshSchedules: List of refresh schedules that dictate the next time the batch prediction will be run.
   :type refreshSchedules: RefreshSchedule
   :param globalPredictionArgs: Argument(s) passed to every prediction call.
   :type globalPredictionArgs: BatchPredictionArgs

   .. 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:: start()

      Creates a new batch prediction version job for a given batch prediction job description.

      :param batch_prediction_id: The unique identifier of the batch prediction to create a new version of.
      :type batch_prediction_id: str

      :returns: The batch prediction version started by this method call.
      :rtype: BatchPredictionVersion


   .. py:method:: refresh()

      Calls describe and refreshes the current object's fields

      :returns: The current object
      :rtype: BatchPrediction


   .. py:method:: describe()

      Describe the batch prediction.

      :param batch_prediction_id: The unique identifier associated with the batch prediction.
      :type batch_prediction_id: str

      :returns: The batch prediction description.
      :rtype: BatchPrediction


   .. py:method:: list_versions(limit = 100, start_after_version = None)

      Retrieves a list of versions of a given batch prediction

      :param limit: Number of versions to list.
      :type limit: int
      :param start_after_version: Version to start after.
      :type start_after_version: str

      :returns: List of batch prediction versions.
      :rtype: list[BatchPredictionVersion]


   .. py:method:: update(deployment_id = None, global_prediction_args = None, explanations = None, output_format = None, csv_input_prefix = None, csv_prediction_prefix = None, csv_explanations_prefix = None, output_includes_metadata = None, result_input_columns = None, name = None)

      Update a batch prediction job description.

      :param deployment_id: Unique identifier of the deployment.
      :type deployment_id: str
      :param global_prediction_args: Batch Prediction args specific to problem type.
      :type global_prediction_args: BatchPredictionArgs
      :param explanations: If True, SHAP explanations for each prediction will be provided, if supported by the use case.
      :type explanations: bool
      :param output_format: If specified, sets the format of the batch prediction output (CSV or JSON).
      :type output_format: str
      :param csv_input_prefix: Prefix to prepend to the input columns, only applies when output format is CSV.
      :type csv_input_prefix: str
      :param csv_prediction_prefix: Prefix to prepend to the prediction columns, only applies when output format is CSV.
      :type csv_prediction_prefix: str
      :param csv_explanations_prefix: Prefix to prepend to the explanation columns, only applies when output format is CSV.
      :type csv_explanations_prefix: str
      :param output_includes_metadata: If True, output will contain columns including prediction start time, batch prediction version, and model version.
      :type output_includes_metadata: bool
      :param result_input_columns: If present, will limit result files or feature groups to only include columns present in this list.
      :type result_input_columns: list
      :param name: If present, will rename the batch prediction.
      :type name: str

      :returns: The batch prediction.
      :rtype: BatchPrediction


   .. py:method:: set_file_connector_output(output_format = None, output_location = None)

      Updates the file connector output configuration of the batch prediction

      :param output_format: The format of the batch prediction output (CSV or JSON). If not specified, the default format will be used.
      :type output_format: str
      :param output_location: The location to write the prediction results. If not specified, results will be stored in Abacus.AI.
      :type output_location: str

      :returns: The batch prediction description.
      :rtype: BatchPrediction


   .. py:method:: set_database_connector_output(database_connector_id = None, database_output_config = None)

      Updates the database connector output configuration of the batch prediction

      :param database_connector_id: Unique string identifier of an Database Connection to write predictions to.
      :type database_connector_id: str
      :param database_output_config: Key-value pair of columns/values to write to the database connector.
      :type database_output_config: dict

      :returns: Description of the batch prediction.
      :rtype: BatchPrediction


   .. py:method:: set_feature_group_output(table_name)

      Creates a feature group and sets it as the batch prediction output.

      :param table_name: Name of the feature group table to create.
      :type table_name: str

      :returns: Batch prediction after the output has been applied.
      :rtype: BatchPrediction


   .. py:method:: set_output_to_console()

      Sets the batch prediction output to the console, clearing both the file connector and database connector configurations.

      :param batch_prediction_id: The unique identifier of the batch prediction.
      :type batch_prediction_id: str

      :returns: The batch prediction description.
      :rtype: BatchPrediction


   .. py:method:: set_feature_group(feature_group_type, feature_group_id = None)

      Sets the batch prediction input feature group.

      :param feature_group_type: Enum string representing the feature group type to set. The type is based on the use case under which the feature group is being created (e.g. Catalog Attributes for personalized recommendation use case).
      :type feature_group_type: str
      :param feature_group_id: Unique identifier of the feature group to set as input to the batch prediction.
      :type feature_group_id: str

      :returns: Description of the batch prediction.
      :rtype: BatchPrediction


   .. py:method:: set_dataset_remap(dataset_id_remap)

      For the purpose of this batch prediction, will swap out datasets in the training feature groups

      :param dataset_id_remap: Key/value pairs of dataset ids to be replaced during the batch prediction.
      :type dataset_id_remap: dict

      :returns: Batch prediction object.
      :rtype: BatchPrediction


   .. py:method:: delete()

      Deletes a batch prediction and associated data, such as associated monitors.

      :param batch_prediction_id: Unique string identifier of the batch prediction.
      :type batch_prediction_id: str


   .. py:method:: wait_for_predictions(timeout=86400)

      A waiting call until batch predictions are ready.

      :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_drift_monitor(timeout=86400)

      A waiting call until batch prediction drift monitor calculations are ready.

      :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 latest batch prediction version.

      :returns: A string describing the status of the latest batch prediction version e.g., pending, complete, etc.
      :rtype: str


   .. py:method:: create_refresh_policy(cron)

      To create a refresh policy for a batch prediction.

      :param cron: A cron style string to set the refresh time.
      :type cron: str

      :returns: The refresh policy object.
      :rtype: RefreshPolicy


   .. py:method:: list_refresh_policies()

      Gets the refresh policies in a list.

      :returns: A list of refresh policy objects.
      :rtype: List[RefreshPolicy]


   .. py:method:: describe_output_feature_group()

      Gets the results feature group for this batch prediction

      :returns: A feature group object.
      :rtype: FeatureGroup



