abacusai.prediction_operator — AbacusAI documentation

# abacusai.prediction_operator

## Classes

`PredictionOperator` | A prediction operator.

## Module Contents

class abacusai.prediction_operator.PredictionOperator(client, name=None, predictionOperatorId=None, createdAt=None, updatedAt=None, projectId=None, predictFunctionName=None, sourceCode=None, initializeFunctionName=None, notebookId=None, memory=None, useGpu=None, featureGroupIds=None, featureGroupTableNames=None, codeSource={}, refreshSchedules={}, latestPredictionOperatorVersion={})

  Bases: `abacusai.return_class.AbstractApiClass`

  A prediction operator.

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - name (str) – The name for the prediction operator.

    - predictionOperatorId (str) – The unique identifier of the prediction operator.

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

    - updatedAt (str) – Date and time at which the prediction operator was updated.

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

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

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

    - initializeFunctionName (str) – Name of the optional initialize function found in the source code. This function will generate anything used by predictions, based on input feature groups.

    - notebookId (str) – The unique string identifier of the notebook used to create or edit the prediction operator.

    - memory (int) – Memory in GB specified for the prediction operator.

    - useGpu (bool) – Whether this prediction operator is using gpu.

    - featureGroupIds (list) – A list of Feature Group IDs used for initializing.

    - featureGroupTableNames (list) – A list of Feature Group table names used for initializing.

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

    - latestPredictionOperatorVersion (PredictionOperatorVersion) – The unique string identifier of the latest version.

    - refreshSchedules (RefreshSchedule) – List of refresh schedules that indicate when the next prediction operator version will be processed

  name = None
  prediction_operator_id = None
  created_at = None
  updated_at = None
  project_id = None
  predict_function_name = None
  source_code = None
  initialize_function_name = None
  notebook_id = None
  memory = None
  use_gpu = None
  feature_group_ids = None
  feature_group_table_names = None
  code_source
  refresh_schedules
  latest_prediction_operator_version
  deprecated_keys
  __repr__()
  to_dict()

    Get a dict representation of the parameters in this class

    Returns:

      The dict value representation of the class parameters

    Return type:

      dict

  refresh()

    Calls describe and refreshes the current object’s fields

    Returns:

      The current object

    Return type:

      PredictionOperator

  describe()

    Describe an existing prediction operator.

    Parameters:

      prediction_operator_id (str) – The unique ID of the prediction operator.

    Returns:

      The requested prediction operator object.

    Return type:

      PredictionOperator

  update(name=None, feature_group_ids=None, source_code=None, initialize_function_name=None, predict_function_name=None, cpu_size=None, memory=None, package_requirements=None, use_gpu=None)

    Update an existing prediction operator. This does not create a new version.

    Parameters:

      - name (str) – Name of the prediction operator.

      - feature_group_ids (List) – List of feature groups that are supplied to the initialize function as parameters. Each of the parameters are materialized Dataframes. The order should match the initialize function’s parameters.

      - source_code (str) – Contents of a valid Python source code file. The source code should contain the function predictFunctionName, and the function ‘initializeFunctionName’ if defined.

      - initialize_function_name (str) – Name of the optional initialize function found in the source code. This function will generate anything used by predictions, based on input feature groups.

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

      - cpu_size (str) – Size of the CPU for the prediction operator.

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

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

      - use_gpu (bool) – Whether this prediction operator needs gpu.

    Returns:

      The updated prediction operator object.

    Return type:

      PredictionOperator

  delete()

    Delete an existing prediction operator.

    Parameters:

      prediction_operator_id (str) – The unique ID of the prediction operator.

  deploy(auto_deploy=True)

    Deploy the prediction operator.

    Parameters:

      auto_deploy (bool) – Flag to enable the automatic deployment when a new prediction operator version is created.

    Returns:

      The created deployment object.

    Return type:

      Deployment

  create_version()

    Create a new version of the prediction operator.

    Parameters:

      prediction_operator_id (str) – The unique ID of the prediction operator.

    Returns:

      The created prediction operator version object.

    Return type:

      PredictionOperatorVersion

  list_versions()

    List all the prediction operator versions for a prediction operator.

    Parameters:

      prediction_operator_id (str) – The unique ID of the prediction operator.

    Returns:

      A list of prediction operator version objects.

    Return type:

      list[PredictionOperatorVersion]