:py:mod:`abacusai.project`
==========================

.. py:module:: abacusai.project


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

Classes
~~~~~~~

.. autoapisummary::

   abacusai.project.Project




.. py:class:: Project(client, projectId=None, name=None, useCase=None, problemType=None, createdAt=None, featureGroupsEnabled=None)

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

   A project is a container which holds datasets, models and deployments

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param projectId: The ID of the project.
   :type projectId: str
   :param name: The name of the project.
   :type name: str
   :param useCase: The  Use Case associated with the project.
   :type useCase: str
   :param problemType:
   :type problemType: str
   :param createdAt: The date and time when the project was created.
   :type createdAt: str
   :param featureGroupsEnabled: Project uses feature groups instead of datasets.
   :type featureGroupsEnabled: bool

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

      Calls describe and refreshes the current object's fields

      :returns: The current object
      :rtype: Project


   .. py:method:: describe()

      Returns a description of a project.

      :param project_id: The unique project ID
      :type project_id: str

      :returns: The project description is returned.
      :rtype: Project


   .. py:method:: list_datasets()

      Retrieves all dataset(s) attached to a specified project. This API returns all attributes of each dataset, such as its name, type, and ID.

      :param project_id: The unique ID associated with the project.
      :type project_id: str

      :returns: An array representing all of the datasets attached to the project.
      :rtype: ProjectDataset


   .. py:method:: get_schema(dataset_id)

      [DEPRECATED] Returns a schema given a specific dataset in a project. The schema of the dataset consists of the columns in the dataset, the data type of the column, and the column's column mapping.

      :param dataset_id: The unique ID associated with the dataset.
      :type dataset_id: str

      :returns: An array of objects for each column in the specified dataset.
      :rtype: Schema


   .. py:method:: rename(name)

      This method renames a project after it is created.

      :param name: The new name for the project.
      :type name: str


   .. py:method:: delete()

      Deletes a specified project from your organization.

      This method deletes the project, trained models and deployments in the specified project. The datasets attached to the specified project remain available for use with other projects in the organization.

      This method will not delete a project that contains active deployments. Be sure to stop all active deployments before you use the delete option.

      Note: All projects, models, and deployments cannot be recovered once they are deleted.


      :param project_id: The unique ID of the project to delete.
      :type project_id: str


   .. py:method:: set_feature_mapping(feature_group_id, feature_name, feature_mapping, nested_column_name = None)

      Set a column's feature mapping. If the column mapping is single-use and already set in another column in this feature group, this call will first remove the other column's mapping and move it to this column.

      :param feature_group_id: The unique ID associated with the feature group.
      :type feature_group_id: str
      :param feature_name: The name of the feature.
      :type feature_name: str
      :param feature_mapping: The mapping of the feature in the feature group.
      :type feature_mapping: str
      :param nested_column_name: The name of the nested column.
      :type nested_column_name: str

      :returns: A list of objects that describes the resulting feature group's schema after the feature's featureMapping is set.
      :rtype: Feature


   .. py:method:: validate(feature_group_ids = None)

      Validates that the specified project has all required feature group types for its use case and that all required feature columns are set.

      :param feature_group_ids: The feature group IDS to validate
      :type feature_group_ids: list

      :returns: The project validation. If the specified project is missing required columns or feature groups, the response includes an array of objects for each missing required feature group and the missing required features in each feature group.
      :rtype: ProjectValidation


   .. py:method:: set_column_data_type(dataset_id, column, data_type)

      Set a dataset's column type.

      :param dataset_id: The unique ID associated with the dataset.
      :type dataset_id: str
      :param column: The name of the column.
      :type column: str
      :param data_type: The type of the data in the column.  CATEGORICAL,  CATEGORICAL_LIST,  NUMERICAL,  TIMESTAMP,  TEXT,  EMAIL,  LABEL_LIST,  JSON,  OBJECT_REFERENCE,  MULTICATEGORICAL_LIST,  COORDINATE_LIST,  NUMERICAL_LIST,  TIMESTAMP_LIST Refer to the (guide on feature types)[https://api.abacus.ai/app/help/class/FeatureType] for more information. Note: Some ColumnMappings will restrict the options or explicitly set the DataType.
      :type data_type: str

      :returns: A list of objects that describes the resulting dataset's schema after the column's dataType is set.
      :rtype: Schema


   .. py:method:: set_column_mapping(dataset_id, column, column_mapping)

      Set a dataset's column mapping. If the column mapping is single-use and already set in another column in this dataset, this call will first remove the other column's mapping and move it to this column.

      :param dataset_id: The unique ID associated with the dataset.
      :type dataset_id: str
      :param column: The name of the column.
      :type column: str
      :param column_mapping: The mapping of the column in the dataset. See a list of columns mapping enums here.
      :type column_mapping: str

      :returns: A list of columns that describes the resulting dataset's schema after the column's columnMapping is set.
      :rtype: Schema


   .. py:method:: remove_column_mapping(dataset_id, column)

      Removes a column mapping from a column in the dataset. Returns a list of all columns with their mappings once the change is made.

      :param dataset_id: The unique ID associated with the dataset.
      :type dataset_id: str
      :param column: The name of the column.
      :type column: str

      :returns: A list of objects that describes the resulting dataset's schema after the column's columnMapping is set.
      :rtype: Schema


   .. py:method:: list_feature_groups(filter_feature_group_use = None)

      List all the feature groups associated with a project

      :param filter_feature_group_use: The feature group use filter, when given as an argument, only allows feature groups in this project to be returned if they are of the given use.  DATA_WRANGLING,  TRAINING_INPUT,  BATCH_PREDICTION_INPUT,  BATCH_PREDICTION_OUTPUT
      :type filter_feature_group_use: str

      :returns: All the Feature Groups in the Organization
      :rtype: FeatureGroup


   .. py:method:: list_feature_group_templates(limit = 100, start_after_id = None, should_include_all_system_templates = False)

      List feature group templates for feature groups associated with the project.

      :param limit: The maximum number of templates to be retrieved.
      :type limit: int
      :param start_after_id: An offset parameter to exclude all templates till the specified feature group template ID.
      :type start_after_id: str
      :param should_include_all_system_templates:
      :type should_include_all_system_templates: bool

      :returns: All the feature groups in the organization, optionally limited by the feature group that created the template(s).
      :rtype: FeatureGroupTemplate


   .. py:method:: get_training_config_options(feature_group_ids = None, for_retrain = False, current_training_config = None)

      Retrieves the full initial description of the model training configuration options available for the specified project.

      The configuration options available are determined by the use case associated with the specified project. Refer to the (Use Case Documentation)[https://api.abacus.ai/app/help/useCases] for more information on use cases and use case specific configuration options.


      :param feature_group_ids: The feature group IDs to be used for training
      :type feature_group_ids: list
      :param for_retrain: If training config options are used for retrain
      :type for_retrain: bool
      :param current_training_config: This is None by default initially and represents the current state of the training config, with some options set, which shall be used to get new options after refresh.
      :type current_training_config: dict

      :returns: An array of options that can be specified when training a model in this project.
      :rtype: TrainingConfigOptions


   .. py:method:: create_train_test_data_split_feature_group(training_config, feature_group_ids)

      Get the train and test data split without training the model. Only supported for models with custom algorithms.

      :param training_config: The training config key/value pairs used to influence how split is calculated.
      :type training_config: dict
      :param feature_group_ids: List of feature group ids provided by the user, including the required one for data split and others to influence how to split.
      :type feature_group_ids: list

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


   .. py:method:: train_model(name = None, training_config = None, feature_group_ids = None, refresh_schedule = None, custom_algorithms = None, custom_algorithms_only = False, custom_algorithm_configs = None, builtin_algorithms = None, cpu_size = None, memory = None)

      Trains a model for the specified project.

      Use this method to train a model in this project. This method supports user-specified training configurations defined in the getTrainingConfigOptions method.


      :param name: The name you want your model to have. Defaults to "<Project Name> Model".
      :type name: str
      :param training_config: The training config key/value pairs used to train this model.
      :type training_config: dict
      :param feature_group_ids: List of feature group ids provided by the user to train the model on.
      :type feature_group_ids: list
      :param refresh_schedule: A cron-style string that describes a schedule in UTC to automatically retrain the created model.
      :type refresh_schedule: str
      :param custom_algorithms: List of user-defined algorithms to train. If not set, will run default enabled custom algorithms.
      :type custom_algorithms: list
      :param custom_algorithms_only: Whether only run custom algorithms.
      :type custom_algorithms_only: bool
      :param custom_algorithm_configs: Configs for each user-defined algorithm, key is algorithm name, value is the config serialized to json
      :type custom_algorithm_configs: dict
      :param builtin_algorithms: List of the builtin algorithms provided by Abacus.AI to train. If not set, will try all applicable builtin algorithms.
      :type builtin_algorithms: list
      :param cpu_size: Size of the cpu for the user-defined algorithms during train.
      :type cpu_size: str
      :param memory: Memory (in GB) for the user-defined algorithms during train.
      :type memory: int

      :returns: The new model which is being trained.
      :rtype: Model


   .. py:method:: create_model_from_python(function_source_code, train_function_name, training_input_tables, predict_function_name = None, predict_many_function_name = None, initialize_function_name = None, name = None, cpu_size = None, memory = None, training_config = None, exclusive_run = False, package_requirements = None)

      Initializes a new Model from user provided Python code. If a list of input feature groups are supplied,

      we will provide 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` and `predictFunctionName` has no well defined return type,
      as it returns the prediction made by the `predictFunctionName`, which can be anything


      :param function_source_code: 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.
      :type function_source_code: str
      :param train_function_name: 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.
      :type train_function_name: str
      :param training_input_tables: 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).
      :type training_input_tables: list
      :param predict_function_name: 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.
      :type predict_function_name: str
      :param predict_many_function_name: Name of the function found in the source code that will be executed for batch prediction of the model. It is not executed when this function is run.
      :type predict_many_function_name: str
      :param initialize_function_name: Name of the function found in the source code to initialize the trained model before using it to make predictions using the model
      :type initialize_function_name: str
      :param name: The name you want your model to have. Defaults to "<Project Name> Model"
      :type name: str
      :param cpu_size: Size of the cpu for the model training function
      :type cpu_size: str
      :param memory: Memory (in GB) for the model training function
      :type memory: int
      :param training_config: Training configuration
      :type training_config: dict
      :param exclusive_run: Decides if this model will be run exclusively OR along with other Abacus.ai algorithms
      :type exclusive_run: bool
      :param package_requirements: Json with key value pairs corresponding to package: version for each dependency
      :type package_requirements: dict

      :returns: The new model, which has not been trained.
      :rtype: Model


   .. py:method:: list_models()

      Retrieves the list of models in the specified project.

      :param project_id: The unique ID associated with the project.
      :type project_id: str

      :returns: An array of models.
      :rtype: Model


   .. py:method:: get_custom_train_function_info(feature_group_names_for_training = None, training_data_parameter_name_override = None, training_config = None, custom_algorithm_config = None)

      Returns the information about how to call the custom train function.

      :param feature_group_names_for_training: A list of feature group table names that will be used for training
      :type feature_group_names_for_training: list
      :param training_data_parameter_name_override: Override from feature group type to parameter name in train function.
      :type training_data_parameter_name_override: dict
      :param training_config: Training config names to values for the options supported by Abacus.ai platform.
      :type training_config: dict
      :param custom_algorithm_config: User-defined config that can be serialized by JSON.
      :type custom_algorithm_config: dict

      :returns: Information about how to call the customer provided train function.
      :rtype: CustomTrainFunctionInfo


   .. py:method:: create_model_monitor(prediction_feature_group_id, training_feature_group_id = None, name = None, refresh_schedule = None, target_value = None, target_value_bias = None, target_value_performance = None, feature_mappings = None, model_id = None, training_feature_mappings = None, feature_group_base_monitor_config = None, feature_group_comparison_monitor_config = None)

      Runs a model monitor for the specified project.

      :param prediction_feature_group_id: The unique ID of the prediction data feature group
      :type prediction_feature_group_id: str
      :param training_feature_group_id: The unique ID of the training data feature group
      :type training_feature_group_id: str
      :param name: The name you want your model monitor to have. Defaults to "<Project Name> Model Monitor".
      :type name: str
      :param refresh_schedule: A cron-style string that describes a schedule in UTC to automatically retrain the created model monitor
      :type refresh_schedule: str
      :param target_value: A target positive value for the label to compute bias and pr/auc for performance page (old style until UI is on prod) (TODO: @sheetal)
      :type target_value: str
      :param target_value_bias: A target positive value for the label to compute bias
      :type target_value_bias: str
      :param target_value_performance: A target positive value for the label to compute pr curve/ auc for performance page
      :type target_value_performance: str
      :param feature_mappings: A json map to override features for prediction_feature_group, where keys are column names and the values are feature data use types.
      :type feature_mappings: dict
      :param model_id: The Unique ID of the Model
      :type model_id: str
      :param training_feature_mappings: A json map to override features for training_fature_group, where keys are column names and the values are feature data use types.
      :type training_feature_mappings: dict
      :param feature_group_base_monitor_config:
      :type feature_group_base_monitor_config: dict
      :param feature_group_comparison_monitor_config:
      :type feature_group_comparison_monitor_config: dict

      :returns: The new model monitor that was created.
      :rtype: ModelMonitor


   .. py:method:: list_model_monitors()

      Retrieves the list of models monitors in the specified project.

      :param project_id: The unique ID associated with the project.
      :type project_id: str

      :returns: An array of model monitors.
      :rtype: ModelMonitor


   .. py:method:: create_monitor_alert(model_monitor_id, alert_name, condition_config, action_config)

      Create a monitor alert for the given conditions and monitor

      :param model_monitor_id: The unique identifier to a model monitor created under the project.
      :type model_monitor_id: str
      :param alert_name: The alert name.
      :type alert_name: str
      :param condition_config: The condition to run the actions for the alert.
      :type condition_config: dict
      :param action_config: The configuration for the action of the alert
      :type action_config: dict

      :returns: An object describing the monitor alert
      :rtype: MonitorAlert


   .. py:method:: create_deployment_token(name = None)

      Creates a deployment token for the specified project.

      Deployment tokens are used to authenticate requests to the prediction APIs and are scoped on the project level.


      :param name: The name of the deployement token
      :type name: str

      :returns: The deployment token.
      :rtype: DeploymentAuthToken


   .. py:method:: list_deployments()

      Retrieves a list of all deployments in the specified project.

      :param project_id: The unique ID associated with the project.
      :type project_id: str

      :returns: An array of deployments.
      :rtype: Deployment


   .. py:method:: list_deployment_tokens()

      Retrieves a list of all deployment tokens in the specified project.

      :param project_id: The unique ID associated with the project.
      :type project_id: str

      :returns: An array of deployment tokens.
      :rtype: DeploymentAuthToken


   .. py:method:: list_refresh_policies(dataset_ids = [], model_ids = [], deployment_ids = [], batch_prediction_ids = [], model_monitor_ids = [], prediction_metric_ids = [])

      List the refresh policies for the organization

      :param dataset_ids: Comma separated list of Dataset IDs
      :type dataset_ids: list
      :param model_ids: Comma separated list of Model IDs
      :type model_ids: list
      :param deployment_ids: Comma separated list of Deployment IDs
      :type deployment_ids: list
      :param batch_prediction_ids: Comma separated list of Batch Prediction IDs
      :type batch_prediction_ids: list
      :param model_monitor_ids: Comma separated list of Model Monitor IDs.
      :type model_monitor_ids: list
      :param prediction_metric_ids: Comma separated list of Prediction Metric IDs,
      :type prediction_metric_ids: list

      :returns: List of all refresh policies in the organization
      :rtype: RefreshPolicy


   .. py:method:: list_batch_predictions()

      Retrieves a list for the batch predictions in the project

      :param project_id: The unique identifier of the project
      :type project_id: str

      :returns: A list of batch prediction jobs.
      :rtype: BatchPrediction


   .. py:method:: list_builtin_algorithms(feature_group_ids = None, training_config = None)

      Return list of builtin algorithms based on given input.

      :param feature_group_ids: List of feature group ids applied to the algorithms.
      :type feature_group_ids: list
      :param training_config: The training config key/value pairs used to train with the algorithm.
      :type training_config: dict

      :returns: A list of applicable builtin algorithms.
      :rtype: Algorithm


   .. py:method:: attach_dataset(dataset_id, project_dataset_type)

      Attaches dataset to the project.

      :param dataset_id: A unique identifier for the dataset.
      :type dataset_id: unique string identifier
      :param project_dataset_type: The unique use case specific dataset type that might be required or recommended for the specific use case.
      :type project_dataset_type: enum of type string

      :returns: The schema of the attached dataset.
      :rtype: Schema


   .. py:method:: remove_dataset(dataset_id)

      Removes dataset from the project.

      :param dataset_id: A unique identifier for the dataset.
      :type dataset_id: unique string identifier


   .. py:method:: create_model_from_functions(train_function, predict_function = None, training_input_tables = None, predict_many_function = None, initialize_function = None, cpu_size = None, memory = None, training_config = None, exclusive_run = False)

      Creates a model using python.

      :param train_function: The train function is passed.
      :type train_function: callable
      :param predict_function: The prediction function is passed.
      :type predict_function: callable
      :param training_input_tables: The input tables to be used for training the model. Defaults to None.
      :type training_input_tables: list, optional
      :param predict_many_function: Prediction function for batch input
      :type predict_many_function: callable
      :param cpu_size: Size of the cpu for the feature group function
      :type cpu_size: str
      :param memory: Memory (in GB) for the feature group function
      :type memory: int

      :returns: The model object.
      :rtype: Model



