: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: The problem type associated with the project.
   :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: A unique string identifier for the project.
      :type project_id: str

      :returns: The description of the project.
      :rtype: Project


   .. py:method:: list_datasets()

      Retrieves all datasets associated with a specified project. This API returns all attributes of each dataset, such as its name, type, and ID.

      :param project_id: Unique string identifier associated with the project.
      :type project_id: str

      :returns: A list 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()

      Delete a specified project from your organization.

      This method deletes the project, its associated trained models, and deployments. 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. Ensure that all active deployments are stopped before using 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 if the input feature is part of a nested feature group for the given feature_group_id.
      :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 list of 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 the data type of a dataset's 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 data_type: The type of data in the column. Refer to the [guide on feature types](FEATURE_TYPES_URL) for more information. Note: Some ColumnMappings will restrict the options or explicitly set the DataType. Possible values:  CATEGORICAL,  CATEGORICAL_LIST,  NUMERICAL,  TIMESTAMP,  TEXT,  EMAIL,  LABEL_LIST,  JSON,  OBJECT_REFERENCE,  MULTICATEGORICAL_LIST,  COORDINATE_LIST,  NUMERICAL_LIST,  TIMESTAMP_LIST
      :type data_type: str

      :returns: A list of objects that describes the resulting dataset's schema after the column's data type 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 column 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 present in this project to be returned if they are of the given use. Possible values are:  DATA_WRANGLING,  TRAINING_INPUT,  BATCH_PREDICTION_INPUT,  BATCH_PREDICTION_OUTPUT.
      :type filter_feature_group_use: str

      :returns: All the Feature Groups in a project.
      :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: Maximum number of templates to be retrieved.
      :type limit: int
      :param start_after_id: Offset parameter to exclude all templates till the specified feature group template ID.
      :type start_after_id: str
      :param should_include_all_system_templates: If True, will include built-in 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]({USE_CASES_URL}) 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: Whether the training config options are used for retraining.
      :type for_retrain: bool
      :param current_training_config: The current state of the training config, with some options set, which shall be used to get new options after refresh. This is `None` by default initially.
      :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 the 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)

      Train a model for the specified project.

      This method trains a model in the given project, using user-specified training configurations defined in the `getTrainingConfigOptions` method.


      :param name: The name of the model. 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, the default enabled custom algorithms will be used.
      :type custom_algorithms: list
      :param custom_algorithms_only: Whether to only run custom algorithms.
      :type custom_algorithms_only: bool
      :param custom_algorithm_configs: Configs for each user-defined algorithm; key is the algorithm name, value is the config serialized to JSON.
      :type custom_algorithm_configs: dict
      :param builtin_algorithms: List of IDs of the builtin algorithms provided by Abacus.AI to train. If not set, all applicable builtin algorithms will be used.
      :type builtin_algorithms: list
      :param cpu_size: Size of the CPU for the user-defined algorithms during training.
      :type cpu_size: str
      :param memory: Memory (in GB) for the user-defined algorithms during training.
      :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, use_gpu = False)

      Initializes a new Model from user-provided Python code. If a list of input feature groups is supplied, they will be provided 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 to run predictions through the 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: List of package requirement strings. For example: ['numpy==1.2.3', 'pandas>=1.4.0']
      :type package_requirements: list
      :param use_gpu: Whether this model needs gpu
      :type use_gpu: bool

      :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: Unique string identifier associated with the project.
      :type project_id: str

      :returns: A list 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 information about how to call the custom train function.

      :param feature_group_names_for_training: A list of feature group table names to 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 the train function.
      :type training_data_parameter_name_override: dict
      :param training_config: Training config names and values for the options supported by the 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).
      :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: Selection strategy for the feature_group 1 with the feature group version if selected.
      :type feature_group_base_monitor_config: dict
      :param feature_group_comparison_monitor_config: Selection strategy for the feature_group 1 with the feature group version if selected.
      :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 model monitors in the specified project.

      :param project_id: Unique string identifier associated with the project.
      :type project_id: str

      :returns: A list of model monitors.
      :rtype: ModelMonitor


   .. py:method:: create_vision_drift_monitor(prediction_feature_group_id, training_feature_group_id, name, feature_mappings, training_feature_mappings, target_value_performance = None, refresh_schedule = None)

      Runs a vision drift monitor for the specified project.

      :param prediction_feature_group_id: Unique string identifier of the prediction data feature group.
      :type prediction_feature_group_id: str
      :param training_feature_group_id: Unique string identifier 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 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 training_feature_mappings: A JSON map to override features for training_feature_group, where keys are column names and the values are feature data use types.
      :type training_feature_mappings: dict
      :param target_value_performance: A target positive value for the label to compute precision-recall curve/area under curve for performance page.
      :type target_value_performance: str
      :param refresh_schedule: A cron-style string that describes a schedule in UTC to automatically retrain the created vision drift monitor.
      :type refresh_schedule: str

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


   .. py:method:: create_eda(feature_group_id, name, refresh_schedule = None, include_collinearity = False, include_data_consistency = False, collinearity_keys = None, primary_keys = None, data_consistency_test_config = None, data_consistency_reference_config = None, feature_mappings = None, forecast_frequency = None)

      Run an Exploratory Data Analysis (EDA) for the specified project.

      :param feature_group_id: The unique ID of the prediction data feature group.
      :type feature_group_id: str
      :param name: The name you want your model monitor to have. Defaults to "<Project Name> EDA".
      :type name: str
      :param refresh_schedule: A cron-style string that describes a schedule in UTC to automatically retrain the created EDA.
      :type refresh_schedule: str
      :param include_collinearity: Set to True if the EDA type is collinearity.
      :type include_collinearity: bool
      :param include_data_consistency: Set to True if the EDA type is data consistency.
      :type include_data_consistency: bool
      :param collinearity_keys: List of features to use for collinearity
      :type collinearity_keys: list
      :param primary_keys: List of features that corresponds to the primary keys or item ids for the given feature group for Data Consistency analysis or Forecasting analysis respectively.
      :type primary_keys: list
      :param data_consistency_test_config: Test feature group version selection strategy for Data Consistency EDA type.
      :type data_consistency_test_config: dict
      :param data_consistency_reference_config: Reference feature group version selection strategy for Data Consistency EDA type.
      :type data_consistency_reference_config: dict
      :param feature_mappings: A JSON map to override features for the given feature_group, where keys are column names and the values are feature data use types. (In forecasting, used to set the timestamp column and target value)
      :type feature_mappings: dict
      :param forecast_frequency: The frequency of the data. It can be either HOURLY, DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY.
      :type forecast_frequency: str

      :returns: The new EDA object that was created.
      :rtype: Eda


   .. py:method:: list_eda()

      Retrieves the list of Exploratory Data Analysis (EDA) in the specified project.

      :param project_id: Unique string identifier associated with the project.
      :type project_id: str

      :returns: List of EDA objects.
      :rtype: Eda


   .. 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: Unique string identifier for the model monitor created under the project.
      :type model_monitor_id: str
      :param alert_name: Name of the alert.
      :type alert_name: str
      :param condition_config: Condition to run the actions for the alert.
      :type condition_config: dict
      :param action_config: Configuration for the action of the alert.
      :type action_config: dict

      :returns: 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 to the project level.


      :param name: The name of the deployment 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 identifier 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 associated with the specified project.

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

      :returns: A list 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 of batch predictions in the project.

      :param project_id: Unique string identifier of the project.
      :type project_id: str

      :returns: List of batch prediction jobs.
      :rtype: BatchPrediction


   .. py:method:: create_graph_dashboard(name, python_function_ids = None)

      Create a plot dashboard given selected python plots

      :param name: The name of the dashboard.
      :type name: str
      :param python_function_ids: A list of unique string identifiers for the python functions to be used in the graph dashboard.
      :type python_function_ids: list

      :returns: An object describing the graph dashboard.
      :rtype: GraphDashboard


   .. py:method:: list_graph_dashboards()

      Lists the graph dashboards for a project

      :param project_id: Unique string identifier for the project to list graph dashboards from.
      :type project_id: str

      :returns: A list of graph dashboards.
      :rtype: GraphDashboard


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

      Return list of built-in algorithms based on given input.

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

      :returns: 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



