# Models
URL: https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html

# DataRobot Models

## Generic models

### class datarobot.models.GenericModel

GenericModel [ModelRecord] is the object that is returned from the /modelRecords list route.
It contains most generic model information.

## Models

### class datarobot.models.Model

A model trained on a project’s dataset capable of making predictions.

All durations are specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
See [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Variables:

#### classmethod get(project, model_id)

Retrieve a specific model.

- Parameters:
- Returns: model – Queried instance.
- Return type: Model
- Raises: ValueError – passed project parameter value is of not supported type

#### advanced_tune(params, description=None, grid_search_arguments=None)

Generate a new model with the specified advanced-tuning parameters

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters:
- Returns: The created job to build the model
- Return type: ModelJob

#### continue_incremental_learning_from_incremental_model(chunk_definition_id, early_stopping_rounds=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The model retraining job that is created.
- Return type: ModelJob

#### cross_validate()

Run cross validation on the model.

> [!NOTE] Notes
> To perform Cross Validation on a new model with new parameters, use `train` instead.

- Returns: The created job to build the model
- Return type: ModelJob

#### delete()

Delete the model from the project leaderboard.

- Return type: None

#### download_scoring_code(file_name, source_code=False)

Download the Scoring Code JAR.

- Parameters:
- Return type: None

#### download_training_artifact(file_name)

Retrieve trained artifact(s) from a model containing one or more custom tasks.

Artifact(s) will be downloaded to the specified local filepath.

- Parameters: file_name ( str ) – File path where trained model artifact(s) will be saved.

#### classmethod from_data(data)

Instantiate an object of this class using a dict.

- Parameters: data ( dict ) – Correctly snake_cased keys and their values.
- Return type: TypeVar ( T , bound= APIObject)

#### classmethod from_server_data(data, keep_attrs=None)

Override the inherited method because the model must _not_ recursively change casing.

- Parameters:

#### get_advanced_tuning_parameters()

Get the advanced-tuning parameters available for this model.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Returns:A dictionary describing the advanced-tuning parameters for the current model.
  There are two top-level keys, tuning_description and tuning_parameters. tuning_description an optional value. If not None, then it indicates the
user-specified description of this set of tuning parameter. tuning_parameters is a list of a dicts, each has the following keys
* parameter_name :(str)name of the parameter (unique per task, see below)
* parameter_id :(str)opaque ID string uniquely identifying parameter
* default_value :(*)the actual value used to train the model; either
  the single value of the parameter specified before training, or the best
  value from the list of grid-searched values (based on current_value)
* current_value :(*)the single value or list of values of the
  parameter that were grid searched. Depending on the grid search
  specification, could be a single fixed value (no grid search),
  a list of discrete values, or a range.
* task_name :(str)name of the task that this parameter belongs to
* constraints:(dict)see the notes below
* vertex_id:(str)ID of vertex that this parameter belongs to
*Return type:dict

> [!NOTE] Notes
> The type of default_value and current_value is defined by the constraints structure.
> It will be a string or numeric Python type.
> 
> constraints is a dict with at least one, possibly more, of the following keys.
> The presence of a key indicates that the parameter may take on the specified type.
> (If a key is absent, this means that the parameter may not take on the specified type.)
> If a key on constraints is present, its value will be a dict containing
> all of the fields described below for that key.
> 
> ```
> "constraints": {
>     "select": {
>         "values": [<list(basestring or number) : possible values>]
>     },
>     "ascii": {},
>     "unicode": {},
>     "int": {
>         "min": <int : minimum valid value>,
>         "max": <int : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "float": {
>         "min": <float : minimum valid value>,
>         "max": <float : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "intList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <int : minimum valid value>,
>         "max_val": <int : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "floatList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <float : minimum valid value>,
>         "max_val": <float : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     }
> }
> ```
> 
> The keys have meaning as follows:
> 
> select:
>   Rather than specifying a specific data type, if present, it indicates that the parameter
>   is permitted to take on any of the specified values.  Listed values may be of any string
>   or real (non-complex) numeric type.
> ascii:
>   The parameter may be a unicode object that encodes simple ASCII characters.
>   (A-Z, a-z, 0-9, whitespace, and certain common symbols.)  In addition to listed
>   constraints, ASCII keys currently may not contain either newlines or semicolons.
> unicode:
>   The parameter may be any Python unicode object.
> int:
>   The value may be an object of type int within the specified range (inclusive).
>   Please note that the value will be passed around using the JSON format, and
>   some JSON parsers have undefined behavior with integers outside of the range
>   [-(2**53)+1, (2**53)-1].
> float:
>   The value may be an object of type float within the specified range (inclusive).
> intList, floatList:
>   The value may be a list of int or float objects, respectively, following constraints
>   as specified respectively by the int and float types (above).
> 
> Many parameters only specify one key under constraints.  If a parameter specifies multiple
> keys, the parameter may take on any value permitted by any key.

#### get_all_confusion_charts(fallback_to_parent_insights=False)

Retrieve a list of all confusion matrices available for the model.

- Parameters: fallback_to_parent_insights ( bool ) – (New in version v2.14) Optional, if True, this will return confusion chart data for
  this model’s parent for any source that is not available for this model and if this
  has a defined parent model. If omitted or False, or this model has no parent,
  this will not attempt to retrieve any data from this model’s parent.
- Returns: Data for all available confusion charts for model.
- Return type: list of ConfusionChart

#### get_all_feature_impacts(data_slice_filter=None)

Retrieve a list of all feature impact results available for the model.

- Parameters: data_slice_filter ( DataSlice , optional ) – A DataSlice used to filter the return values based on the DataSlice ID. By default, this function
  uses data_slice_filter.id == None, which returns an unsliced insight. If data_slice_filter is None,
  no data_slice filtering will be applied when requesting the ROC curve.
- Returns: Data for all available model feature impacts, or an empty list if no data is found.
- Return type: list of dicts

> [!NOTE] Examples
> ```
> model = datarobot.Model(id='model-id', project_id='project-id')
> 
> # Get feature impact insights for sliced data
> data_slice = datarobot.DataSlice(id='data-slice-id')
> sliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get feature impact insights for unsliced data
> data_slice = datarobot.DataSlice()
> unsliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get all feature impact insights
> all_fi = model.get_all_feature_impacts()
> ```

#### get_all_lift_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts. Or an empty list if no data found.
- Return type: list of LiftChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get lift chart insights for sliced data
> sliced_lift_charts = model.get_all_lift_charts(data_slice_id='data-slice-id')
> 
> # Get lift chart insights for unsliced data
> unsliced_lift_charts = model.get_all_lift_charts(unsliced_only=True)
> 
> # Get all lift chart insights
> all_lift_charts = model.get_all_lift_charts()
> ```

#### get_all_multiclass_lift_charts(fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts.
- Return type: list of LiftChart

#### get_all_residuals_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all residuals charts available for the model.

- Parameters:
- Returns: Data for all available model residuals charts.
- Return type: list of ResidualsChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get residuals chart insights for sliced data
> sliced_residuals_charts = model.get_all_residuals_charts(data_slice_id='data-slice-id')
> 
> # Get residuals chart insights for unsliced data
> unsliced_residuals_charts = model.get_all_residuals_charts(unsliced_only=True)
> 
> # Get all residuals chart insights
> all_residuals_charts = model.get_all_residuals_charts()
> ```

#### get_all_roc_curves(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all ROC curves available for the model.

- Parameters:
- Returns: Data for all available model ROC curves. Or an empty list if no RocCurves are found.
- Return type: list of RocCurve

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> ds_filter=DataSlice(id='data-slice-id')
> 
> # Get roc curve insights for sliced data
> sliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get roc curve insights for unsliced data
> data_slice_filter=DataSlice(id=None)
> unsliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get all roc curve insights
> all_roc_curves = model.get_all_roc_curves()
> ```

#### get_confusion_chart(source, fallback_to_parent_insights=False)

Retrieve a multiclass model’s confusion matrix for the specified source.

- Parameters:
- Returns: Model ConfusionChart data
- Return type: ConfusionChart
- Raises: ClientError – If the insight is not available for this model

#### get_cross_class_accuracy_scores()

Retrieves a list of Cross Class Accuracy scores for the model.

- Return type: json

#### get_cross_validation_scores(partition=None, metric=None)

Return a dictionary, keyed by metric, showing cross validation
scores per partition.

Cross Validation should already have been performed using [cross_validate](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.cross_validate) or [train](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.train).

> [!NOTE] Notes
> Models that computed cross validation before this feature was added will need
> to be deleted and retrained before this method can be used.

- Parameters:
- Returns: cross_validation_scores – A dictionary keyed by metric showing cross validation scores per
  partition.
- Return type: dict

#### get_data_disparity_insights(feature, class_name1, class_name2)

Retrieve a list of Cross Class Data Disparity insights for the model.

- Parameters:
- Return type: json

#### get_fairness_insights(fairness_metrics_set=None, offset=0, limit=100)

Retrieve a list of Per Class Bias insights for the model.

- Parameters:
- Return type: json

#### get_feature_effect(source, data_slice_id=None)

Retrieve Feature Effects for the model.

Feature Effects provides partial dependence and predicted vs. actual values for the top 500
features ordered by feature impact score.

The partial dependence shows the marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the available sources.

- Parameters:
- Returns: feature_effects – The feature effects data.
- Return type: FeatureEffects
- Raises: ClientError – If the feature effects have not been computed or the source is not a valid value.

#### get_feature_effect_metadata()

Retrieve Feature Effects metadata. The response contains status and available model sources.

- Feature Effect for the training partition is always available, with the exception of older
  projects that only supported Feature Effect for validation.
- When a model is trained into validation or holdout without stacked predictions
  (i.e., no out-of-sample predictions in those partitions),
  Feature Effects is not available for validation or holdout.
- Feature Effects for holdout is not available when holdout was not unlocked for
  the project.

Use source to retrieve Feature Effects, selecting one of the provided sources.

- Returns: feature_effect_metadata
- Return type: FeatureEffectMetadata

#### get_feature_effects_multiclass(source='training', class_=None)

Retrieve Feature Effects for the multiclass model.

Feature Effects provide partial dependence and predicted vs. actual values for the top 500
features ordered by feature impact score.

The partial dependence shows the marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the available sources.

- Parameters:
- Returns: The list of multiclass feature effects.
- Return type: list
- Raises: ClientError – If Feature Effects have not been computed or the source is not a valid value.

#### get_feature_impact(with_metadata=False, data_slice_filter=)

Retrieve the computed Feature Impact results, a measure of the relevance of each
feature in the model.

Feature Impact is computed for each column by creating new data with that column randomly
permuted (but the others left unchanged) and measuring how the error metric score for the
predictions is affected. The ‘impactUnnormalized’ is how much worse the error metric score
is when making predictions on this modified data. The ‘impactNormalized’ is normalized so
that the largest value is 1. In both cases, larger values indicate more important features.

If a feature is redundant, i.e., once other features are considered it does not
contribute much in addition, the ‘redundantWith’ value is the name of the feature that has the
highest correlation with this feature. Note that redundancy detection is only available for
jobs run after the addition of this feature. When retrieving data that predates this
functionality, a NoRedundancyImpactAvailable warning will be used.

Only the top 1000 features are saved and can be returned.

Elsewhere this technique is sometimes called ‘Permutation Importance’.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Parameters:
- Returns:The feature impact data response depends on the with_metadata parameter. The response is
  either a dict with metadata and a list with the actual data or just a list with that data. Each list item is a dict with the keysfeatureName,impactNormalized,impactUnnormalized,redundantWith, andcount. For the dict response, the available keys are: featureImpacts- Feature Impact data as a dictionary. Each item is a dict with
  : the keys:featureName,impactNormalized,impactUnnormalized, andredundantWith.shapBased- A boolean that indicates whether Feature Impact was calculated using
  : Shapley values.ranRedundancyDetection- A boolean that indicates whether redundant feature
  : identification was run while calculating this Feature Impact.rowCount- An integer or None that indicates the number of rows that were used to
  : calculate Feature Impact. For Feature Impact calculated with the default
    logic without specifying the rowCount, we return None here.count- An integer with the number of features underfeatureImpacts.Return type:listordictRaises:ClientError– If the feature impacts have not been computed.ValueError– If data_slice_filter is passed as None.

#### get_features_used()

Query the server to determine which features were used.

Note that the data returned by this method may differ
from the names of the features in the featurelist used by this model.
This method returns the raw features that must be supplied for
predictions to be generated on a new set of data. The featurelist,
in contrast, also includes the names of derived features.

- Returns: features – The names of the features used in the model.
- Return type: List[str]

#### get_frozen_child_models()

Retrieve the IDs for all models that are frozen from this model.

- Return type: A list of Models

#### get_labelwise_roc_curves(source, fallback_to_parent_insights=False)

Retrieve a list of LabelwiseRocCurve instances for a multilabel model for the given source and all labels.
This method is valid only for multilabel projects. For binary projects, use Model.get_roc_curve API .

Added in version v2.24.

- Parameters:
- Returns: Labelwise ROC Curve instances for source and all labels
- Return type: list of LabelwiseRocCurve
- Raises: ClientError – If the insight is not available for this model

#### get_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve the model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data
- Return type: LiftChart
- Raises:

#### get_missing_report_info()

Retrieve a report on missing training data that can be used to understand missing
values treatment in the model. The report consists of missing values resolutions for
features numeric or categorical features that were part of building the model.

- Returns: The queried model missing report, sorted by missing count (DESCENDING order).
- Return type: An iterable of MissingReportPerFeature

#### get_model_blueprint_chart()

Retrieve a diagram that can be used to understand
data flow in the blueprint.

- Returns: The queried model blueprint chart.
- Return type: ModelBlueprintChart

#### get_model_blueprint_documents()

Get documentation for tasks used in this model.

- Returns: All documents available for the model.
- Return type: list of BlueprintTaskDocument

#### get_model_blueprint_json()

Get the blueprint json representation used by this model.

- Returns: Json representation of the blueprint stages.
- Return type: BlueprintJson

#### get_multiclass_feature_impact()

For multiclass models, feature impact can be calculated separately for each target class.
The method of calculation is the same, computed in one-vs-all style for each
target class.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Returns: feature_impacts – The feature impact data. Each item is a dict with the keys ‘featureImpacts’ (list),
  ‘class’ (str). Each item in ‘featureImpacts’ is a dict with the keys ‘featureName’,
  ‘impactNormalized’, ‘impactUnnormalized’, and ‘redundantWith’.
- Return type: list of dict
- Raises: ClientError – If the multiclass feature impacts have not been computed.

#### get_multiclass_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_multilabel_lift_charts(source, fallback_to_parent_insights=False)

Retrieve model Lift charts for the specified source.

Added in version v2.24.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_num_iterations_trained()

Retrieve the number of estimators trained by early-stopping tree-based models.

Added in version v2.22.

- Returns:

#### get_or_request_feature_effect(source, max_wait=600, row_count=None, data_slice_id=None)

Retrieve Feature Effects for the model, requesting a new job if it has not been run previously.

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the source.

- Parameters:
- Returns: feature_effects – The Feature Effects data.
- Return type: FeatureEffects

#### get_or_request_feature_effects_multiclass(source, top_n_features=None, features=None, row_count=None, class_=None, max_wait=600)

Retrieve Feature Effects for the multiclass model, requesting a job if it has not been run
previously.

- Parameters:
- Returns: feature_effects – The list of multiclass feature effects data.
- Return type: list of FeatureEffectsMulticlass

#### get_or_request_feature_impact(max_wait=600, **kwargs)

Retrieve feature impact for the model, requesting a job if it has not been run previously.

Only the top 1000 features are saved and can be returned.

- Parameters:
- Returns: feature_impacts – The feature impact data. See get_feature_impact for the exact
  schema.
- Return type: list or dict

#### get_parameters()

Retrieve the model parameters.

- Returns: The model parameters for this model.
- Return type: ModelParameters

#### get_pareto_front()

Retrieve the Pareto Front for a Eureqa model.

This method is only supported for Eureqa models.

- Returns: Model ParetoFront data
- Return type: ParetoFront

#### get_prime_eligibility()

Check whether this model can be approximated with DataRobot Prime.

- Returns: prime_eligibility – A dict indicating whether the model can be approximated with DataRobot Prime
  (key can_make_prime) and why it may be ineligible (key message).
- Return type: dict

#### get_residuals_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve model residuals chart for the specified source.

- Parameters:
- Returns: Model residuals chart data
- Return type: ResidualsChart
- Raises:

#### get_roc_curve(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve the ROC curve for a binary model for the specified source.
This method is valid only for binary projects. For multilabel projects, use
Model.get_labelwise_roc_curves.

- Parameters:
- Returns: Model ROC curve data
- Return type: RocCurve
- Raises:

#### get_rulesets()

List the rulesets that approximate this model, generated by DataRobot Prime.

If this model has not been approximated yet, returns an empty list. Note that these
are rulesets that approximate this model, not rulesets used to construct this model.

- Returns: rulesets
- Return type: list of Ruleset

#### get_supported_capabilities()

Retrieve a summary of the capabilities supported by a model.

Added in version v2.14.

- Returns:

#### get_uri()

Return the permanent static hyperlink to this model on the leaderboard.

- Returns: url – The permanent static hyperlink to this model on the leaderboard.
- Return type: str

#### get_word_cloud(exclude_stop_words=False)

Retrieve word cloud data for the model.

- Parameters: exclude_stop_words ( Optional[bool] ) – Set to True if you want stopwords filtered out of response.
- Returns: Word cloud data for the model.
- Return type: WordCloud

#### incremental_train(data_stage_id, training_data_name=None)

Submit a job to the queue to perform incremental training on an existing model.
See the train_incremental documentation.

- Return type: ModelJob

#### classmethod list(project_id, sort_by_partition='validation', sort_by_metric=None, with_metric=None, search_term=None, featurelists=None, families=None, blueprints=None, labels=None, characteristics=None, training_filters=None, number_of_clusters=None, limit=100, offset=0)

Retrieve paginated model records, sorted by scores, with optional filtering.

- Parameters:
- Returns: generic_models
- Return type: list of GenericModel

#### open_in_browser()

Opens class’ relevant web browser location.
If default browser is not available the URL is logged.

Note:
If text-mode browsers are used, the calling process will block
until the user exits the browser.

- Return type: None

#### request_approximation()

Request an approximation of this model using DataRobot Prime.

This creates several rulesets that can be used to approximate this model. After
comparing their scores and rule counts, the code used in the approximation can be downloaded
and run locally.

- Returns: job – The job that generates the rulesets.
- Return type: Job

#### request_cross_class_accuracy_scores()

Request data disparity insights to be computed for the model.

- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_data_disparity_insights(feature, compared_class_names)

Request data disparity insights to be computed for the model.

- Parameters:
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_external_test(dataset_id, actual_value_column=None)

Request an external test to compute scores and insights on an external test dataset.

- Parameters:
- Returns: job – A job representing external dataset insights computation.
- Return type: Job

#### request_fairness_insights(fairness_metrics_set=None)

Request fairness insights to be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – Can be one of .
  The fairness metric used to calculate the fairness scores.
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_feature_effect(row_count=None, data_slice_id=None)

Submit a request to compute Feature Effects for the model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect) for more
information on the result of the job.

- Parameters:
- Returns: job – A job representing the feature effect computation. To get the completed feature effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job
- Raises: JobAlreadyRequested – If the feature effects have already been requested.

#### request_feature_effects_multiclass(row_count=None, top_n_features=None, features=None)

Request Feature Effects computation for the multiclass model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effects_multiclass) for
more information on the result of the job.

- Parameters:
- Returns: job – A job representing Feature Effect computation. To get the completed Feature Effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job

#### request_feature_impact(row_count=None, with_metadata=False, data_slice_id=None)

Request that feature impacts be computed for the model.

See [get_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_impact) for more
information on the result of the job.

- Parameters:
- Returns: job – A job representing the Feature Impact computation. To retrieve the completed Feature Impact
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job or status_id
- Raises: JobAlreadyRequested – If the feature impacts have already been requested.

#### request_frozen_datetime_model(training_row_count=None, training_duration=None, training_start_date=None, training_end_date=None, time_window_sample_pct=None, sampling_method=None)

Train a new frozen model with parameters from this model.

Requires that this model belongs to a datetime partitioned project. If it does not, an
error will occur when submitting the job.

Frozen models use the same tuning parameters as their parent model instead of independently
optimizing them to allow efficiently retraining models on larger amounts of the training
data.

In addition to training_row_count and training_duration, frozen datetime models may be
trained on an exact date range. Only one of training_row_count, training_duration, or
training_start_date and training_end_date should be specified.

Models specified using training_start_date and training_end_date are the only ones that can
be trained into the holdout data (once the holdout is unlocked).

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: model_job – The modeling job that trains a frozen model.
- Return type: ModelJob

#### request_frozen_model(sample_pct=None, training_row_count=None)

Train a new frozen model with parameters from this model.

> [!NOTE] Notes
> This method only works if the project the model belongs to is not datetime
> partitioned. If it is, use `request_frozen_datetime_model` instead.
> 
> Frozen models use the same tuning parameters as their parent model instead of independently
> optimizing them to allow efficiently retraining models on larger amounts of the training
> data.

- Parameters:
- Returns: model_job – The modeling job that trains a frozen model.
- Return type: ModelJob

#### request_lift_chart(source, data_slice_id=None)

Request the model Lift Chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_per_class_fairness_insights(fairness_metrics_set=None)

Request per-class fairness insights be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – The fairness metric used to calculate the fairness scores.
  Value can be any one of .
- Returns: status_check_job – The returned object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_predictions(dataset_id=None, dataset=None, dataframe=None, file_path=None, file=None, include_prediction_intervals=None, prediction_intervals_size=None, forecast_point=None, predictions_start_date=None, predictions_end_date=None, actual_value_column=None, explanation_algorithm=None, max_explanations=None, max_ngram_explanations=None)

Request predictions against a previously uploaded dataset.

- Parameters:
- Returns: job – The job computing the predictions.
- Return type: PredictJob

#### request_residuals_chart(source, data_slice_id=None)

Request the model residuals chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_roc_curve(source, data_slice_id=None)

Request the model Roc Curve for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_training_predictions(data_subset, explanation_algorithm=None, max_explanations=None)

Start a job to build training predictions

- Parameters:

#### retrain(sample_pct=None, featurelist_id=None, training_row_count=None, n_clusters=None)

Submit a job to the queue to train a blender model.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### set_prediction_threshold(threshold)

Set a custom prediction threshold for the model.

May not be used once `prediction_threshold_read_only` is True for this model.

- Parameters: threshold ( float ) – only used for binary classification projects. The threshold to when deciding between
  the positive and negative classes when making predictions.  Should be between 0.0 and
  1.0 (inclusive).

#### star_model()

Mark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

#### start_advanced_tuning_session(grid_search_arguments=None)

Start an Advanced Tuning session.  Returns an object that helps
set up arguments for an Advanced Tuning model execution.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters: grid_search_arguments ( GridSearchArguments ) – Grid search arguments
- Returns: Session for setting up and running Advanced Tuning on a model
- Return type: AdvancedTuningSession

#### start_incremental_learning_from_sample(early_stopping_rounds=None, first_iteration_only=False, chunk_definition_id=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### train(sample_pct=None, featurelist_id=None, scoring_type=None, training_row_count=None, monotonic_increasing_featurelist_id=, monotonic_decreasing_featurelist_id=)

Train the blueprint used in the model on a particular featurelist or amount of data.

This method creates a new training job for the worker and appends it to
the end of the queue for this project.
After the job has finished, you can get the newly trained model by retrieving
it from the project leaderboard or by retrieving the result of the job.

Either sample_pct or training_row_count can be used to specify the amount of data to
use, but not both. If neither is specified, a default of the maximum amount of data that
can safely be used to train any blueprint without using the validation data will be
selected.

In smart-sampled projects, sample_pct and training_row_count are assumed to be in terms
of rows of the minority class.

> [!NOTE] Notes
> For datetime partitioned projects, see [train_datetime](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.DatetimeModel.train_datetime) instead.

- Parameters:
- Returns: model_job_id – The ID of the created job; can be used as a parameter to ModelJob.get or the wait_for_async_model_creation function.
- Return type: str

> [!NOTE] Examples
> ```
> project = Project.get('project-id')
> model = Model.get('project-id', 'model-id')
> model_job_id = model.train(training_row_count=project.max_train_rows)
> ```

#### train_datetime(featurelist_id=None, training_row_count=None, training_duration=None, time_window_sample_pct=None, monotonic_increasing_featurelist_id=, monotonic_decreasing_featurelist_id=, use_project_settings=False, sampling_method=None, n_clusters=None)

Train this model on a different featurelist or sample size.

Requires that this model is part of a datetime partitioned project; otherwise, an error will
occur.

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: job – The created job to build the model.
- Return type: ModelJob

#### train_incremental(data_stage_id, training_data_name=None, data_stage_encoding=None, data_stage_delimiter=None, data_stage_compression=None)

Submit a job to the queue to perform incremental training on an existing model using
additional data. The ID of the additional data to use for training is specified with `data_stage_id`.
Optionally, a name for the iteration can be supplied by the user to help identify the contents of the data in
the iteration.

This functionality requires the INCREMENTAL_LEARNING feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### unstar_model()

Unmark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

### class datarobot.models.model.AdvancedTuningParamsType

### class datarobot.models.model.BiasMitigationFeatureInfo

## Prime models

### class datarobot.models.PrimeModel

Represents a DataRobot Prime model approximating a parent model with downloadable code.

All durations are specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Variables:

#### classmethod get(project_id, model_id)

Retrieve a specific prime model.

- Parameters:
- Returns: model – The queried instance.
- Return type: PrimeModel

#### request_download_validation(language)

Prep and validate the downloadable code for the ruleset associated with this model.

- Parameters: language ( str ) – the language the code should be downloaded in - see datarobot.enums.PRIME_LANGUAGE for available languages
- Returns: job – A job tracking the code preparation and validation
- Return type: Job

#### advanced_tune(params, description=None, grid_search_arguments=None)

Generate a new model with the specified advanced-tuning parameters

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters:
- Returns: The created job to build the model
- Return type: ModelJob

#### continue_incremental_learning_from_incremental_model(chunk_definition_id, early_stopping_rounds=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The model retraining job that is created.
- Return type: ModelJob

#### cross_validate()

Run cross validation on the model.

> [!NOTE] Notes
> To perform Cross Validation on a new model with new parameters, use `train` instead.

- Returns: The created job to build the model
- Return type: ModelJob

#### delete()

Delete the model from the project leaderboard.

- Return type: None

#### download_scoring_code(file_name, source_code=False)

Download the Scoring Code JAR.

- Parameters:
- Return type: None

#### download_training_artifact(file_name)

Retrieve trained artifact(s) from a model containing one or more custom tasks.

Artifact(s) will be downloaded to the specified local filepath.

- Parameters: file_name ( str ) – File path where trained model artifact(s) will be saved.

#### classmethod from_data(data)

Instantiate an object of this class using a dict.

- Parameters: data ( dict ) – Correctly snake_cased keys and their values.
- Return type: TypeVar ( T , bound= APIObject)

#### get_advanced_tuning_parameters()

Get the advanced-tuning parameters available for this model.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Returns:A dictionary describing the advanced-tuning parameters for the current model.
  There are two top-level keys, tuning_description and tuning_parameters. tuning_description an optional value. If not None, then it indicates the
user-specified description of this set of tuning parameter. tuning_parameters is a list of a dicts, each has the following keys
* parameter_name :(str)name of the parameter (unique per task, see below)
* parameter_id :(str)opaque ID string uniquely identifying parameter
* default_value :(*)the actual value used to train the model; either
  the single value of the parameter specified before training, or the best
  value from the list of grid-searched values (based on current_value)
* current_value :(*)the single value or list of values of the
  parameter that were grid searched. Depending on the grid search
  specification, could be a single fixed value (no grid search),
  a list of discrete values, or a range.
* task_name :(str)name of the task that this parameter belongs to
* constraints:(dict)see the notes below
* vertex_id:(str)ID of vertex that this parameter belongs to
*Return type:dict

> [!NOTE] Notes
> The type of default_value and current_value is defined by the constraints structure.
> It will be a string or numeric Python type.
> 
> constraints is a dict with at least one, possibly more, of the following keys.
> The presence of a key indicates that the parameter may take on the specified type.
> (If a key is absent, this means that the parameter may not take on the specified type.)
> If a key on constraints is present, its value will be a dict containing
> all of the fields described below for that key.
> 
> ```
> "constraints": {
>     "select": {
>         "values": [<list(basestring or number) : possible values>]
>     },
>     "ascii": {},
>     "unicode": {},
>     "int": {
>         "min": <int : minimum valid value>,
>         "max": <int : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "float": {
>         "min": <float : minimum valid value>,
>         "max": <float : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "intList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <int : minimum valid value>,
>         "max_val": <int : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "floatList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <float : minimum valid value>,
>         "max_val": <float : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     }
> }
> ```
> 
> The keys have meaning as follows:
> 
> select:
>   Rather than specifying a specific data type, if present, it indicates that the parameter
>   is permitted to take on any of the specified values.  Listed values may be of any string
>   or real (non-complex) numeric type.
> ascii:
>   The parameter may be a unicode object that encodes simple ASCII characters.
>   (A-Z, a-z, 0-9, whitespace, and certain common symbols.)  In addition to listed
>   constraints, ASCII keys currently may not contain either newlines or semicolons.
> unicode:
>   The parameter may be any Python unicode object.
> int:
>   The value may be an object of type int within the specified range (inclusive).
>   Please note that the value will be passed around using the JSON format, and
>   some JSON parsers have undefined behavior with integers outside of the range
>   [-(2**53)+1, (2**53)-1].
> float:
>   The value may be an object of type float within the specified range (inclusive).
> intList, floatList:
>   The value may be a list of int or float objects, respectively, following constraints
>   as specified respectively by the int and float types (above).
> 
> Many parameters only specify one key under constraints.  If a parameter specifies multiple
> keys, the parameter may take on any value permitted by any key.

#### get_all_confusion_charts(fallback_to_parent_insights=False)

Retrieve a list of all confusion matrices available for the model.

- Parameters: fallback_to_parent_insights ( bool ) – (New in version v2.14) Optional, if True, this will return confusion chart data for
  this model’s parent for any source that is not available for this model and if this
  has a defined parent model. If omitted or False, or this model has no parent,
  this will not attempt to retrieve any data from this model’s parent.
- Returns: Data for all available confusion charts for model.
- Return type: list of ConfusionChart

#### get_all_feature_impacts(data_slice_filter=None)

Retrieve a list of all feature impact results available for the model.

- Parameters: data_slice_filter ( DataSlice , optional ) – A DataSlice used to filter the return values based on the DataSlice ID. By default, this function
  uses data_slice_filter.id == None, which returns an unsliced insight. If data_slice_filter is None,
  no data_slice filtering will be applied when requesting the ROC curve.
- Returns: Data for all available model feature impacts, or an empty list if no data is found.
- Return type: list of dicts

> [!NOTE] Examples
> ```
> model = datarobot.Model(id='model-id', project_id='project-id')
> 
> # Get feature impact insights for sliced data
> data_slice = datarobot.DataSlice(id='data-slice-id')
> sliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get feature impact insights for unsliced data
> data_slice = datarobot.DataSlice()
> unsliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get all feature impact insights
> all_fi = model.get_all_feature_impacts()
> ```

#### get_all_lift_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts. Or an empty list if no data found.
- Return type: list of LiftChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get lift chart insights for sliced data
> sliced_lift_charts = model.get_all_lift_charts(data_slice_id='data-slice-id')
> 
> # Get lift chart insights for unsliced data
> unsliced_lift_charts = model.get_all_lift_charts(unsliced_only=True)
> 
> # Get all lift chart insights
> all_lift_charts = model.get_all_lift_charts()
> ```

#### get_all_multiclass_lift_charts(fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts.
- Return type: list of LiftChart

#### get_all_residuals_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all residuals charts available for the model.

- Parameters:
- Returns: Data for all available model residuals charts.
- Return type: list of ResidualsChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get residuals chart insights for sliced data
> sliced_residuals_charts = model.get_all_residuals_charts(data_slice_id='data-slice-id')
> 
> # Get residuals chart insights for unsliced data
> unsliced_residuals_charts = model.get_all_residuals_charts(unsliced_only=True)
> 
> # Get all residuals chart insights
> all_residuals_charts = model.get_all_residuals_charts()
> ```

#### get_all_roc_curves(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all ROC curves available for the model.

- Parameters:
- Returns: Data for all available model ROC curves. Or an empty list if no RocCurves are found.
- Return type: list of RocCurve

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> ds_filter=DataSlice(id='data-slice-id')
> 
> # Get roc curve insights for sliced data
> sliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get roc curve insights for unsliced data
> data_slice_filter=DataSlice(id=None)
> unsliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get all roc curve insights
> all_roc_curves = model.get_all_roc_curves()
> ```

#### get_confusion_chart(source, fallback_to_parent_insights=False)

Retrieve a multiclass model’s confusion matrix for the specified source.

- Parameters:
- Returns: Model ConfusionChart data
- Return type: ConfusionChart
- Raises: ClientError – If the insight is not available for this model

#### get_cross_class_accuracy_scores()

Retrieves a list of Cross Class Accuracy scores for the model.

- Return type: json

#### get_cross_validation_scores(partition=None, metric=None)

Return a dictionary, keyed by metric, showing cross validation
scores per partition.

Cross Validation should already have been performed using [cross_validate](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.cross_validate) or [train](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.train).

> [!NOTE] Notes
> Models that computed cross validation before this feature was added will need
> to be deleted and retrained before this method can be used.

- Parameters:
- Returns: cross_validation_scores – A dictionary keyed by metric showing cross validation scores per
  partition.
- Return type: dict

#### get_data_disparity_insights(feature, class_name1, class_name2)

Retrieve a list of Cross Class Data Disparity insights for the model.

- Parameters:
- Return type: json

#### get_fairness_insights(fairness_metrics_set=None, offset=0, limit=100)

Retrieve a list of Per Class Bias insights for the model.

- Parameters:
- Return type: json

#### get_feature_effect(source, data_slice_id=None)

Retrieve Feature Effects for the model.

Feature Effects provides partial dependence and predicted vs. actual values for the top 500
features ordered by feature impact score.

The partial dependence shows the marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the available sources.

- Parameters:
- Returns: feature_effects – The feature effects data.
- Return type: FeatureEffects
- Raises: ClientError – If the feature effects have not been computed or the source is not a valid value.

#### get_feature_effect_metadata()

Retrieve Feature Effects metadata. The response contains status and available model sources.

- Feature Effect for the training partition is always available, with the exception of older
  projects that only supported Feature Effect for validation.
- When a model is trained into validation or holdout without stacked predictions
  (i.e., no out-of-sample predictions in those partitions),
  Feature Effects is not available for validation or holdout.
- Feature Effects for holdout is not available when holdout was not unlocked for
  the project.

Use source to retrieve Feature Effects, selecting one of the provided sources.

- Returns: feature_effect_metadata
- Return type: FeatureEffectMetadata

#### get_feature_effects_multiclass(source='training', class_=None)

Retrieve Feature Effects for the multiclass model.

Feature Effects provide partial dependence and predicted vs. actual values for the top 500
features ordered by feature impact score.

The partial dependence shows the marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the available sources.

- Parameters:
- Returns: The list of multiclass feature effects.
- Return type: list
- Raises: ClientError – If Feature Effects have not been computed or the source is not a valid value.

#### get_feature_impact(with_metadata=False, data_slice_filter=)

Retrieve the computed Feature Impact results, a measure of the relevance of each
feature in the model.

Feature Impact is computed for each column by creating new data with that column randomly
permuted (but the others left unchanged) and measuring how the error metric score for the
predictions is affected. The ‘impactUnnormalized’ is how much worse the error metric score
is when making predictions on this modified data. The ‘impactNormalized’ is normalized so
that the largest value is 1. In both cases, larger values indicate more important features.

If a feature is redundant, i.e., once other features are considered it does not
contribute much in addition, the ‘redundantWith’ value is the name of the feature that has the
highest correlation with this feature. Note that redundancy detection is only available for
jobs run after the addition of this feature. When retrieving data that predates this
functionality, a NoRedundancyImpactAvailable warning will be used.

Only the top 1000 features are saved and can be returned.

Elsewhere this technique is sometimes called ‘Permutation Importance’.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Parameters:
- Returns:The feature impact data response depends on the with_metadata parameter. The response is
  either a dict with metadata and a list with the actual data or just a list with that data. Each list item is a dict with the keysfeatureName,impactNormalized,impactUnnormalized,redundantWith, andcount. For the dict response, the available keys are: featureImpacts- Feature Impact data as a dictionary. Each item is a dict with
  : the keys:featureName,impactNormalized,impactUnnormalized, andredundantWith.shapBased- A boolean that indicates whether Feature Impact was calculated using
  : Shapley values.ranRedundancyDetection- A boolean that indicates whether redundant feature
  : identification was run while calculating this Feature Impact.rowCount- An integer or None that indicates the number of rows that were used to
  : calculate Feature Impact. For Feature Impact calculated with the default
    logic without specifying the rowCount, we return None here.count- An integer with the number of features underfeatureImpacts.Return type:listordictRaises:ClientError– If the feature impacts have not been computed.ValueError– If data_slice_filter is passed as None.

#### get_features_used()

Query the server to determine which features were used.

Note that the data returned by this method may differ
from the names of the features in the featurelist used by this model.
This method returns the raw features that must be supplied for
predictions to be generated on a new set of data. The featurelist,
in contrast, also includes the names of derived features.

- Returns: features – The names of the features used in the model.
- Return type: List[str]

#### get_frozen_child_models()

Retrieve the IDs for all models that are frozen from this model.

- Return type: A list of Models

#### get_labelwise_roc_curves(source, fallback_to_parent_insights=False)

Retrieve a list of LabelwiseRocCurve instances for a multilabel model for the given source and all labels.
This method is valid only for multilabel projects. For binary projects, use Model.get_roc_curve API .

Added in version v2.24.

- Parameters:
- Returns: Labelwise ROC Curve instances for source and all labels
- Return type: list of LabelwiseRocCurve
- Raises: ClientError – If the insight is not available for this model

#### get_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve the model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data
- Return type: LiftChart
- Raises:

#### get_missing_report_info()

Retrieve a report on missing training data that can be used to understand missing
values treatment in the model. The report consists of missing values resolutions for
features numeric or categorical features that were part of building the model.

- Returns: The queried model missing report, sorted by missing count (DESCENDING order).
- Return type: An iterable of MissingReportPerFeature

#### get_model_blueprint_chart()

Retrieve a diagram that can be used to understand
data flow in the blueprint.

- Returns: The queried model blueprint chart.
- Return type: ModelBlueprintChart

#### get_model_blueprint_documents()

Get documentation for tasks used in this model.

- Returns: All documents available for the model.
- Return type: list of BlueprintTaskDocument

#### get_model_blueprint_json()

Get the blueprint json representation used by this model.

- Returns: Json representation of the blueprint stages.
- Return type: BlueprintJson

#### get_multiclass_feature_impact()

For multiclass models, feature impact can be calculated separately for each target class.
The method of calculation is the same, computed in one-vs-all style for each
target class.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Returns: feature_impacts – The feature impact data. Each item is a dict with the keys ‘featureImpacts’ (list),
  ‘class’ (str). Each item in ‘featureImpacts’ is a dict with the keys ‘featureName’,
  ‘impactNormalized’, ‘impactUnnormalized’, and ‘redundantWith’.
- Return type: list of dict
- Raises: ClientError – If the multiclass feature impacts have not been computed.

#### get_multiclass_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_multilabel_lift_charts(source, fallback_to_parent_insights=False)

Retrieve model Lift charts for the specified source.

Added in version v2.24.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_num_iterations_trained()

Retrieve the number of estimators trained by early-stopping tree-based models.

Added in version v2.22.

- Returns:

#### get_or_request_feature_effect(source, max_wait=600, row_count=None, data_slice_id=None)

Retrieve Feature Effects for the model, requesting a new job if it has not been run previously.

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the source.

- Parameters:
- Returns: feature_effects – The Feature Effects data.
- Return type: FeatureEffects

#### get_or_request_feature_effects_multiclass(source, top_n_features=None, features=None, row_count=None, class_=None, max_wait=600)

Retrieve Feature Effects for the multiclass model, requesting a job if it has not been run
previously.

- Parameters:
- Returns: feature_effects – The list of multiclass feature effects data.
- Return type: list of FeatureEffectsMulticlass

#### get_or_request_feature_impact(max_wait=600, **kwargs)

Retrieve feature impact for the model, requesting a job if it has not been run previously.

Only the top 1000 features are saved and can be returned.

- Parameters:
- Returns: feature_impacts – The feature impact data. See get_feature_impact for the exact
  schema.
- Return type: list or dict

#### get_parameters()

Retrieve the model parameters.

- Returns: The model parameters for this model.
- Return type: ModelParameters

#### get_pareto_front()

Retrieve the Pareto Front for a Eureqa model.

This method is only supported for Eureqa models.

- Returns: Model ParetoFront data
- Return type: ParetoFront

#### get_prime_eligibility()

Check whether this model can be approximated with DataRobot Prime.

- Returns: prime_eligibility – A dict indicating whether the model can be approximated with DataRobot Prime
  (key can_make_prime) and why it may be ineligible (key message).
- Return type: dict

#### get_residuals_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve model residuals chart for the specified source.

- Parameters:
- Returns: Model residuals chart data
- Return type: ResidualsChart
- Raises:

#### get_roc_curve(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve the ROC curve for a binary model for the specified source.
This method is valid only for binary projects. For multilabel projects, use
Model.get_labelwise_roc_curves.

- Parameters:
- Returns: Model ROC curve data
- Return type: RocCurve
- Raises:

#### get_rulesets()

List the rulesets that approximate this model, generated by DataRobot Prime.

If this model has not been approximated yet, returns an empty list. Note that these
are rulesets that approximate this model, not rulesets used to construct this model.

- Returns: rulesets
- Return type: list of Ruleset

#### get_supported_capabilities()

Retrieve a summary of the capabilities supported by a model.

Added in version v2.14.

- Returns:

#### get_uri()

Return the permanent static hyperlink to this model on the leaderboard.

- Returns: url – The permanent static hyperlink to this model on the leaderboard.
- Return type: str

#### get_word_cloud(exclude_stop_words=False)

Retrieve word cloud data for the model.

- Parameters: exclude_stop_words ( Optional[bool] ) – Set to True if you want stopwords filtered out of response.
- Returns: Word cloud data for the model.
- Return type: WordCloud

#### incremental_train(data_stage_id, training_data_name=None)

Submit a job to the queue to perform incremental training on an existing model.
See the train_incremental documentation.

- Return type: ModelJob

#### classmethod list(project_id, sort_by_partition='validation', sort_by_metric=None, with_metric=None, search_term=None, featurelists=None, families=None, blueprints=None, labels=None, characteristics=None, training_filters=None, number_of_clusters=None, limit=100, offset=0)

Retrieve paginated model records, sorted by scores, with optional filtering.

- Parameters:
- Returns: generic_models
- Return type: list of GenericModel

#### open_in_browser()

Opens class’ relevant web browser location.
If default browser is not available the URL is logged.

Note:
If text-mode browsers are used, the calling process will block
until the user exits the browser.

- Return type: None

#### request_cross_class_accuracy_scores()

Request data disparity insights to be computed for the model.

- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_data_disparity_insights(feature, compared_class_names)

Request data disparity insights to be computed for the model.

- Parameters:
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_external_test(dataset_id, actual_value_column=None)

Request an external test to compute scores and insights on an external test dataset.

- Parameters:
- Returns: job – A job representing external dataset insights computation.
- Return type: Job

#### request_fairness_insights(fairness_metrics_set=None)

Request fairness insights to be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – Can be one of .
  The fairness metric used to calculate the fairness scores.
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_feature_effect(row_count=None, data_slice_id=None)

Submit a request to compute Feature Effects for the model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect) for more
information on the result of the job.

- Parameters:
- Returns: job – A job representing the feature effect computation. To get the completed feature effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job
- Raises: JobAlreadyRequested – If the feature effects have already been requested.

#### request_feature_effects_multiclass(row_count=None, top_n_features=None, features=None)

Request Feature Effects computation for the multiclass model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effects_multiclass) for
more information on the result of the job.

- Parameters:
- Returns: job – A job representing Feature Effect computation. To get the completed Feature Effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job

#### request_feature_impact(row_count=None, with_metadata=False, data_slice_id=None)

Request that feature impacts be computed for the model.

See [get_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_impact) for more
information on the result of the job.

- Parameters:
- Returns: job – A job representing the Feature Impact computation. To retrieve the completed Feature Impact
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job or status_id
- Raises: JobAlreadyRequested – If the feature impacts have already been requested.

#### request_lift_chart(source, data_slice_id=None)

Request the model Lift Chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_per_class_fairness_insights(fairness_metrics_set=None)

Request per-class fairness insights be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – The fairness metric used to calculate the fairness scores.
  Value can be any one of .
- Returns: status_check_job – The returned object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_predictions(dataset_id=None, dataset=None, dataframe=None, file_path=None, file=None, include_prediction_intervals=None, prediction_intervals_size=None, forecast_point=None, predictions_start_date=None, predictions_end_date=None, actual_value_column=None, explanation_algorithm=None, max_explanations=None, max_ngram_explanations=None)

Request predictions against a previously uploaded dataset.

- Parameters:
- Returns: job – The job computing the predictions.
- Return type: PredictJob

#### request_residuals_chart(source, data_slice_id=None)

Request the model residuals chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_roc_curve(source, data_slice_id=None)

Request the model Roc Curve for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_training_predictions(data_subset, explanation_algorithm=None, max_explanations=None)

Start a job to build training predictions

- Parameters:

#### retrain(sample_pct=None, featurelist_id=None, training_row_count=None, n_clusters=None)

Submit a job to the queue to train a blender model.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### set_prediction_threshold(threshold)

Set a custom prediction threshold for the model.

May not be used once `prediction_threshold_read_only` is True for this model.

- Parameters: threshold ( float ) – only used for binary classification projects. The threshold to when deciding between
  the positive and negative classes when making predictions.  Should be between 0.0 and
  1.0 (inclusive).

#### star_model()

Mark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

#### start_advanced_tuning_session(grid_search_arguments=None)

Start an Advanced Tuning session.  Returns an object that helps
set up arguments for an Advanced Tuning model execution.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters: grid_search_arguments ( GridSearchArguments ) – Grid search arguments
- Returns: Session for setting up and running Advanced Tuning on a model
- Return type: AdvancedTuningSession

#### start_incremental_learning_from_sample(early_stopping_rounds=None, first_iteration_only=False, chunk_definition_id=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### train_incremental(data_stage_id, training_data_name=None, data_stage_encoding=None, data_stage_delimiter=None, data_stage_compression=None)

Submit a job to the queue to perform incremental training on an existing model using
additional data. The ID of the additional data to use for training is specified with `data_stage_id`.
Optionally, a name for the iteration can be supplied by the user to help identify the contents of the data in
the iteration.

This functionality requires the INCREMENTAL_LEARNING feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### unstar_model()

Unmark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

### Prime files

### class datarobot.models.PrimeFile

Represents an executable file available for download of the code for a DataRobot Prime model

- Variables:

#### download(filepath)

Download the code and save it to a file

- Parameters: filepath ( string ) – the location to save the file to
- Return type: None

## Blender models

### class datarobot.models.BlenderModel

Represents blender model that combines prediction results from other models.

All durations are specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Variables:

#### classmethod get(project_id, model_id)

Retrieve a specific blender.

- Parameters:
- Returns: model – The queried instance.
- Return type: BlenderModel

#### advanced_tune(params, description=None, grid_search_arguments=None)

Generate a new model with the specified advanced-tuning parameters

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters:
- Returns: The created job to build the model
- Return type: ModelJob

#### continue_incremental_learning_from_incremental_model(chunk_definition_id, early_stopping_rounds=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The model retraining job that is created.
- Return type: ModelJob

#### cross_validate()

Run cross validation on the model.

> [!NOTE] Notes
> To perform Cross Validation on a new model with new parameters, use `train` instead.

- Returns: The created job to build the model
- Return type: ModelJob

#### delete()

Delete the model from the project leaderboard.

- Return type: None

#### download_scoring_code(file_name, source_code=False)

Download the Scoring Code JAR.

- Parameters:
- Return type: None

#### download_training_artifact(file_name)

Retrieve trained artifact(s) from a model containing one or more custom tasks.

Artifact(s) will be downloaded to the specified local filepath.

- Parameters: file_name ( str ) – File path where trained model artifact(s) will be saved.

#### classmethod from_data(data)

Instantiate an object of this class using a dict.

- Parameters: data ( dict ) – Correctly snake_cased keys and their values.
- Return type: TypeVar ( T , bound= APIObject)

#### classmethod from_server_data(data, keep_attrs=None)

Override the inherited method because the model must _not_ recursively change casing.

- Parameters:

#### get_advanced_tuning_parameters()

Get the advanced-tuning parameters available for this model.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Returns:A dictionary describing the advanced-tuning parameters for the current model.
  There are two top-level keys, tuning_description and tuning_parameters. tuning_description an optional value. If not None, then it indicates the
user-specified description of this set of tuning parameter. tuning_parameters is a list of a dicts, each has the following keys
* parameter_name :(str)name of the parameter (unique per task, see below)
* parameter_id :(str)opaque ID string uniquely identifying parameter
* default_value :(*)the actual value used to train the model; either
  the single value of the parameter specified before training, or the best
  value from the list of grid-searched values (based on current_value)
* current_value :(*)the single value or list of values of the
  parameter that were grid searched. Depending on the grid search
  specification, could be a single fixed value (no grid search),
  a list of discrete values, or a range.
* task_name :(str)name of the task that this parameter belongs to
* constraints:(dict)see the notes below
* vertex_id:(str)ID of vertex that this parameter belongs to
*Return type:dict

> [!NOTE] Notes
> The type of default_value and current_value is defined by the constraints structure.
> It will be a string or numeric Python type.
> 
> constraints is a dict with at least one, possibly more, of the following keys.
> The presence of a key indicates that the parameter may take on the specified type.
> (If a key is absent, this means that the parameter may not take on the specified type.)
> If a key on constraints is present, its value will be a dict containing
> all of the fields described below for that key.
> 
> ```
> "constraints": {
>     "select": {
>         "values": [<list(basestring or number) : possible values>]
>     },
>     "ascii": {},
>     "unicode": {},
>     "int": {
>         "min": <int : minimum valid value>,
>         "max": <int : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "float": {
>         "min": <float : minimum valid value>,
>         "max": <float : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "intList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <int : minimum valid value>,
>         "max_val": <int : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "floatList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <float : minimum valid value>,
>         "max_val": <float : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     }
> }
> ```
> 
> The keys have meaning as follows:
> 
> select:
>   Rather than specifying a specific data type, if present, it indicates that the parameter
>   is permitted to take on any of the specified values.  Listed values may be of any string
>   or real (non-complex) numeric type.
> ascii:
>   The parameter may be a unicode object that encodes simple ASCII characters.
>   (A-Z, a-z, 0-9, whitespace, and certain common symbols.)  In addition to listed
>   constraints, ASCII keys currently may not contain either newlines or semicolons.
> unicode:
>   The parameter may be any Python unicode object.
> int:
>   The value may be an object of type int within the specified range (inclusive).
>   Please note that the value will be passed around using the JSON format, and
>   some JSON parsers have undefined behavior with integers outside of the range
>   [-(2**53)+1, (2**53)-1].
> float:
>   The value may be an object of type float within the specified range (inclusive).
> intList, floatList:
>   The value may be a list of int or float objects, respectively, following constraints
>   as specified respectively by the int and float types (above).
> 
> Many parameters only specify one key under constraints.  If a parameter specifies multiple
> keys, the parameter may take on any value permitted by any key.

#### get_all_confusion_charts(fallback_to_parent_insights=False)

Retrieve a list of all confusion matrices available for the model.

- Parameters: fallback_to_parent_insights ( bool ) – (New in version v2.14) Optional, if True, this will return confusion chart data for
  this model’s parent for any source that is not available for this model and if this
  has a defined parent model. If omitted or False, or this model has no parent,
  this will not attempt to retrieve any data from this model’s parent.
- Returns: Data for all available confusion charts for model.
- Return type: list of ConfusionChart

#### get_all_feature_impacts(data_slice_filter=None)

Retrieve a list of all feature impact results available for the model.

- Parameters: data_slice_filter ( DataSlice , optional ) – A DataSlice used to filter the return values based on the DataSlice ID. By default, this function
  uses data_slice_filter.id == None, which returns an unsliced insight. If data_slice_filter is None,
  no data_slice filtering will be applied when requesting the ROC curve.
- Returns: Data for all available model feature impacts, or an empty list if no data is found.
- Return type: list of dicts

> [!NOTE] Examples
> ```
> model = datarobot.Model(id='model-id', project_id='project-id')
> 
> # Get feature impact insights for sliced data
> data_slice = datarobot.DataSlice(id='data-slice-id')
> sliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get feature impact insights for unsliced data
> data_slice = datarobot.DataSlice()
> unsliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get all feature impact insights
> all_fi = model.get_all_feature_impacts()
> ```

#### get_all_lift_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts. Or an empty list if no data found.
- Return type: list of LiftChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get lift chart insights for sliced data
> sliced_lift_charts = model.get_all_lift_charts(data_slice_id='data-slice-id')
> 
> # Get lift chart insights for unsliced data
> unsliced_lift_charts = model.get_all_lift_charts(unsliced_only=True)
> 
> # Get all lift chart insights
> all_lift_charts = model.get_all_lift_charts()
> ```

#### get_all_multiclass_lift_charts(fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts.
- Return type: list of LiftChart

#### get_all_residuals_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all residuals charts available for the model.

- Parameters:
- Returns: Data for all available model residuals charts.
- Return type: list of ResidualsChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get residuals chart insights for sliced data
> sliced_residuals_charts = model.get_all_residuals_charts(data_slice_id='data-slice-id')
> 
> # Get residuals chart insights for unsliced data
> unsliced_residuals_charts = model.get_all_residuals_charts(unsliced_only=True)
> 
> # Get all residuals chart insights
> all_residuals_charts = model.get_all_residuals_charts()
> ```

#### get_all_roc_curves(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all ROC curves available for the model.

- Parameters:
- Returns: Data for all available model ROC curves. Or an empty list if no RocCurves are found.
- Return type: list of RocCurve

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> ds_filter=DataSlice(id='data-slice-id')
> 
> # Get roc curve insights for sliced data
> sliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get roc curve insights for unsliced data
> data_slice_filter=DataSlice(id=None)
> unsliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get all roc curve insights
> all_roc_curves = model.get_all_roc_curves()
> ```

#### get_confusion_chart(source, fallback_to_parent_insights=False)

Retrieve a multiclass model’s confusion matrix for the specified source.

- Parameters:
- Returns: Model ConfusionChart data
- Return type: ConfusionChart
- Raises: ClientError – If the insight is not available for this model

#### get_cross_class_accuracy_scores()

Retrieves a list of Cross Class Accuracy scores for the model.

- Return type: json

#### get_cross_validation_scores(partition=None, metric=None)

Return a dictionary, keyed by metric, showing cross validation
scores per partition.

Cross Validation should already have been performed using [cross_validate](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.cross_validate) or [train](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.train).

> [!NOTE] Notes
> Models that computed cross validation before this feature was added will need
> to be deleted and retrained before this method can be used.

- Parameters:
- Returns: cross_validation_scores – A dictionary keyed by metric showing cross validation scores per
  partition.
- Return type: dict

#### get_data_disparity_insights(feature, class_name1, class_name2)

Retrieve a list of Cross Class Data Disparity insights for the model.

- Parameters:
- Return type: json

#### get_fairness_insights(fairness_metrics_set=None, offset=0, limit=100)

Retrieve a list of Per Class Bias insights for the model.

- Parameters:
- Return type: json

#### get_feature_effect(source, data_slice_id=None)

Retrieve Feature Effects for the model.

Feature Effects provides partial dependence and predicted vs. actual values for the top 500
features ordered by feature impact score.

The partial dependence shows the marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the available sources.

- Parameters:
- Returns: feature_effects – The feature effects data.
- Return type: FeatureEffects
- Raises: ClientError – If the feature effects have not been computed or the source is not a valid value.

#### get_feature_effect_metadata()

Retrieve Feature Effects metadata. The response contains status and available model sources.

- Feature Effect for the training partition is always available, with the exception of older
  projects that only supported Feature Effect for validation.
- When a model is trained into validation or holdout without stacked predictions
  (i.e., no out-of-sample predictions in those partitions),
  Feature Effects is not available for validation or holdout.
- Feature Effects for holdout is not available when holdout was not unlocked for
  the project.

Use source to retrieve Feature Effects, selecting one of the provided sources.

- Returns: feature_effect_metadata
- Return type: FeatureEffectMetadata

#### get_feature_effects_multiclass(source='training', class_=None)

Retrieve Feature Effects for the multiclass model.

Feature Effects provide partial dependence and predicted vs. actual values for the top 500
features ordered by feature impact score.

The partial dependence shows the marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the available sources.

- Parameters:
- Returns: The list of multiclass feature effects.
- Return type: list
- Raises: ClientError – If Feature Effects have not been computed or the source is not a valid value.

#### get_feature_impact(with_metadata=False, data_slice_filter=)

Retrieve the computed Feature Impact results, a measure of the relevance of each
feature in the model.

Feature Impact is computed for each column by creating new data with that column randomly
permuted (but the others left unchanged) and measuring how the error metric score for the
predictions is affected. The ‘impactUnnormalized’ is how much worse the error metric score
is when making predictions on this modified data. The ‘impactNormalized’ is normalized so
that the largest value is 1. In both cases, larger values indicate more important features.

If a feature is redundant, i.e., once other features are considered it does not
contribute much in addition, the ‘redundantWith’ value is the name of the feature that has the
highest correlation with this feature. Note that redundancy detection is only available for
jobs run after the addition of this feature. When retrieving data that predates this
functionality, a NoRedundancyImpactAvailable warning will be used.

Only the top 1000 features are saved and can be returned.

Elsewhere this technique is sometimes called ‘Permutation Importance’.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Parameters:
- Returns:The feature impact data response depends on the with_metadata parameter. The response is
  either a dict with metadata and a list with the actual data or just a list with that data. Each list item is a dict with the keysfeatureName,impactNormalized,impactUnnormalized,redundantWith, andcount. For the dict response, the available keys are: featureImpacts- Feature Impact data as a dictionary. Each item is a dict with
  : the keys:featureName,impactNormalized,impactUnnormalized, andredundantWith.shapBased- A boolean that indicates whether Feature Impact was calculated using
  : Shapley values.ranRedundancyDetection- A boolean that indicates whether redundant feature
  : identification was run while calculating this Feature Impact.rowCount- An integer or None that indicates the number of rows that were used to
  : calculate Feature Impact. For Feature Impact calculated with the default
    logic without specifying the rowCount, we return None here.count- An integer with the number of features underfeatureImpacts.Return type:listordictRaises:ClientError– If the feature impacts have not been computed.ValueError– If data_slice_filter is passed as None.

#### get_features_used()

Query the server to determine which features were used.

Note that the data returned by this method may differ
from the names of the features in the featurelist used by this model.
This method returns the raw features that must be supplied for
predictions to be generated on a new set of data. The featurelist,
in contrast, also includes the names of derived features.

- Returns: features – The names of the features used in the model.
- Return type: List[str]

#### get_frozen_child_models()

Retrieve the IDs for all models that are frozen from this model.

- Return type: A list of Models

#### get_labelwise_roc_curves(source, fallback_to_parent_insights=False)

Retrieve a list of LabelwiseRocCurve instances for a multilabel model for the given source and all labels.
This method is valid only for multilabel projects. For binary projects, use Model.get_roc_curve API .

Added in version v2.24.

- Parameters:
- Returns: Labelwise ROC Curve instances for source and all labels
- Return type: list of LabelwiseRocCurve
- Raises: ClientError – If the insight is not available for this model

#### get_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve the model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data
- Return type: LiftChart
- Raises:

#### get_missing_report_info()

Retrieve a report on missing training data that can be used to understand missing
values treatment in the model. The report consists of missing values resolutions for
features numeric or categorical features that were part of building the model.

- Returns: The queried model missing report, sorted by missing count (DESCENDING order).
- Return type: An iterable of MissingReportPerFeature

#### get_model_blueprint_chart()

Retrieve a diagram that can be used to understand
data flow in the blueprint.

- Returns: The queried model blueprint chart.
- Return type: ModelBlueprintChart

#### get_model_blueprint_documents()

Get documentation for tasks used in this model.

- Returns: All documents available for the model.
- Return type: list of BlueprintTaskDocument

#### get_model_blueprint_json()

Get the blueprint json representation used by this model.

- Returns: Json representation of the blueprint stages.
- Return type: BlueprintJson

#### get_multiclass_feature_impact()

For multiclass models, feature impact can be calculated separately for each target class.
The method of calculation is the same, computed in one-vs-all style for each
target class.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Returns: feature_impacts – The feature impact data. Each item is a dict with the keys ‘featureImpacts’ (list),
  ‘class’ (str). Each item in ‘featureImpacts’ is a dict with the keys ‘featureName’,
  ‘impactNormalized’, ‘impactUnnormalized’, and ‘redundantWith’.
- Return type: list of dict
- Raises: ClientError – If the multiclass feature impacts have not been computed.

#### get_multiclass_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_multilabel_lift_charts(source, fallback_to_parent_insights=False)

Retrieve model Lift charts for the specified source.

Added in version v2.24.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_num_iterations_trained()

Retrieve the number of estimators trained by early-stopping tree-based models.

Added in version v2.22.

- Returns:

#### get_or_request_feature_effect(source, max_wait=600, row_count=None, data_slice_id=None)

Retrieve Feature Effects for the model, requesting a new job if it has not been run previously.

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the source.

- Parameters:
- Returns: feature_effects – The Feature Effects data.
- Return type: FeatureEffects

#### get_or_request_feature_effects_multiclass(source, top_n_features=None, features=None, row_count=None, class_=None, max_wait=600)

Retrieve Feature Effects for the multiclass model, requesting a job if it has not been run
previously.

- Parameters:
- Returns: feature_effects – The list of multiclass feature effects data.
- Return type: list of FeatureEffectsMulticlass

#### get_or_request_feature_impact(max_wait=600, **kwargs)

Retrieve feature impact for the model, requesting a job if it has not been run previously.

Only the top 1000 features are saved and can be returned.

- Parameters:
- Returns: feature_impacts – The feature impact data. See get_feature_impact for the exact
  schema.
- Return type: list or dict

#### get_parameters()

Retrieve the model parameters.

- Returns: The model parameters for this model.
- Return type: ModelParameters

#### get_pareto_front()

Retrieve the Pareto Front for a Eureqa model.

This method is only supported for Eureqa models.

- Returns: Model ParetoFront data
- Return type: ParetoFront

#### get_prime_eligibility()

Check whether this model can be approximated with DataRobot Prime.

- Returns: prime_eligibility – A dict indicating whether the model can be approximated with DataRobot Prime
  (key can_make_prime) and why it may be ineligible (key message).
- Return type: dict

#### get_residuals_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve model residuals chart for the specified source.

- Parameters:
- Returns: Model residuals chart data
- Return type: ResidualsChart
- Raises:

#### get_roc_curve(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve the ROC curve for a binary model for the specified source.
This method is valid only for binary projects. For multilabel projects, use
Model.get_labelwise_roc_curves.

- Parameters:
- Returns: Model ROC curve data
- Return type: RocCurve
- Raises:

#### get_rulesets()

List the rulesets that approximate this model, generated by DataRobot Prime.

If this model has not been approximated yet, returns an empty list. Note that these
are rulesets that approximate this model, not rulesets used to construct this model.

- Returns: rulesets
- Return type: list of Ruleset

#### get_supported_capabilities()

Retrieve a summary of the capabilities supported by a model.

Added in version v2.14.

- Returns:

#### get_uri()

Return the permanent static hyperlink to this model on the leaderboard.

- Returns: url – The permanent static hyperlink to this model on the leaderboard.
- Return type: str

#### get_word_cloud(exclude_stop_words=False)

Retrieve word cloud data for the model.

- Parameters: exclude_stop_words ( Optional[bool] ) – Set to True if you want stopwords filtered out of response.
- Returns: Word cloud data for the model.
- Return type: WordCloud

#### incremental_train(data_stage_id, training_data_name=None)

Submit a job to the queue to perform incremental training on an existing model.
See the train_incremental documentation.

- Return type: ModelJob

#### classmethod list(project_id, sort_by_partition='validation', sort_by_metric=None, with_metric=None, search_term=None, featurelists=None, families=None, blueprints=None, labels=None, characteristics=None, training_filters=None, number_of_clusters=None, limit=100, offset=0)

Retrieve paginated model records, sorted by scores, with optional filtering.

- Parameters:
- Returns: generic_models
- Return type: list of GenericModel

#### open_in_browser()

Opens class’ relevant web browser location.
If default browser is not available the URL is logged.

Note:
If text-mode browsers are used, the calling process will block
until the user exits the browser.

- Return type: None

#### request_approximation()

Request an approximation of this model using DataRobot Prime.

This creates several rulesets that can be used to approximate this model. After
comparing their scores and rule counts, the code used in the approximation can be downloaded
and run locally.

- Returns: job – The job that generates the rulesets.
- Return type: Job

#### request_cross_class_accuracy_scores()

Request data disparity insights to be computed for the model.

- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_data_disparity_insights(feature, compared_class_names)

Request data disparity insights to be computed for the model.

- Parameters:
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_external_test(dataset_id, actual_value_column=None)

Request an external test to compute scores and insights on an external test dataset.

- Parameters:
- Returns: job – A job representing external dataset insights computation.
- Return type: Job

#### request_fairness_insights(fairness_metrics_set=None)

Request fairness insights to be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – Can be one of .
  The fairness metric used to calculate the fairness scores.
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_feature_effect(row_count=None, data_slice_id=None)

Submit a request to compute Feature Effects for the model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect) for more
information on the result of the job.

- Parameters:
- Returns: job – A job representing the feature effect computation. To get the completed feature effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job
- Raises: JobAlreadyRequested – If the feature effects have already been requested.

#### request_feature_effects_multiclass(row_count=None, top_n_features=None, features=None)

Request Feature Effects computation for the multiclass model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effects_multiclass) for
more information on the result of the job.

- Parameters:
- Returns: job – A job representing Feature Effect computation. To get the completed Feature Effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job

#### request_feature_impact(row_count=None, with_metadata=False, data_slice_id=None)

Request that feature impacts be computed for the model.

See [get_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_impact) for more
information on the result of the job.

- Parameters:
- Returns: job – A job representing the Feature Impact computation. To retrieve the completed Feature Impact
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job or status_id
- Raises: JobAlreadyRequested – If the feature impacts have already been requested.

#### request_frozen_datetime_model(training_row_count=None, training_duration=None, training_start_date=None, training_end_date=None, time_window_sample_pct=None, sampling_method=None)

Train a new frozen model with parameters from this model.

Requires that this model belongs to a datetime partitioned project. If it does not, an
error will occur when submitting the job.

Frozen models use the same tuning parameters as their parent model instead of independently
optimizing them to allow efficiently retraining models on larger amounts of the training
data.

In addition to training_row_count and training_duration, frozen datetime models may be
trained on an exact date range. Only one of training_row_count, training_duration, or
training_start_date and training_end_date should be specified.

Models specified using training_start_date and training_end_date are the only ones that can
be trained into the holdout data (once the holdout is unlocked).

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: model_job – The modeling job that trains a frozen model.
- Return type: ModelJob

#### request_frozen_model(sample_pct=None, training_row_count=None)

Train a new frozen model with parameters from this model.

> [!NOTE] Notes
> This method only works if the project the model belongs to is not datetime
> partitioned. If it is, use `request_frozen_datetime_model` instead.
> 
> Frozen models use the same tuning parameters as their parent model instead of independently
> optimizing them to allow efficiently retraining models on larger amounts of the training
> data.

- Parameters:
- Returns: model_job – The modeling job that trains a frozen model.
- Return type: ModelJob

#### request_lift_chart(source, data_slice_id=None)

Request the model Lift Chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_per_class_fairness_insights(fairness_metrics_set=None)

Request per-class fairness insights be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – The fairness metric used to calculate the fairness scores.
  Value can be any one of .
- Returns: status_check_job – The returned object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_predictions(dataset_id=None, dataset=None, dataframe=None, file_path=None, file=None, include_prediction_intervals=None, prediction_intervals_size=None, forecast_point=None, predictions_start_date=None, predictions_end_date=None, actual_value_column=None, explanation_algorithm=None, max_explanations=None, max_ngram_explanations=None)

Request predictions against a previously uploaded dataset.

- Parameters:
- Returns: job – The job computing the predictions.
- Return type: PredictJob

#### request_residuals_chart(source, data_slice_id=None)

Request the model residuals chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_roc_curve(source, data_slice_id=None)

Request the model Roc Curve for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_training_predictions(data_subset, explanation_algorithm=None, max_explanations=None)

Start a job to build training predictions

- Parameters:

#### retrain(sample_pct=None, featurelist_id=None, training_row_count=None, n_clusters=None)

Submit a job to the queue to train a blender model.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### set_prediction_threshold(threshold)

Set a custom prediction threshold for the model.

May not be used once `prediction_threshold_read_only` is True for this model.

- Parameters: threshold ( float ) – only used for binary classification projects. The threshold to when deciding between
  the positive and negative classes when making predictions.  Should be between 0.0 and
  1.0 (inclusive).

#### star_model()

Mark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

#### start_advanced_tuning_session(grid_search_arguments=None)

Start an Advanced Tuning session.  Returns an object that helps
set up arguments for an Advanced Tuning model execution.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters: grid_search_arguments ( GridSearchArguments ) – Grid search arguments
- Returns: Session for setting up and running Advanced Tuning on a model
- Return type: AdvancedTuningSession

#### start_incremental_learning_from_sample(early_stopping_rounds=None, first_iteration_only=False, chunk_definition_id=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### train(sample_pct=None, featurelist_id=None, scoring_type=None, training_row_count=None, monotonic_increasing_featurelist_id=, monotonic_decreasing_featurelist_id=)

Train the blueprint used in the model on a particular featurelist or amount of data.

This method creates a new training job for the worker and appends it to
the end of the queue for this project.
After the job has finished, you can get the newly trained model by retrieving
it from the project leaderboard or by retrieving the result of the job.

Either sample_pct or training_row_count can be used to specify the amount of data to
use, but not both. If neither is specified, a default of the maximum amount of data that
can safely be used to train any blueprint without using the validation data will be
selected.

In smart-sampled projects, sample_pct and training_row_count are assumed to be in terms
of rows of the minority class.

> [!NOTE] Notes
> For datetime partitioned projects, see [train_datetime](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.DatetimeModel.train_datetime) instead.

- Parameters:
- Returns: model_job_id – The ID of the created job; can be used as a parameter to ModelJob.get or the wait_for_async_model_creation function.
- Return type: str

> [!NOTE] Examples
> ```
> project = Project.get('project-id')
> model = Model.get('project-id', 'model-id')
> model_job_id = model.train(training_row_count=project.max_train_rows)
> ```

#### train_datetime(featurelist_id=None, training_row_count=None, training_duration=None, time_window_sample_pct=None, monotonic_increasing_featurelist_id=, monotonic_decreasing_featurelist_id=, use_project_settings=False, sampling_method=None, n_clusters=None)

Train this model on a different featurelist or sample size.

Requires that this model is part of a datetime partitioned project; otherwise, an error will
occur.

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: job – The created job to build the model.
- Return type: ModelJob

#### train_incremental(data_stage_id, training_data_name=None, data_stage_encoding=None, data_stage_delimiter=None, data_stage_compression=None)

Submit a job to the queue to perform incremental training on an existing model using
additional data. The ID of the additional data to use for training is specified with `data_stage_id`.
Optionally, a name for the iteration can be supplied by the user to help identify the contents of the data in
the iteration.

This functionality requires the INCREMENTAL_LEARNING feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### unstar_model()

Unmark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

## Datetime models

### class datarobot.models.DatetimeModel

Represents a model from a datetime partitioned project

All durations are specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

Note that only one of training_row_count, training_duration, and
training_start_date and training_end_date will be specified, depending on the
data_selection_method of the model.  Whichever method was selected determines the amount of
data used to train on when making predictions and scoring the backtests and the holdout.

- Variables:

#### classmethod get(project, model_id)

Retrieve a specific datetime model.

If the project does not use datetime partitioning, a ClientError will occur.

- Parameters:
- Returns: model – the model
- Return type: DatetimeModel

#### score_backtests()

Compute the scores for all available backtests.

Some backtests may be unavailable if the model is trained into their validation data.

- Returns: job – a job tracking the backtest computation.  When it is complete, all available backtests
  will have scores computed.
- Return type: Job

#### cross_validate()

Inherited from the model. DatetimeModels cannot request cross validation scores;
use backtests instead.

- Return type: NoReturn

#### get_cross_validation_scores(partition=None, metric=None)

Inherited from Model - DatetimeModels cannot request Cross Validation scores,

Use `backtests` instead.

- Return type: NoReturn

#### request_training_predictions(data_subset, *args, **kwargs)

Start a job that builds training predictions.

- Parameters:data_subset(str) – data set definition to build predictions on.
Choices are: dr.enums.DATA_SUBSET.HOLDOUT for holdout data set onlydr.enums.DATA_SUBSET.ALL_BACKTESTS for downloading the predictions for all
  : backtest validation folds. Requires the model to have successfully scored all
    backtests.Returns:an instance of created async jobReturn type:Job

#### get_series_accuracy_as_dataframe(offset=0, limit=100, metric=None, multiseries_value=None, order_by=None, reverse=False)

Retrieve series accuracy results for the specified model as a pandas.DataFrame.

- Parameters:
- Returns: A pandas.DataFrame with the Series Accuracy for the specified model.
- Return type: data

#### download_series_accuracy_as_csv(filename, encoding='utf-8', offset=0, limit=100, metric=None, multiseries_value=None, order_by=None, reverse=False)

Save series accuracy results for the specified model in a CSV file.

- Parameters:

#### get_series_clusters(offset=0, limit=100, order_by=None, reverse=False)

Retrieve a dictionary of series and the clusters assigned to each series. This
is only usable for clustering projects.

- Parameters:
- Returns: A dictionary of the series in the dataset with their associated cluster
- Return type: Dict
- Raises:

#### compute_series_accuracy(compute_all_series=False)

Compute series accuracy for the model.

- Parameters: compute_all_series ( Optional[bool] ) – Calculate accuracy for all series or only first 1000.
- Returns: an instance of the created async job
- Return type: Job

#### retrain(time_window_sample_pct=None, featurelist_id=None, training_row_count=None, training_duration=None, training_start_date=None, training_end_date=None, sampling_method=None, n_clusters=None)

Retrain an existing datetime model using a new training period for the model’s training
set (with optional time window sampling) or a different feature list.

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: job – The created job that is retraining the model
- Return type: ModelJob

#### get_feature_effect_metadata()

Retrieve Feature Effect metadata for each backtest. Response contains status and available
sources for each backtest of the model.

- Each backtest is available for training and validation
- If holdout is configured for the project it has holdout as backtestIndex. It has
  training and holdout sources available.

Start/stop models contain a single response item with startstop value for backtestIndex.

- Feature Effect of training is always available
  (except for the old project which supports only Feature Effect for validation).
- When a model is trained into validation or holdout without stacked prediction
  (e.g., no out-of-sample prediction in validation or holdout),
  Feature Effect is not available for validation or holdout.
- Feature Effect for holdout is not available when there is no holdout configured for
  the project.

source is expected parameter to retrieve Feature Effect. One of provided sources
shall be used.

backtestIndex is expected parameter to submit compute request and retrieve Feature Effect.
One of provided backtest indexes shall be used.

- Returns: feature_effect_metadata
- Return type: FeatureEffectMetadataDatetime

#### request_feature_effect(backtest_index, data_slice_filter=)

Request feature effects to be computed for the model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.DatetimeModel.get_feature_effect) for more
information on the result of the job.

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.DatetimeModel.get_feature_effect_metadata) for retrieving information of backtest_index.

- Parameters: backtest_index ( string , FeatureEffectMetadataDatetime.backtest_index. ) – The backtest index to retrieve Feature Effects for.
- Returns: job – A Job representing the feature effect computation. To get the completed feature effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job
- Raises: JobAlreadyRequested – If the feature effect have already been requested.

#### get_feature_effect(source, backtest_index, data_slice_filter=)

Retrieve Feature Effects for the model.

Feature Effects provides partial dependence and predicted vs actual values for top-500
features ordered by feature impact score.

The partial dependence shows marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.DatetimeModel.get_feature_effect_metadata) for retrieving information of source, backtest_index.

- Parameters:
- Returns: feature_effects – The feature effects data.
- Return type: FeatureEffects
- Raises: ClientError – If the feature effects have not been computed or source is not valid value.

#### get_or_request_feature_effect(source, backtest_index, max_wait=600, data_slice_filter=)

Retrieve Feature Effects computations for the model, requesting a new job if it hasn’t been run previously.

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.DatetimeModel.get_feature_effect_metadata) for retrieving information of source, backtest_index.

- Parameters:
- Returns: feature_effects – The feature effects data.
- Return type: FeatureEffects

#### request_feature_effects_multiclass(backtest_index, row_count=None, top_n_features=None, features=None)

Request feature effects to be computed for the multiclass datetime model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effects_multiclass) for
more information on the result of the job.

- Parameters:
- Returns: job – A Job representing Feature Effects computation. To get the completed Feature Effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job

#### get_feature_effects_multiclass(backtest_index, source='training', class_=None)

Retrieve Feature Effects for the multiclass datetime model.

Feature Effects provides partial dependence and predicted vs actual values for top-500
features ordered by feature impact score.

The partial dependence shows marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information the available sources.

- Parameters:
- Returns: The list of multiclass Feature Effects.
- Return type: list
- Raises: ClientError – If the Feature Effects have not been computed or source is not valid value.

#### get_or_request_feature_effects_multiclass(backtest_index, source, top_n_features=None, features=None, row_count=None, class_=None, max_wait=600)

Retrieve Feature Effects for a datetime multiclass model, and request a job if it hasn’t
been run previously.

- Parameters:
- Returns: feature_effects – The list of multiclass feature effects data.
- Return type: list of FeatureEffectsMulticlass

#### calculate_prediction_intervals(prediction_intervals_size)

Calculate prediction intervals for this DatetimeModel for the specified size.

Added in version v2.19.

- Parameters: prediction_intervals_size ( int ) – The prediction interval’s size to calculate for this model. See the prediction intervals documentation for more information.
- Returns: job – a Job tracking the prediction intervals computation
- Return type: Job

#### get_calculated_prediction_intervals(offset=None, limit=None)

Retrieve a list of already-calculated prediction intervals for this model

Added in version v2.19.

- Parameters:
- Returns: A descending-ordered list of already-calculated prediction interval sizes
- Return type: list[int]

#### compute_datetime_trend_plots(backtest=0, source=SOURCE_TYPE.VALIDATION, forecast_distance_start=None, forecast_distance_end=None)

Computes datetime trend plots
(Accuracy over Time, Forecast vs Actual, Anomaly over Time) for this model

Added in version v2.25.

- Parameters:
- Returns: job – a Job tracking the datetime trend plots computation
- Return type: Job

> [!NOTE] Notes
> Forecast distance specifies the number of time steps
>   between the predicted point and the origin point.
> For the multiseries models only first 1000 series in
>   alphabetical order and an average plot for them will be computed.
> Maximum 100 forecast distances can be requested for
>   calculation in time series supervised projects.

#### get_accuracy_over_time_plots_metadata(forecast_distance=None)

Retrieve Accuracy over Time plots metadata for this model.

Added in version v2.25.

- Parameters: forecast_distance ( Optional[int] ) – Forecast distance to retrieve the metadata for.
  If not specified, the first forecast distance for this project will be used.
  Only available for time series projects.
- Returns: metadata – a AccuracyOverTimePlotsMetadata representing Accuracy over Time plots metadata
- Return type: AccuracyOverTimePlotsMetadata

#### get_accuracy_over_time_plot(backtest=0, source=SOURCE_TYPE.VALIDATION, forecast_distance=None, series_id=None, resolution=None, max_bin_size=None, start_date=None, end_date=None, max_wait=600)

Retrieve Accuracy over Time plots for this model.

Added in version v2.25.

- Parameters:
- Returns: plot – a AccuracyOverTimePlot representing Accuracy over Time plot
- Return type: AccuracyOverTimePlot

> [!NOTE] Examples
> ```
> import datarobot as dr
> import pandas as pd
> model = dr.DatetimeModel(project_id=project_id, id=model_id)
> plot = model.get_accuracy_over_time_plot()
> df = pd.DataFrame.from_dict(plot.bins)
> figure = df.plot("start_date", ["actual", "predicted"]).get_figure()
> figure.savefig("accuracy_over_time.png")
> ```

#### get_accuracy_over_time_plot_preview(backtest=0, source=SOURCE_TYPE.VALIDATION, forecast_distance=None, series_id=None, max_wait=600)

Retrieve Accuracy over Time preview plots for this model.

Added in version v2.25.

- Parameters:
- Returns: plot – a AccuracyOverTimePlotPreview representing Accuracy over Time plot preview
- Return type: AccuracyOverTimePlotPreview

> [!NOTE] Examples
> ```
> import datarobot as dr
> import pandas as pd
> model = dr.DatetimeModel(project_id=project_id, id=model_id)
> plot = model.get_accuracy_over_time_plot_preview()
> df = pd.DataFrame.from_dict(plot.bins)
> figure = df.plot("start_date", ["actual", "predicted"]).get_figure()
> figure.savefig("accuracy_over_time_preview.png")
> ```

#### get_forecast_vs_actual_plots_metadata()

Retrieve Forecast vs Actual plots metadata for this model.

Added in version v2.25.

- Returns: metadata – a ForecastVsActualPlotsMetadata representing Forecast vs Actual plots metadata
- Return type: ForecastVsActualPlotsMetadata

#### get_forecast_vs_actual_plot(backtest=0, source=SOURCE_TYPE.VALIDATION, forecast_distance_start=None, forecast_distance_end=None, series_id=None, resolution=None, max_bin_size=None, start_date=None, end_date=None, max_wait=600)

Retrieve Forecast vs Actual plots for this model.

Added in version v2.25.

- Parameters:
- Returns: plot – a ForecastVsActualPlot representing Forecast vs Actual plot
- Return type: ForecastVsActualPlot

> [!NOTE] Examples
> ```
> import datarobot as dr
> import pandas as pd
> import matplotlib.pyplot as plt
> 
> model = dr.DatetimeModel(project_id=project_id, id=model_id)
> plot = model.get_forecast_vs_actual_plot()
> df = pd.DataFrame.from_dict(plot.bins)
> 
> # As an example, get the forecasts for the 10th point
> forecast_point_index = 10
> # Pad the forecasts for plotting. The forecasts length must match the df length
> forecasts = [None] * forecast_point_index + df.forecasts[forecast_point_index]
> forecasts = forecasts + [None] * (len(df) - len(forecasts))
> 
> plt.plot(df.start_date, df.actual, label="Actual")
> plt.plot(df.start_date, forecasts, label="Forecast")
> forecast_point = df.start_date[forecast_point_index]
> plt.title("Forecast vs Actual (Forecast Point {})".format(forecast_point))
> plt.legend()
> plt.savefig("forecast_vs_actual.png")
> ```

#### get_forecast_vs_actual_plot_preview(backtest=0, source=SOURCE_TYPE.VALIDATION, series_id=None, max_wait=600)

Retrieve Forecast vs Actual preview plots for this model.

Added in version v2.25.

- Parameters:
- Returns: plot – a ForecastVsActualPlotPreview representing Forecast vs Actual plot preview
- Return type: ForecastVsActualPlotPreview

> [!NOTE] Examples
> ```
> import datarobot as dr
> import pandas as pd
> model = dr.DatetimeModel(project_id=project_id, id=model_id)
> plot = model.get_forecast_vs_actual_plot_preview()
> df = pd.DataFrame.from_dict(plot.bins)
> figure = df.plot("start_date", ["actual", "predicted"]).get_figure()
> figure.savefig("forecast_vs_actual_preview.png")
> ```

#### get_anomaly_over_time_plots_metadata()

Retrieve Anomaly over Time plots metadata for this model.

Added in version v2.25.

- Returns: metadata – a AnomalyOverTimePlotsMetadata representing Anomaly over Time plots metadata
- Return type: AnomalyOverTimePlotsMetadata

#### get_anomaly_over_time_plot(backtest=0, source=SOURCE_TYPE.VALIDATION, series_id=None, resolution=None, max_bin_size=None, start_date=None, end_date=None, max_wait=600)

Retrieve Anomaly over Time plots for this model.

Added in version v2.25.

- Parameters:
- Returns: plot – a AnomalyOverTimePlot representing Anomaly over Time plot
- Return type: AnomalyOverTimePlot

> [!NOTE] Examples
> ```
> import datarobot as dr
> import pandas as pd
> model = dr.DatetimeModel(project_id=project_id, id=model_id)
> plot = model.get_anomaly_over_time_plot()
> df = pd.DataFrame.from_dict(plot.bins)
> figure = df.plot("start_date", "predicted").get_figure()
> figure.savefig("anomaly_over_time.png")
> ```

#### get_anomaly_over_time_plot_preview(prediction_threshold=0.5, backtest=0, source=SOURCE_TYPE.VALIDATION, series_id=None, max_wait=600)

Retrieve Anomaly over Time preview plots for this model.

Added in version v2.25.

- Parameters:
- Returns: plot – a AnomalyOverTimePlotPreview representing Anomaly over Time plot preview
- Return type: AnomalyOverTimePlotPreview

> [!NOTE] Examples
> ```
> import datarobot as dr
> import pandas as pd
> import matplotlib.pyplot as plt
> 
> model = dr.DatetimeModel(project_id=project_id, id=model_id)
> plot = model.get_anomaly_over_time_plot_preview(prediction_threshold=0.01)
> df = pd.DataFrame.from_dict(plot.bins)
> x = pd.date_range(
>     plot.start_date, plot.end_date, freq=df.end_date[0] - df.start_date[0]
> )
> plt.plot(x, [0] * len(x), label="Date range")
> plt.plot(df.start_date, [0] * len(df.start_date), "ro", label="Anomaly")
> plt.yticks([])
> plt.legend()
> plt.savefig("anomaly_over_time_preview.png")
> ```

#### initialize_anomaly_assessment(backtest, source, series_id=None)

Initialize the anomaly assessment insight and calculate
Shapley explanations for the most anomalous points in the subset.
The insight is available for anomaly detection models in time series unsupervised projects
which also support calculation of Shapley values.

- Parameters:
- Return type: AnomalyAssessmentRecord

#### get_anomaly_assessment_records(backtest=None, source=None, series_id=None, limit=100, offset=0, with_data_only=False)

Retrieve computed Anomaly Assessment records for this model. Model must be an anomaly
detection model in time series unsupervised project which also supports calculation of
Shapley values.

Records can be filtered by the data backtest, source and series_id.
The results can be limited.

Added in version v2.25.

- Parameters:
- Returns: records – a AnomalyAssessmentRecord representing Anomaly Assessment Record
- Return type: list of AnomalyAssessmentRecord

#### get_feature_impact(with_metadata=False, backtest=None, data_slice_filter=)

Retrieve the computed Feature Impact results, a measure of the relevance of each
feature in the model.

Feature Impact is computed for each column by creating new data with that column randomly
permuted (but the others left unchanged), and seeing how the error metric score for the
predictions is affected. The ‘impactUnnormalized’ is how much worse the error metric score
is when making predictions on this modified data. The ‘impactNormalized’ is normalized so
that the largest value is 1. In both cases, larger values indicate more important features.

If a feature is redundant, i.e., once other features are considered it does not
contribute much in addition, the ‘redundantWith’ value is the name of the feature that has the
highest correlation with this feature. Note that redundancy detection is only available for
jobs run after the addition of this feature. When retrieving data that predates this
functionality, a NoRedundancyImpactAvailable warning will be used.

Only the top 1000 features are saved and can be returned.

Elsewhere this technique is sometimes called ‘Permutation Importance’.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Parameters:
- Returns:The feature impact data response depends on the with_metadata parameter. The response is
  either a dict with metadata and a list with actual data or just a list with that data. Each List item is a dict with the keysfeatureName,impactNormalized, andimpactUnnormalized,redundantWithandcount. For dict response available keys are: featureImpacts- Feature Impact data as a dictionary. Each item is a dict with
  : keys:featureName,impactNormalized, andimpactUnnormalized, andredundantWith.shapBased- A boolean that indicates whether Feature Impact was calculated using
  : Shapley values.ranRedundancyDetection- A boolean that indicates whether redundant feature
  : identification was run while calculating this Feature Impact.rowCount- An integer or None that indicates the number of rows that was used to
  : calculate Feature Impact. For the Feature Impact calculated with the default
    logic, without specifying the rowCount, we return None here.count- An integer with the number of features under thefeatureImpacts.Return type:listordictRaises:ClientError– If the feature impacts have not been computed.

#### request_feature_impact(row_count=None, with_metadata=False, backtest=None, data_slice_filter=)

Request feature impacts to be computed for the model.

See [get_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_impact) for more
information on the result of the job.

- Parameters:
- Returns: job – A Job representing the feature impact computation. To get the completed feature impact
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job
- Raises: JobAlreadyRequested – If the feature impacts have already been requested.

#### get_or_request_feature_impact(max_wait=600, row_count=None, with_metadata=False, backtest=None, data_slice_filter=)

Retrieve feature impact for the model, requesting a job if it hasn’t been run previously

- Parameters:
- Returns: feature_impacts – The feature impact data. See get_feature_impact for the exact
  schema.
- Return type: list or dict

#### request_lift_chart(source=None, backtest_index=None, data_slice_filter=)

(New in version v3.4)
Request the model Lift Chart for the specified backtest data slice.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### get_lift_chart(source=None, backtest_index=None, fallback_to_parent_insights=False, data_slice_filter=)

(New in version v3.4)
Retrieve the model Lift chart for the specified backtest and data slice.

- Parameters:
- Returns: Model lift chart data
- Return type: LiftChart
- Raises:

#### request_roc_curve(source=None, backtest_index=None, data_slice_filter=)

(New in version v3.4)
Request the binary model Roc Curve for the specified backtest and data slice.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### get_roc_curve(source=None, backtest_index=None, fallback_to_parent_insights=False, data_slice_filter=)

(New in version v3.4)
Retrieve the ROC curve for a binary model for the specified backtest and data slice.

- Parameters:
- Returns: Model ROC curve data
- Return type: RocCurve
- Raises:

#### advanced_tune(params, description=None, grid_search_arguments=None)

Generate a new model with the specified advanced-tuning parameters

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters:
- Returns: The created job to build the model
- Return type: ModelJob

#### continue_incremental_learning_from_incremental_model(chunk_definition_id, early_stopping_rounds=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The model retraining job that is created.
- Return type: ModelJob

#### delete()

Delete the model from the project leaderboard.

- Return type: None

#### download_scoring_code(file_name, source_code=False)

Download the Scoring Code JAR.

- Parameters:
- Return type: None

#### download_training_artifact(file_name)

Retrieve trained artifact(s) from a model containing one or more custom tasks.

Artifact(s) will be downloaded to the specified local filepath.

- Parameters: file_name ( str ) – File path where trained model artifact(s) will be saved.

#### classmethod from_data(data)

Instantiate an object of this class using a dict.

- Parameters: data ( dict ) – Correctly snake_cased keys and their values.
- Return type: TypeVar ( T , bound= APIObject)

#### get_advanced_tuning_parameters()

Get the advanced-tuning parameters available for this model.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Returns:A dictionary describing the advanced-tuning parameters for the current model.
  There are two top-level keys, tuning_description and tuning_parameters. tuning_description an optional value. If not None, then it indicates the
user-specified description of this set of tuning parameter. tuning_parameters is a list of a dicts, each has the following keys
* parameter_name :(str)name of the parameter (unique per task, see below)
* parameter_id :(str)opaque ID string uniquely identifying parameter
* default_value :(*)the actual value used to train the model; either
  the single value of the parameter specified before training, or the best
  value from the list of grid-searched values (based on current_value)
* current_value :(*)the single value or list of values of the
  parameter that were grid searched. Depending on the grid search
  specification, could be a single fixed value (no grid search),
  a list of discrete values, or a range.
* task_name :(str)name of the task that this parameter belongs to
* constraints:(dict)see the notes below
* vertex_id:(str)ID of vertex that this parameter belongs to
*Return type:dict

> [!NOTE] Notes
> The type of default_value and current_value is defined by the constraints structure.
> It will be a string or numeric Python type.
> 
> constraints is a dict with at least one, possibly more, of the following keys.
> The presence of a key indicates that the parameter may take on the specified type.
> (If a key is absent, this means that the parameter may not take on the specified type.)
> If a key on constraints is present, its value will be a dict containing
> all of the fields described below for that key.
> 
> ```
> "constraints": {
>     "select": {
>         "values": [<list(basestring or number) : possible values>]
>     },
>     "ascii": {},
>     "unicode": {},
>     "int": {
>         "min": <int : minimum valid value>,
>         "max": <int : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "float": {
>         "min": <float : minimum valid value>,
>         "max": <float : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "intList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <int : minimum valid value>,
>         "max_val": <int : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "floatList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <float : minimum valid value>,
>         "max_val": <float : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     }
> }
> ```
> 
> The keys have meaning as follows:
> 
> select:
>   Rather than specifying a specific data type, if present, it indicates that the parameter
>   is permitted to take on any of the specified values.  Listed values may be of any string
>   or real (non-complex) numeric type.
> ascii:
>   The parameter may be a unicode object that encodes simple ASCII characters.
>   (A-Z, a-z, 0-9, whitespace, and certain common symbols.)  In addition to listed
>   constraints, ASCII keys currently may not contain either newlines or semicolons.
> unicode:
>   The parameter may be any Python unicode object.
> int:
>   The value may be an object of type int within the specified range (inclusive).
>   Please note that the value will be passed around using the JSON format, and
>   some JSON parsers have undefined behavior with integers outside of the range
>   [-(2**53)+1, (2**53)-1].
> float:
>   The value may be an object of type float within the specified range (inclusive).
> intList, floatList:
>   The value may be a list of int or float objects, respectively, following constraints
>   as specified respectively by the int and float types (above).
> 
> Many parameters only specify one key under constraints.  If a parameter specifies multiple
> keys, the parameter may take on any value permitted by any key.

#### get_all_confusion_charts(fallback_to_parent_insights=False)

Retrieve a list of all confusion matrices available for the model.

- Parameters: fallback_to_parent_insights ( bool ) – (New in version v2.14) Optional, if True, this will return confusion chart data for
  this model’s parent for any source that is not available for this model and if this
  has a defined parent model. If omitted or False, or this model has no parent,
  this will not attempt to retrieve any data from this model’s parent.
- Returns: Data for all available confusion charts for model.
- Return type: list of ConfusionChart

#### get_all_feature_impacts(data_slice_filter=None)

Retrieve a list of all feature impact results available for the model.

- Parameters: data_slice_filter ( DataSlice , optional ) – A DataSlice used to filter the return values based on the DataSlice ID. By default, this function
  uses data_slice_filter.id == None, which returns an unsliced insight. If data_slice_filter is None,
  no data_slice filtering will be applied when requesting the ROC curve.
- Returns: Data for all available model feature impacts, or an empty list if no data is found.
- Return type: list of dicts

> [!NOTE] Examples
> ```
> model = datarobot.Model(id='model-id', project_id='project-id')
> 
> # Get feature impact insights for sliced data
> data_slice = datarobot.DataSlice(id='data-slice-id')
> sliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get feature impact insights for unsliced data
> data_slice = datarobot.DataSlice()
> unsliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get all feature impact insights
> all_fi = model.get_all_feature_impacts()
> ```

#### get_all_lift_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts. Or an empty list if no data found.
- Return type: list of LiftChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get lift chart insights for sliced data
> sliced_lift_charts = model.get_all_lift_charts(data_slice_id='data-slice-id')
> 
> # Get lift chart insights for unsliced data
> unsliced_lift_charts = model.get_all_lift_charts(unsliced_only=True)
> 
> # Get all lift chart insights
> all_lift_charts = model.get_all_lift_charts()
> ```

#### get_all_multiclass_lift_charts(fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts.
- Return type: list of LiftChart

#### get_all_residuals_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all residuals charts available for the model.

- Parameters:
- Returns: Data for all available model residuals charts.
- Return type: list of ResidualsChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get residuals chart insights for sliced data
> sliced_residuals_charts = model.get_all_residuals_charts(data_slice_id='data-slice-id')
> 
> # Get residuals chart insights for unsliced data
> unsliced_residuals_charts = model.get_all_residuals_charts(unsliced_only=True)
> 
> # Get all residuals chart insights
> all_residuals_charts = model.get_all_residuals_charts()
> ```

#### get_all_roc_curves(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all ROC curves available for the model.

- Parameters:
- Returns: Data for all available model ROC curves. Or an empty list if no RocCurves are found.
- Return type: list of RocCurve

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> ds_filter=DataSlice(id='data-slice-id')
> 
> # Get roc curve insights for sliced data
> sliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get roc curve insights for unsliced data
> data_slice_filter=DataSlice(id=None)
> unsliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get all roc curve insights
> all_roc_curves = model.get_all_roc_curves()
> ```

#### get_confusion_chart(source, fallback_to_parent_insights=False)

Retrieve a multiclass model’s confusion matrix for the specified source.

- Parameters:
- Returns: Model ConfusionChart data
- Return type: ConfusionChart
- Raises: ClientError – If the insight is not available for this model

#### get_cross_class_accuracy_scores()

Retrieves a list of Cross Class Accuracy scores for the model.

- Return type: json

#### get_data_disparity_insights(feature, class_name1, class_name2)

Retrieve a list of Cross Class Data Disparity insights for the model.

- Parameters:
- Return type: json

#### get_fairness_insights(fairness_metrics_set=None, offset=0, limit=100)

Retrieve a list of Per Class Bias insights for the model.

- Parameters:
- Return type: json

#### get_features_used()

Query the server to determine which features were used.

Note that the data returned by this method may differ
from the names of the features in the featurelist used by this model.
This method returns the raw features that must be supplied for
predictions to be generated on a new set of data. The featurelist,
in contrast, also includes the names of derived features.

- Returns: features – The names of the features used in the model.
- Return type: List[str]

#### get_frozen_child_models()

Retrieve the IDs for all models that are frozen from this model.

- Return type: A list of Models

#### get_labelwise_roc_curves(source, fallback_to_parent_insights=False)

Retrieve a list of LabelwiseRocCurve instances for a multilabel model for the given source and all labels.
This method is valid only for multilabel projects. For binary projects, use Model.get_roc_curve API .

Added in version v2.24.

- Parameters:
- Returns: Labelwise ROC Curve instances for source and all labels
- Return type: list of LabelwiseRocCurve
- Raises: ClientError – If the insight is not available for this model

#### get_missing_report_info()

Retrieve a report on missing training data that can be used to understand missing
values treatment in the model. The report consists of missing values resolutions for
features numeric or categorical features that were part of building the model.

- Returns: The queried model missing report, sorted by missing count (DESCENDING order).
- Return type: An iterable of MissingReportPerFeature

#### get_model_blueprint_chart()

Retrieve a diagram that can be used to understand
data flow in the blueprint.

- Returns: The queried model blueprint chart.
- Return type: ModelBlueprintChart

#### get_model_blueprint_documents()

Get documentation for tasks used in this model.

- Returns: All documents available for the model.
- Return type: list of BlueprintTaskDocument

#### get_model_blueprint_json()

Get the blueprint json representation used by this model.

- Returns: Json representation of the blueprint stages.
- Return type: BlueprintJson

#### get_multiclass_feature_impact()

For multiclass models, feature impact can be calculated separately for each target class.
The method of calculation is the same, computed in one-vs-all style for each
target class.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Returns: feature_impacts – The feature impact data. Each item is a dict with the keys ‘featureImpacts’ (list),
  ‘class’ (str). Each item in ‘featureImpacts’ is a dict with the keys ‘featureName’,
  ‘impactNormalized’, ‘impactUnnormalized’, and ‘redundantWith’.
- Return type: list of dict
- Raises: ClientError – If the multiclass feature impacts have not been computed.

#### get_multiclass_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_multilabel_lift_charts(source, fallback_to_parent_insights=False)

Retrieve model Lift charts for the specified source.

Added in version v2.24.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_num_iterations_trained()

Retrieve the number of estimators trained by early-stopping tree-based models.

Added in version v2.22.

- Returns:

#### get_parameters()

Retrieve the model parameters.

- Returns: The model parameters for this model.
- Return type: ModelParameters

#### get_pareto_front()

Retrieve the Pareto Front for a Eureqa model.

This method is only supported for Eureqa models.

- Returns: Model ParetoFront data
- Return type: ParetoFront

#### get_prime_eligibility()

Check whether this model can be approximated with DataRobot Prime.

- Returns: prime_eligibility – A dict indicating whether the model can be approximated with DataRobot Prime
  (key can_make_prime) and why it may be ineligible (key message).
- Return type: dict

#### get_residuals_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve model residuals chart for the specified source.

- Parameters:
- Returns: Model residuals chart data
- Return type: ResidualsChart
- Raises:

#### get_rulesets()

List the rulesets that approximate this model, generated by DataRobot Prime.

If this model has not been approximated yet, returns an empty list. Note that these
are rulesets that approximate this model, not rulesets used to construct this model.

- Returns: rulesets
- Return type: list of Ruleset

#### get_supported_capabilities()

Retrieve a summary of the capabilities supported by a model.

Added in version v2.14.

- Returns:

#### get_uri()

Return the permanent static hyperlink to this model on the leaderboard.

- Returns: url – The permanent static hyperlink to this model on the leaderboard.
- Return type: str

#### get_word_cloud(exclude_stop_words=False)

Retrieve word cloud data for the model.

- Parameters: exclude_stop_words ( Optional[bool] ) – Set to True if you want stopwords filtered out of response.
- Returns: Word cloud data for the model.
- Return type: WordCloud

#### incremental_train(data_stage_id, training_data_name=None)

Submit a job to the queue to perform incremental training on an existing model.
See the train_incremental documentation.

- Return type: ModelJob

#### classmethod list(project_id, sort_by_partition='validation', sort_by_metric=None, with_metric=None, search_term=None, featurelists=None, families=None, blueprints=None, labels=None, characteristics=None, training_filters=None, number_of_clusters=None, limit=100, offset=0)

Retrieve paginated model records, sorted by scores, with optional filtering.

- Parameters:
- Returns: generic_models
- Return type: list of GenericModel

#### open_in_browser()

Opens class’ relevant web browser location.
If default browser is not available the URL is logged.

Note:
If text-mode browsers are used, the calling process will block
until the user exits the browser.

- Return type: None

#### request_approximation()

Request an approximation of this model using DataRobot Prime.

This creates several rulesets that can be used to approximate this model. After
comparing their scores and rule counts, the code used in the approximation can be downloaded
and run locally.

- Returns: job – The job that generates the rulesets.
- Return type: Job

#### request_cross_class_accuracy_scores()

Request data disparity insights to be computed for the model.

- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_data_disparity_insights(feature, compared_class_names)

Request data disparity insights to be computed for the model.

- Parameters:
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_external_test(dataset_id, actual_value_column=None)

Request an external test to compute scores and insights on an external test dataset.

- Parameters:
- Returns: job – A job representing external dataset insights computation.
- Return type: Job

#### request_fairness_insights(fairness_metrics_set=None)

Request fairness insights to be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – Can be one of .
  The fairness metric used to calculate the fairness scores.
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_frozen_datetime_model(training_row_count=None, training_duration=None, training_start_date=None, training_end_date=None, time_window_sample_pct=None, sampling_method=None)

Train a new frozen model with parameters from this model.

Requires that this model belongs to a datetime partitioned project. If it does not, an
error will occur when submitting the job.

Frozen models use the same tuning parameters as their parent model instead of independently
optimizing them to allow efficiently retraining models on larger amounts of the training
data.

In addition to training_row_count and training_duration, frozen datetime models may be
trained on an exact date range. Only one of training_row_count, training_duration, or
training_start_date and training_end_date should be specified.

Models specified using training_start_date and training_end_date are the only ones that can
be trained into the holdout data (once the holdout is unlocked).

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: model_job – The modeling job that trains a frozen model.
- Return type: ModelJob

#### request_per_class_fairness_insights(fairness_metrics_set=None)

Request per-class fairness insights be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – The fairness metric used to calculate the fairness scores.
  Value can be any one of .
- Returns: status_check_job – The returned object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_predictions(dataset_id=None, dataset=None, dataframe=None, file_path=None, file=None, include_prediction_intervals=None, prediction_intervals_size=None, forecast_point=None, predictions_start_date=None, predictions_end_date=None, actual_value_column=None, explanation_algorithm=None, max_explanations=None, max_ngram_explanations=None)

Request predictions against a previously uploaded dataset.

- Parameters:
- Returns: job – The job computing the predictions.
- Return type: PredictJob

#### request_residuals_chart(source, data_slice_id=None)

Request the model residuals chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### set_prediction_threshold(threshold)

Set a custom prediction threshold for the model.

May not be used once `prediction_threshold_read_only` is True for this model.

- Parameters: threshold ( float ) – only used for binary classification projects. The threshold to when deciding between
  the positive and negative classes when making predictions.  Should be between 0.0 and
  1.0 (inclusive).

#### star_model()

Mark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

#### start_advanced_tuning_session(grid_search_arguments=None)

Start an Advanced Tuning session.  Returns an object that helps
set up arguments for an Advanced Tuning model execution.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters: grid_search_arguments ( GridSearchArguments ) – Grid search arguments
- Returns: Session for setting up and running Advanced Tuning on a model
- Return type: AdvancedTuningSession

#### start_incremental_learning_from_sample(early_stopping_rounds=None, first_iteration_only=False, chunk_definition_id=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### train_datetime(featurelist_id=None, training_row_count=None, training_duration=None, time_window_sample_pct=None, monotonic_increasing_featurelist_id=, monotonic_decreasing_featurelist_id=, use_project_settings=False, sampling_method=None, n_clusters=None)

Train this model on a different featurelist or sample size.

Requires that this model is part of a datetime partitioned project; otherwise, an error will
occur.

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: job – The created job to build the model.
- Return type: ModelJob

#### train_incremental(data_stage_id, training_data_name=None, data_stage_encoding=None, data_stage_delimiter=None, data_stage_compression=None)

Submit a job to the queue to perform incremental training on an existing model using
additional data. The ID of the additional data to use for training is specified with `data_stage_id`.
Optionally, a name for the iteration can be supplied by the user to help identify the contents of the data in
the iteration.

This functionality requires the INCREMENTAL_LEARNING feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### unstar_model()

Unmark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

## Frozen models

### class datarobot.models.FrozenModel

Represents a model tuned with parameters which are derived from another model

All durations are specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Variables:

#### classmethod get(project_id, model_id)

Retrieve a specific frozen model.

- Parameters:
- Returns: model – The queried instance.
- Return type: FrozenModel

## Rating table models

### class datarobot.models.RatingTableModel

A model that has a rating table.

All durations are specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Variables:

#### classmethod get(project_id, model_id)

Retrieve a specific rating table model

If the project does not have a rating table, a ClientError will occur.

- Parameters:
- Returns: model – the model
- Return type: RatingTableModel

#### classmethod create_from_rating_table(project_id, rating_table_id)

Creates a new model from a validated rating table record. The
RatingTable must not be associated with an existing model.

- Parameters:
- Returns: job – an instance of created async job
- Return type: Job
- Raises:

#### advanced_tune(params, description=None, grid_search_arguments=None)

Generate a new model with the specified advanced-tuning parameters

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters:
- Returns: The created job to build the model
- Return type: ModelJob

#### continue_incremental_learning_from_incremental_model(chunk_definition_id, early_stopping_rounds=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The model retraining job that is created.
- Return type: ModelJob

#### cross_validate()

Run cross validation on the model.

> [!NOTE] Notes
> To perform Cross Validation on a new model with new parameters, use `train` instead.

- Returns: The created job to build the model
- Return type: ModelJob

#### delete()

Delete the model from the project leaderboard.

- Return type: None

#### download_scoring_code(file_name, source_code=False)

Download the Scoring Code JAR.

- Parameters:
- Return type: None

#### download_training_artifact(file_name)

Retrieve trained artifact(s) from a model containing one or more custom tasks.

Artifact(s) will be downloaded to the specified local filepath.

- Parameters: file_name ( str ) – File path where trained model artifact(s) will be saved.

#### classmethod from_data(data)

Instantiate an object of this class using a dict.

- Parameters: data ( dict ) – Correctly snake_cased keys and their values.
- Return type: TypeVar ( T , bound= APIObject)

#### classmethod from_server_data(data, keep_attrs=None)

Override the inherited method because the model must _not_ recursively change casing.

- Parameters:

#### get_advanced_tuning_parameters()

Get the advanced-tuning parameters available for this model.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Returns:A dictionary describing the advanced-tuning parameters for the current model.
  There are two top-level keys, tuning_description and tuning_parameters. tuning_description an optional value. If not None, then it indicates the
user-specified description of this set of tuning parameter. tuning_parameters is a list of a dicts, each has the following keys
* parameter_name :(str)name of the parameter (unique per task, see below)
* parameter_id :(str)opaque ID string uniquely identifying parameter
* default_value :(*)the actual value used to train the model; either
  the single value of the parameter specified before training, or the best
  value from the list of grid-searched values (based on current_value)
* current_value :(*)the single value or list of values of the
  parameter that were grid searched. Depending on the grid search
  specification, could be a single fixed value (no grid search),
  a list of discrete values, or a range.
* task_name :(str)name of the task that this parameter belongs to
* constraints:(dict)see the notes below
* vertex_id:(str)ID of vertex that this parameter belongs to
*Return type:dict

> [!NOTE] Notes
> The type of default_value and current_value is defined by the constraints structure.
> It will be a string or numeric Python type.
> 
> constraints is a dict with at least one, possibly more, of the following keys.
> The presence of a key indicates that the parameter may take on the specified type.
> (If a key is absent, this means that the parameter may not take on the specified type.)
> If a key on constraints is present, its value will be a dict containing
> all of the fields described below for that key.
> 
> ```
> "constraints": {
>     "select": {
>         "values": [<list(basestring or number) : possible values>]
>     },
>     "ascii": {},
>     "unicode": {},
>     "int": {
>         "min": <int : minimum valid value>,
>         "max": <int : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "float": {
>         "min": <float : minimum valid value>,
>         "max": <float : maximum valid value>,
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "intList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <int : minimum valid value>,
>         "max_val": <int : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     },
>     "floatList": {
>         "min_length": <int : minimum valid length>,
>         "max_length": <int : maximum valid length>
>         "min_val": <float : minimum valid value>,
>         "max_val": <float : maximum valid value>
>         "supports_grid_search": <bool : True if Grid Search may be
>                                         requested for this param>
>     }
> }
> ```
> 
> The keys have meaning as follows:
> 
> select:
>   Rather than specifying a specific data type, if present, it indicates that the parameter
>   is permitted to take on any of the specified values.  Listed values may be of any string
>   or real (non-complex) numeric type.
> ascii:
>   The parameter may be a unicode object that encodes simple ASCII characters.
>   (A-Z, a-z, 0-9, whitespace, and certain common symbols.)  In addition to listed
>   constraints, ASCII keys currently may not contain either newlines or semicolons.
> unicode:
>   The parameter may be any Python unicode object.
> int:
>   The value may be an object of type int within the specified range (inclusive).
>   Please note that the value will be passed around using the JSON format, and
>   some JSON parsers have undefined behavior with integers outside of the range
>   [-(2**53)+1, (2**53)-1].
> float:
>   The value may be an object of type float within the specified range (inclusive).
> intList, floatList:
>   The value may be a list of int or float objects, respectively, following constraints
>   as specified respectively by the int and float types (above).
> 
> Many parameters only specify one key under constraints.  If a parameter specifies multiple
> keys, the parameter may take on any value permitted by any key.

#### get_all_confusion_charts(fallback_to_parent_insights=False)

Retrieve a list of all confusion matrices available for the model.

- Parameters: fallback_to_parent_insights ( bool ) – (New in version v2.14) Optional, if True, this will return confusion chart data for
  this model’s parent for any source that is not available for this model and if this
  has a defined parent model. If omitted or False, or this model has no parent,
  this will not attempt to retrieve any data from this model’s parent.
- Returns: Data for all available confusion charts for model.
- Return type: list of ConfusionChart

#### get_all_feature_impacts(data_slice_filter=None)

Retrieve a list of all feature impact results available for the model.

- Parameters: data_slice_filter ( DataSlice , optional ) – A DataSlice used to filter the return values based on the DataSlice ID. By default, this function
  uses data_slice_filter.id == None, which returns an unsliced insight. If data_slice_filter is None,
  no data_slice filtering will be applied when requesting the ROC curve.
- Returns: Data for all available model feature impacts, or an empty list if no data is found.
- Return type: list of dicts

> [!NOTE] Examples
> ```
> model = datarobot.Model(id='model-id', project_id='project-id')
> 
> # Get feature impact insights for sliced data
> data_slice = datarobot.DataSlice(id='data-slice-id')
> sliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get feature impact insights for unsliced data
> data_slice = datarobot.DataSlice()
> unsliced_fi = model.get_all_feature_impacts(data_slice_filter=data_slice)
> 
> # Get all feature impact insights
> all_fi = model.get_all_feature_impacts()
> ```

#### get_all_lift_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts. Or an empty list if no data found.
- Return type: list of LiftChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get lift chart insights for sliced data
> sliced_lift_charts = model.get_all_lift_charts(data_slice_id='data-slice-id')
> 
> # Get lift chart insights for unsliced data
> unsliced_lift_charts = model.get_all_lift_charts(unsliced_only=True)
> 
> # Get all lift chart insights
> all_lift_charts = model.get_all_lift_charts()
> ```

#### get_all_multiclass_lift_charts(fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve a list of all Lift charts available for the model.

- Parameters:
- Returns: Data for all available model lift charts.
- Return type: list of LiftChart

#### get_all_residuals_charts(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all residuals charts available for the model.

- Parameters:
- Returns: Data for all available model residuals charts.
- Return type: list of ResidualsChart

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> 
> # Get residuals chart insights for sliced data
> sliced_residuals_charts = model.get_all_residuals_charts(data_slice_id='data-slice-id')
> 
> # Get residuals chart insights for unsliced data
> unsliced_residuals_charts = model.get_all_residuals_charts(unsliced_only=True)
> 
> # Get all residuals chart insights
> all_residuals_charts = model.get_all_residuals_charts()
> ```

#### get_all_roc_curves(fallback_to_parent_insights=False, data_slice_filter=None)

Retrieve a list of all ROC curves available for the model.

- Parameters:
- Returns: Data for all available model ROC curves. Or an empty list if no RocCurves are found.
- Return type: list of RocCurve

> [!NOTE] Examples
> ```
> model = datarobot.Model.get('project-id', 'model-id')
> ds_filter=DataSlice(id='data-slice-id')
> 
> # Get roc curve insights for sliced data
> sliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get roc curve insights for unsliced data
> data_slice_filter=DataSlice(id=None)
> unsliced_roc = model.get_all_roc_curves(data_slice_filter=ds_filter)
> 
> # Get all roc curve insights
> all_roc_curves = model.get_all_roc_curves()
> ```

#### get_confusion_chart(source, fallback_to_parent_insights=False)

Retrieve a multiclass model’s confusion matrix for the specified source.

- Parameters:
- Returns: Model ConfusionChart data
- Return type: ConfusionChart
- Raises: ClientError – If the insight is not available for this model

#### get_cross_class_accuracy_scores()

Retrieves a list of Cross Class Accuracy scores for the model.

- Return type: json

#### get_cross_validation_scores(partition=None, metric=None)

Return a dictionary, keyed by metric, showing cross validation
scores per partition.

Cross Validation should already have been performed using [cross_validate](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.cross_validate) or [train](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.train).

> [!NOTE] Notes
> Models that computed cross validation before this feature was added will need
> to be deleted and retrained before this method can be used.

- Parameters:
- Returns: cross_validation_scores – A dictionary keyed by metric showing cross validation scores per
  partition.
- Return type: dict

#### get_data_disparity_insights(feature, class_name1, class_name2)

Retrieve a list of Cross Class Data Disparity insights for the model.

- Parameters:
- Return type: json

#### get_fairness_insights(fairness_metrics_set=None, offset=0, limit=100)

Retrieve a list of Per Class Bias insights for the model.

- Parameters:
- Return type: json

#### get_feature_effect(source, data_slice_id=None)

Retrieve Feature Effects for the model.

Feature Effects provides partial dependence and predicted vs. actual values for the top 500
features ordered by feature impact score.

The partial dependence shows the marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the available sources.

- Parameters:
- Returns: feature_effects – The feature effects data.
- Return type: FeatureEffects
- Raises: ClientError – If the feature effects have not been computed or the source is not a valid value.

#### get_feature_effect_metadata()

Retrieve Feature Effects metadata. The response contains status and available model sources.

- Feature Effect for the training partition is always available, with the exception of older
  projects that only supported Feature Effect for validation.
- When a model is trained into validation or holdout without stacked predictions
  (i.e., no out-of-sample predictions in those partitions),
  Feature Effects is not available for validation or holdout.
- Feature Effects for holdout is not available when holdout was not unlocked for
  the project.

Use source to retrieve Feature Effects, selecting one of the provided sources.

- Returns: feature_effect_metadata
- Return type: FeatureEffectMetadata

#### get_feature_effects_multiclass(source='training', class_=None)

Retrieve Feature Effects for the multiclass model.

Feature Effects provide partial dependence and predicted vs. actual values for the top 500
features ordered by feature impact score.

The partial dependence shows the marginal effect of a feature on the target variable after
accounting for the average effects of all other predictive features. It indicates how,
holding all other variables except the feature of interest as they were,
the value of this feature affects your prediction.

Requires that Feature Effects has already been computed with [request_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_effect).

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the available sources.

- Parameters:
- Returns: The list of multiclass feature effects.
- Return type: list
- Raises: ClientError – If Feature Effects have not been computed or the source is not a valid value.

#### get_feature_impact(with_metadata=False, data_slice_filter=)

Retrieve the computed Feature Impact results, a measure of the relevance of each
feature in the model.

Feature Impact is computed for each column by creating new data with that column randomly
permuted (but the others left unchanged) and measuring how the error metric score for the
predictions is affected. The ‘impactUnnormalized’ is how much worse the error metric score
is when making predictions on this modified data. The ‘impactNormalized’ is normalized so
that the largest value is 1. In both cases, larger values indicate more important features.

If a feature is redundant, i.e., once other features are considered it does not
contribute much in addition, the ‘redundantWith’ value is the name of the feature that has the
highest correlation with this feature. Note that redundancy detection is only available for
jobs run after the addition of this feature. When retrieving data that predates this
functionality, a NoRedundancyImpactAvailable warning will be used.

Only the top 1000 features are saved and can be returned.

Elsewhere this technique is sometimes called ‘Permutation Importance’.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Parameters:
- Returns:The feature impact data response depends on the with_metadata parameter. The response is
  either a dict with metadata and a list with the actual data or just a list with that data. Each list item is a dict with the keysfeatureName,impactNormalized,impactUnnormalized,redundantWith, andcount. For the dict response, the available keys are: featureImpacts- Feature Impact data as a dictionary. Each item is a dict with
  : the keys:featureName,impactNormalized,impactUnnormalized, andredundantWith.shapBased- A boolean that indicates whether Feature Impact was calculated using
  : Shapley values.ranRedundancyDetection- A boolean that indicates whether redundant feature
  : identification was run while calculating this Feature Impact.rowCount- An integer or None that indicates the number of rows that were used to
  : calculate Feature Impact. For Feature Impact calculated with the default
    logic without specifying the rowCount, we return None here.count- An integer with the number of features underfeatureImpacts.Return type:listordictRaises:ClientError– If the feature impacts have not been computed.ValueError– If data_slice_filter is passed as None.

#### get_features_used()

Query the server to determine which features were used.

Note that the data returned by this method may differ
from the names of the features in the featurelist used by this model.
This method returns the raw features that must be supplied for
predictions to be generated on a new set of data. The featurelist,
in contrast, also includes the names of derived features.

- Returns: features – The names of the features used in the model.
- Return type: List[str]

#### get_frozen_child_models()

Retrieve the IDs for all models that are frozen from this model.

- Return type: A list of Models

#### get_labelwise_roc_curves(source, fallback_to_parent_insights=False)

Retrieve a list of LabelwiseRocCurve instances for a multilabel model for the given source and all labels.
This method is valid only for multilabel projects. For binary projects, use Model.get_roc_curve API .

Added in version v2.24.

- Parameters:
- Returns: Labelwise ROC Curve instances for source and all labels
- Return type: list of LabelwiseRocCurve
- Raises: ClientError – If the insight is not available for this model

#### get_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve the model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data
- Return type: LiftChart
- Raises:

#### get_missing_report_info()

Retrieve a report on missing training data that can be used to understand missing
values treatment in the model. The report consists of missing values resolutions for
features numeric or categorical features that were part of building the model.

- Returns: The queried model missing report, sorted by missing count (DESCENDING order).
- Return type: An iterable of MissingReportPerFeature

#### get_model_blueprint_chart()

Retrieve a diagram that can be used to understand
data flow in the blueprint.

- Returns: The queried model blueprint chart.
- Return type: ModelBlueprintChart

#### get_model_blueprint_documents()

Get documentation for tasks used in this model.

- Returns: All documents available for the model.
- Return type: list of BlueprintTaskDocument

#### get_model_blueprint_json()

Get the blueprint json representation used by this model.

- Returns: Json representation of the blueprint stages.
- Return type: BlueprintJson

#### get_multiclass_feature_impact()

For multiclass models, feature impact can be calculated separately for each target class.
The method of calculation is the same, computed in one-vs-all style for each
target class.

Requires that Feature Impact has already been computed with [request_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.request_feature_impact).

- Returns: feature_impacts – The feature impact data. Each item is a dict with the keys ‘featureImpacts’ (list),
  ‘class’ (str). Each item in ‘featureImpacts’ is a dict with the keys ‘featureName’,
  ‘impactNormalized’, ‘impactUnnormalized’, and ‘redundantWith’.
- Return type: list of dict
- Raises: ClientError – If the multiclass feature impacts have not been computed.

#### get_multiclass_lift_chart(source, fallback_to_parent_insights=False, data_slice_filter=, target_class=None)

Retrieve model Lift chart for the specified source.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_multilabel_lift_charts(source, fallback_to_parent_insights=False)

Retrieve model Lift charts for the specified source.

Added in version v2.24.

- Parameters:
- Returns: Model lift chart data for each saved target class
- Return type: list of LiftChart
- Raises: ClientError – If the insight is not available for this model

#### get_num_iterations_trained()

Retrieve the number of estimators trained by early-stopping tree-based models.

Added in version v2.22.

- Returns:

#### get_or_request_feature_effect(source, max_wait=600, row_count=None, data_slice_id=None)

Retrieve Feature Effects for the model, requesting a new job if it has not been run previously.

See [get_feature_effect_metadata](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect_metadata) for retrieving information on the source.

- Parameters:
- Returns: feature_effects – The Feature Effects data.
- Return type: FeatureEffects

#### get_or_request_feature_effects_multiclass(source, top_n_features=None, features=None, row_count=None, class_=None, max_wait=600)

Retrieve Feature Effects for the multiclass model, requesting a job if it has not been run
previously.

- Parameters:
- Returns: feature_effects – The list of multiclass feature effects data.
- Return type: list of FeatureEffectsMulticlass

#### get_or_request_feature_impact(max_wait=600, **kwargs)

Retrieve feature impact for the model, requesting a job if it has not been run previously.

Only the top 1000 features are saved and can be returned.

- Parameters:
- Returns: feature_impacts – The feature impact data. See get_feature_impact for the exact
  schema.
- Return type: list or dict

#### get_parameters()

Retrieve the model parameters.

- Returns: The model parameters for this model.
- Return type: ModelParameters

#### get_pareto_front()

Retrieve the Pareto Front for a Eureqa model.

This method is only supported for Eureqa models.

- Returns: Model ParetoFront data
- Return type: ParetoFront

#### get_prime_eligibility()

Check whether this model can be approximated with DataRobot Prime.

- Returns: prime_eligibility – A dict indicating whether the model can be approximated with DataRobot Prime
  (key can_make_prime) and why it may be ineligible (key message).
- Return type: dict

#### get_residuals_chart(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve model residuals chart for the specified source.

- Parameters:
- Returns: Model residuals chart data
- Return type: ResidualsChart
- Raises:

#### get_roc_curve(source, fallback_to_parent_insights=False, data_slice_filter=)

Retrieve the ROC curve for a binary model for the specified source.
This method is valid only for binary projects. For multilabel projects, use
Model.get_labelwise_roc_curves.

- Parameters:
- Returns: Model ROC curve data
- Return type: RocCurve
- Raises:

#### get_rulesets()

List the rulesets that approximate this model, generated by DataRobot Prime.

If this model has not been approximated yet, returns an empty list. Note that these
are rulesets that approximate this model, not rulesets used to construct this model.

- Returns: rulesets
- Return type: list of Ruleset

#### get_supported_capabilities()

Retrieve a summary of the capabilities supported by a model.

Added in version v2.14.

- Returns:

#### get_uri()

Return the permanent static hyperlink to this model on the leaderboard.

- Returns: url – The permanent static hyperlink to this model on the leaderboard.
- Return type: str

#### get_word_cloud(exclude_stop_words=False)

Retrieve word cloud data for the model.

- Parameters: exclude_stop_words ( Optional[bool] ) – Set to True if you want stopwords filtered out of response.
- Returns: Word cloud data for the model.
- Return type: WordCloud

#### incremental_train(data_stage_id, training_data_name=None)

Submit a job to the queue to perform incremental training on an existing model.
See the train_incremental documentation.

- Return type: ModelJob

#### classmethod list(project_id, sort_by_partition='validation', sort_by_metric=None, with_metric=None, search_term=None, featurelists=None, families=None, blueprints=None, labels=None, characteristics=None, training_filters=None, number_of_clusters=None, limit=100, offset=0)

Retrieve paginated model records, sorted by scores, with optional filtering.

- Parameters:
- Returns: generic_models
- Return type: list of GenericModel

#### open_in_browser()

Opens class’ relevant web browser location.
If default browser is not available the URL is logged.

Note:
If text-mode browsers are used, the calling process will block
until the user exits the browser.

- Return type: None

#### request_approximation()

Request an approximation of this model using DataRobot Prime.

This creates several rulesets that can be used to approximate this model. After
comparing their scores and rule counts, the code used in the approximation can be downloaded
and run locally.

- Returns: job – The job that generates the rulesets.
- Return type: Job

#### request_cross_class_accuracy_scores()

Request data disparity insights to be computed for the model.

- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_data_disparity_insights(feature, compared_class_names)

Request data disparity insights to be computed for the model.

- Parameters:
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_external_test(dataset_id, actual_value_column=None)

Request an external test to compute scores and insights on an external test dataset.

- Parameters:
- Returns: job – A job representing external dataset insights computation.
- Return type: Job

#### request_fairness_insights(fairness_metrics_set=None)

Request fairness insights to be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – Can be one of .
  The fairness metric used to calculate the fairness scores.
- Returns: status_id – A statusId of computation request.
- Return type: str

#### request_feature_effect(row_count=None, data_slice_id=None)

Submit a request to compute Feature Effects for the model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effect) for more
information on the result of the job.

- Parameters:
- Returns: job – A job representing the feature effect computation. To get the completed feature effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job
- Raises: JobAlreadyRequested – If the feature effects have already been requested.

#### request_feature_effects_multiclass(row_count=None, top_n_features=None, features=None)

Request Feature Effects computation for the multiclass model.

See [get_feature_effect](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_effects_multiclass) for
more information on the result of the job.

- Parameters:
- Returns: job – A job representing Feature Effect computation. To get the completed Feature Effect
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job

#### request_feature_impact(row_count=None, with_metadata=False, data_slice_id=None)

Request that feature impacts be computed for the model.

See [get_feature_impact](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model.get_feature_impact) for more
information on the result of the job.

- Parameters:
- Returns: job – A job representing the Feature Impact computation. To retrieve the completed Feature Impact
  data, use job.get_result or job.get_result_when_complete.
- Return type: Job or status_id
- Raises: JobAlreadyRequested – If the feature impacts have already been requested.

#### request_frozen_datetime_model(training_row_count=None, training_duration=None, training_start_date=None, training_end_date=None, time_window_sample_pct=None, sampling_method=None)

Train a new frozen model with parameters from this model.

Requires that this model belongs to a datetime partitioned project. If it does not, an
error will occur when submitting the job.

Frozen models use the same tuning parameters as their parent model instead of independently
optimizing them to allow efficiently retraining models on larger amounts of the training
data.

In addition to training_row_count and training_duration, frozen datetime models may be
trained on an exact date range. Only one of training_row_count, training_duration, or
training_start_date and training_end_date should be specified.

Models specified using training_start_date and training_end_date are the only ones that can
be trained into the holdout data (once the holdout is unlocked).

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: model_job – The modeling job that trains a frozen model.
- Return type: ModelJob

#### request_frozen_model(sample_pct=None, training_row_count=None)

Train a new frozen model with parameters from this model.

> [!NOTE] Notes
> This method only works if the project the model belongs to is not datetime
> partitioned. If it is, use `request_frozen_datetime_model` instead.
> 
> Frozen models use the same tuning parameters as their parent model instead of independently
> optimizing them to allow efficiently retraining models on larger amounts of the training
> data.

- Parameters:
- Returns: model_job – The modeling job that trains a frozen model.
- Return type: ModelJob

#### request_lift_chart(source, data_slice_id=None)

Request the model Lift Chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_per_class_fairness_insights(fairness_metrics_set=None)

Request per-class fairness insights be computed for the model.

- Parameters: fairness_metrics_set ( Optional[str] ) – The fairness metric used to calculate the fairness scores.
  Value can be any one of .
- Returns: status_check_job – The returned object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_predictions(dataset_id=None, dataset=None, dataframe=None, file_path=None, file=None, include_prediction_intervals=None, prediction_intervals_size=None, forecast_point=None, predictions_start_date=None, predictions_end_date=None, actual_value_column=None, explanation_algorithm=None, max_explanations=None, max_ngram_explanations=None)

Request predictions against a previously uploaded dataset.

- Parameters:
- Returns: job – The job computing the predictions.
- Return type: PredictJob

#### request_residuals_chart(source, data_slice_id=None)

Request the model residuals chart for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_roc_curve(source, data_slice_id=None)

Request the model Roc Curve for the specified source.

- Parameters:
- Returns: status_check_job – Object contains all needed logic for a periodical status check of an async job.
- Return type: StatusCheckJob

#### request_training_predictions(data_subset, explanation_algorithm=None, max_explanations=None)

Start a job to build training predictions

- Parameters:

#### retrain(sample_pct=None, featurelist_id=None, training_row_count=None, n_clusters=None)

Submit a job to the queue to train a blender model.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### set_prediction_threshold(threshold)

Set a custom prediction threshold for the model.

May not be used once `prediction_threshold_read_only` is True for this model.

- Parameters: threshold ( float ) – only used for binary classification projects. The threshold to when deciding between
  the positive and negative classes when making predictions.  Should be between 0.0 and
  1.0 (inclusive).

#### star_model()

Mark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

#### start_advanced_tuning_session(grid_search_arguments=None)

Start an Advanced Tuning session.  Returns an object that helps
set up arguments for an Advanced Tuning model execution.

As of v2.17, all models other than blenders, open source, prime, baseline and
user-created support Advanced Tuning.

- Parameters: grid_search_arguments ( GridSearchArguments ) – Grid search arguments
- Returns: Session for setting up and running Advanced Tuning on a model
- Return type: AdvancedTuningSession

#### start_incremental_learning_from_sample(early_stopping_rounds=None, first_iteration_only=False, chunk_definition_id=None)

Submit a job to the queue to perform the first incremental learning iteration training on an existing
sample model. This functionality requires the SAMPLE_DATA_TO_START_PROJECT feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### train(sample_pct=None, featurelist_id=None, scoring_type=None, training_row_count=None, monotonic_increasing_featurelist_id=, monotonic_decreasing_featurelist_id=)

Train the blueprint used in the model on a particular featurelist or amount of data.

This method creates a new training job for the worker and appends it to
the end of the queue for this project.
After the job has finished, you can get the newly trained model by retrieving
it from the project leaderboard or by retrieving the result of the job.

Either sample_pct or training_row_count can be used to specify the amount of data to
use, but not both. If neither is specified, a default of the maximum amount of data that
can safely be used to train any blueprint without using the validation data will be
selected.

In smart-sampled projects, sample_pct and training_row_count are assumed to be in terms
of rows of the minority class.

> [!NOTE] Notes
> For datetime partitioned projects, see [train_datetime](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.DatetimeModel.train_datetime) instead.

- Parameters:
- Returns: model_job_id – The ID of the created job; can be used as a parameter to ModelJob.get or the wait_for_async_model_creation function.
- Return type: str

> [!NOTE] Examples
> ```
> project = Project.get('project-id')
> model = Model.get('project-id', 'model-id')
> model_job_id = model.train(training_row_count=project.max_train_rows)
> ```

#### train_datetime(featurelist_id=None, training_row_count=None, training_duration=None, time_window_sample_pct=None, monotonic_increasing_featurelist_id=, monotonic_decreasing_featurelist_id=, use_project_settings=False, sampling_method=None, n_clusters=None)

Train this model on a different featurelist or sample size.

Requires that this model is part of a datetime partitioned project; otherwise, an error will
occur.

All durations should be specified with a duration string such as those returned
by the [partitioning_methods.construct_duration_string](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#datarobot.helpers.partitioning_methods.construct_duration_string) helper method.
Please see [datetime partitioned project documentation](https://docs.datarobot.com/en/docs/api/dev-learning/python/modeling/spec/datetime_partition.html#date-dur-spec) for more information on duration strings.

- Parameters:
- Returns: job – The created job to build the model.
- Return type: ModelJob

#### train_incremental(data_stage_id, training_data_name=None, data_stage_encoding=None, data_stage_delimiter=None, data_stage_compression=None)

Submit a job to the queue to perform incremental training on an existing model using
additional data. The ID of the additional data to use for training is specified with `data_stage_id`.
Optionally, a name for the iteration can be supplied by the user to help identify the contents of the data in
the iteration.

This functionality requires the INCREMENTAL_LEARNING feature flag to be enabled.

- Parameters:
- Returns: job – The created job that is retraining the model.
- Return type: ModelJob

#### unstar_model()

Unmark the model as starred.

Model stars propagate to the web application and the API, and can be used to filter when
listing models.

- Return type: None

## Clustering

### class datarobot.models.ClusteringModel

ClusteringModel extends [Model](https://docs.datarobot.com/en/docs/api/reference/sdk/datarobot-models.html#datarobot.models.Model) class.
It provides provides properties and methods specific to clustering projects.

#### compute_insights(max_wait=600)

Compute and retrieve cluster insights for model. This method awaits completion of
job computing cluster insights and returns results after it is finished. If computation
takes longer than specified `max_wait` exception will be raised.

- Parameters:
- Return type: List of ClusterInsight
- Raises:

#### property insights : List[ClusterInsight]

Return actual list of cluster insights if already computed.

- Return type: List of ClusterInsight

#### property clusters : List[Cluster]

Return actual list of Clusters.

- Return type: List of Cluster

#### update_cluster_names(cluster_name_mappings)

Change many cluster names at once based on list of name mappings.

- Parameters:cluster_name_mappings(Listoftuples) – Cluster names mapping consisting of current cluster name and old cluster name.
Example: cluster_name_mappings=[("current cluster name 1","new cluster name 1"),("current cluster name 2","new cluster name 2")] * Return type: List of Cluster * Raises: datarobot.errors.ClientError – Server rejected update of cluster names.
    Possible reasons include: incorrect format of mapping, mapping introduces duplicates.

#### update_cluster_name(current_name, new_name)

Change cluster name from current_name to new_name.

- Parameters:
- Return type: List of Cluster
- Raises: datarobot.errors.ClientError – Server rejected update of cluster names.

### class datarobot.models.cluster.Cluster

Representation of a single cluster.

- Variables:

#### classmethod list(project_id, model_id)

Retrieve a list of clusters in the model.

- Parameters:
- Return type: List of clusters

#### classmethod update_multiple_names(project_id, model_id, cluster_name_mappings)

Update many clusters at once based on list of name mappings.

- Parameters:

#### classmethod update_name(project_id, model_id, current_name, new_name)

Change cluster name from current_name to new_name

- Parameters:
- Return type: List of Cluster

### class datarobot.models.cluster_insight.ClusterInsight

Holds data on all insights related to feature as well as breakdown per cluster.

- Parameters:

#### classmethod compute(project_id, model_id, max_wait=600)

Starts creation of cluster insights for the model and if successful, returns computed
ClusterInsights. This method allows calculation to continue for a specified time and
if not complete, cancels the request.

- Parameters:
- Return type: List[ClusterInsight]
- Raises:

## Pareto front

### class datarobot.models.pareto_front.ParetoFront

Pareto front data for a Eureqa model.

The pareto front reflects the tradeoffs between error and complexity for particular model. The
solutions reflect possible Eureqa models that are different levels of complexity.  By default,
only one solution will have a corresponding model, but models can be created for each solution.

- Variables:

#### classmethod from_server_data(data, keep_attrs=None)

Instantiate an object of this class using the data directly from the server,
meaning that the keys may have the wrong camel casing

- Parameters:

### class datarobot.models.pareto_front.Solution

Eureqa Solution.

A solution represents a possible Eureqa model; however not all solutions
have models associated with them.  It must have a model created before
it can be used to make predictions, etc.

- Variables:

#### create_model()

Add this solution to the leaderboard, if it is not already present.

## Combined models

See API reference for Combined Model in [Segmented Modeling API Reference](https://docs.datarobot.com/en/docs/api/reference/sdk/projects.html#segmented-modeling-api)

## Advanced tuning

### class datarobot.models.advanced_tuning.AdvancedTuningSession

A session enabling users to configure and run advanced tuning for a model.

Every model contains a set of one or more tasks.  Every task contains a set of
zero or more parameters.  This class allows tuning the values of each parameter
on each task of a model, before running that model.

This session is client-side only and is not persistent.
Only the final model, constructed when run is called, is persisted on the DataRobot server.

- Variables: description ( str ) – Description for the new advance-tuned model.
  Defaults to the same description as the base model.

#### get_task_names()

Get the list of task names that are available for this model

- Returns: List of task names
- Return type: list(str)

#### get_parameter_names(task_name)

Get the list of parameter names available for a specific task

- Returns: List of parameter names
- Return type: list(str)

#### set_parameter(value, task_name=None, parameter_name=None, parameter_id=None)

Set the value of a parameter to be used

The caller must supply enough of the optional arguments to this function
to uniquely identify the parameter that is being set.
For example, a less-common parameter name such as
‘building_block__complementary_error_function’ might only be used once (if at all)
by a single task in a model.  In which case it may be sufficient to simply specify
‘parameter_name’.  But a more-common name such as ‘random_seed’ might be used by
several of the model’s tasks, and it may be necessary to also specify ‘task_name’
to clarify which task’s random seed is to be set.
This function only affects client-side state. It will not check that the new parameter
value(s) are valid.

- Parameters:
- Raises:
- Return type: None

#### get_parameters()

Returns the set of parameters available to this model

The returned parameters have one additional key, “value”, reflecting any new values that
have been set in this AdvancedTuningSession.  When the session is run, “value” will be used,
or if it is unset, “current_value”.

- Return type: AdvancedTuningParamsType
- Returns:

#### run()

Submit this model for Advanced Tuning.

- Returns: The created job to build the model
- Return type: datarobot.models.modeljob.ModelJob

### class datarobot.models.advanced_tuning.GridSearchArguments

Grid search arguments

- Variables:

#### to_api_payload()

Convert the GridSearchArguments to an API payload

- Return type: Dict [ str , Any ]

## Recommended models

### class datarobot.models.ModelRecommendation

A collection of information about a recommended model for a project.

- Variables:

#### classmethod get(project_id, recommendation_type=None)

Retrieves the default or specified by recommendation_type recommendation.

- Parameters:
- Returns: recommended_model
- Return type: ModelRecommendation

#### classmethod get_all(project_id)

Retrieves all of the current recommended models for the project.

- Parameters: project_id ( str ) – The project’s id.
- Returns: recommended_models
- Return type: list of ModelRecommendation

#### classmethod get_recommendation(recommended_models, recommendation_type)

Returns the model in the given list with the requested type.

- Parameters:
- Returns: recommended_model
- Return type: ModelRecommendation or None if no model with the requested type exists

#### get_model()

Returns the Model associated with this ModelRecommendation.

- Returns: recommended_model
- Return type: Model or DatetimeModel if the project is datetime-partitioned

## Class mapping aggregation settings

For multiclass projects with a lot of unique values in target column you can
specify the parameters for aggregation of rare values to improve the modeling
performance and decrease the runtime and resource usage of resulting models.

### class datarobot.helpers.ClassMappingAggregationSettings

Class mapping aggregation settings.
For multiclass projects allows fine control over which target values will be
preserved as classes. Classes which aren’t preserved will be
- aggregated into a single “catch everything else” class in case of multiclass
- or will be ignored in case of multilabel.
All attributes are optional, if not specified - server side defaults will be used.

- Variables:

## Model jobs

### datarobot.models.modeljob.wait_for_async_model_creation(project_id, model_job_id, max_wait=600)

Given a Project id and ModelJob id poll for status of process
responsible for model creation until model is created.

- Parameters:
- Returns: model – Newly created model
- Return type: Model
- Raises:

### class datarobot.models.ModelJob

Tracks asynchronous work being done within a project

- Variables:

#### classmethod from_job(job)

Transforms a generic Job into a ModelJob

- Parameters: job ( Job ) – A generic job representing a ModelJob
- Returns: model_job – A fully populated ModelJob with all the details of the job
- Return type: ModelJob
- Raises: ValueError: – If the generic Job was not a model job, e.g., job_type != JOB_TYPE.MODEL

#### classmethod get(project_id, model_job_id)

Fetches one ModelJob. If the job finished, raises PendingJobFinished
exception.

- Parameters:
- Returns: model_job – The pending ModelJob
- Return type: ModelJob
- Raises:

#### classmethod get_model(project_id, model_job_id)

Fetches a finished model from the job used to create it.

- Parameters:
- Returns: model – The finished model
- Return type: Model
- Raises:

#### cancel()

Cancel this job. If this job has not finished running, it will be
removed and canceled.

#### get_result(params=None)

- Parameters: params ( dict or None ) – Query parameters to be added to request to get results.

> [!NOTE] Notes
> For featureEffects, source param is required to define source,
> otherwise the default is training.

- Returns:result– Return type depends on the job type
: - for model jobs, a Model is returned
  - for predict jobs, a pandas.DataFrame (with predictions) is returned
  - for featureImpact jobs, a list of dicts by default (seewith_metadataparameter of theFeatureImpactJobclass and itsget()method).
  - for primeRulesets jobs, a list of Rulesets
  - for primeModel jobs, a PrimeModel
  - for primeDownloadValidation jobs, a PrimeFile
  - for predictionExplanationInitialization jobs, a PredictionExplanationsInitialization
  - for predictionExplanations jobs, a PredictionExplanations
  - for featureEffects, a FeatureEffects.
*Return type:object*Raises:*JobNotFinished– If the job is not finished, the result is not available.
*AsyncProcessUnsuccessfulError– If the job errored or was aborted

#### get_result_when_complete(max_wait=600, params=None)

- Parameters:
- Returns: result – Return type is the same as would be returned by Job.get_result.
- Return type: object
- Raises:

#### refresh()

Update this object with the latest job data from the server.

#### wait_for_completion(max_wait=600)

Waits for job to complete.

- Parameters: max_wait ( Optional[int] ) – How long to wait for the job to finish.
- Return type: None

## Registry jobs

### class datarobot.models.registry.job.Job

A DataRobot job.

Added in version v3.4.

- Variables:

#### classmethod create(name, environment_id=None, environment_version_id=None, folder_path=None, files=None, file_data=None, runtime_parameter_values=None)

Create a job.

Added in version v3.4.

- Parameters:
- Returns: created job
- Return type: Job
- Raises:

#### classmethod list()

List jobs.

Added in version v3.4.

- Returns: a list of jobs
- Return type: List[Job]
- Raises:

#### classmethod get(job_id)

Get job by id.

Added in version v3.4.

- Parameters: job_id ( str ) – The ID of the job.
- Returns: retrieved job
- Return type: Job
- Raises:

#### update(name=None, entry_point=None, environment_id=None, environment_version_id=None, description=None, folder_path=None, files=None, file_data=None, runtime_parameter_values=None, runtime_parameters=None)

Update job properties.

Added in version v3.4.

- Parameters:
- Raises:
- Return type: None

#### delete()

Delete job.

Added in version v3.4.

- Raises:
- Return type: None

#### refresh()

Update job with the latest data from server.

Added in version v3.4.

- Raises:
- Return type: None

#### classmethod create_from_custom_metric_gallery_template(template_id, name, description=None, sidecar_deployment_id=None)

Create a job from a custom metric gallery template.

- Parameters:
- Returns: retrieved job
- Return type: Job
- Raises:

#### list_schedules()

List schedules for the job.

- Returns: a list of schedules for the job.
- Return type: List[JobSchedule]

### class datarobot.models.registry.job.JobFileItem

A file item attached to a DataRobot job.

Added in version v3.4.

- Variables:

### class datarobot.models.registry.job_run.JobRun

A DataRobot job run.

Added in version v3.4.

- Variables:

#### classmethod create(job_id, max_wait=600, runtime_parameter_values=None)

Create a job run.

Added in version v3.4.

- Parameters:
- Returns: created job
- Return type: Job
- Raises:

#### classmethod list(job_id)

List job runs.

Added in version v3.4.

- Parameters: job_id ( str ) – The ID of the job.
- Returns: A list of job runs.
- Return type: List[Job]
- Raises:

#### classmethod get(job_id, job_run_id)

Get job run by id.

Added in version v3.4.

- Parameters:
- Returns: The retrieved job run.
- Return type: Job
- Raises:

#### update(description=None)

Update job run properties.

Added in version v3.4.

- Parameters: description ( str ) – new job run description
- Raises:
- Return type: None

#### cancel()

Cancel job run.

Added in version v3.4.

- Raises:
- Return type: None

#### refresh()

Update job run with the latest data from server.

Added in version v3.4.

- Raises:
- Return type: None

#### get_logs()

Get log of the job run.

Added in version v3.4.

- Raises:
- Return type: Optional [ str ]

#### delete_logs()

Get log of the job run.

Added in version v3.4.

- Raises:
- Return type: None

### class datarobot.models.registry.job_run.JobRunStatus

Enum of the job run statuses

### class datarobot.models.registry.job.JobSchedule

A job schedule.

Added in version v3.5.

- Variables:

#### update(schedule=None, parameter_overrides=None)

Update the job schedule.

- Parameters:
- Return type: JobSchedule

#### delete()

Delete the job schedule.
:rtype: `None`

#### classmethod create(custom_job_id, schedule, parameter_overrides=None)

Create a job schedule.

- Parameters:
- Return type: JobSchedule

## Missing values report

### class datarobot.models.missing_report.MissingValuesReport

Missing values report for model, contains list of reports per feature sorted by missing
count in descending order.

> [!NOTE] Notes
> `Report per feature` contains:
> 
> feature
> : feature name.
> type
> : feature type – ‘Numeric’ or ‘Categorical’.
> missing_count
> :  missing values count in training data.
> missing_percentage
> : missing values percentage in training data.
> tasks
> : list of information per each task, which was applied to feature.
> 
> `task information` contains:
> 
> id
> : a number of task in the blueprint diagram.
> name
> : task name.
> descriptions
> : human readable aggregated information about how the task handles
>   missing values.  The following descriptions may be present: what value is imputed for
>   missing values, whether the feature being missing is treated as a feature by the task,
>   whether missing values are treated as infrequent values,
>   whether infrequent values are treated as missing values,
>   and whether missing values are ignored.

#### classmethod get(project_id, model_id)

Retrieve a missing report.

- Parameters:
- Returns: The queried missing report.
- Return type: MissingValuesReport

## Registered models

### class datarobot.models.RegisteredModel

A registered model is a logical grouping of model packages (versions) that are related to each other.

- Variables:

#### classmethod get(registered_model_id)

Get a registered model by ID.

- Parameters: registered_model_id ( str ) – ID of the registered model to retrieve
- Returns: registered_model – Registered Model Object
- Return type: RegisteredModel

> [!NOTE] Examples
> ```
> from datarobot import RegisteredModel
> registered_model = RegisteredModel.get(registered_model_id='5c939e08962d741e34f609f0')
> registered_model.id
> >>>'5c939e08962d741e34f609f0'
> registered_model.name
> >>>'My Registered Model'
> ```

#### classmethod list(limit=100, offset=None, sort_key=None, sort_direction=None, search=None, filters=None)

List all registered models a user can view.

- Parameters:
- Returns: registered_models – A list of registered models user can view.
- Return type: List[RegisteredModel]

> [!NOTE] Examples
> ```
> from datarobot import RegisteredModel
> registered_models = RegisteredModel.list()
> >>> [RegisteredModel('My Registered Model'), RegisteredModel('My Other Registered Model')]
> ```
> 
> ```
> from datarobot import RegisteredModel
> from datarobot.models.model_registry import RegisteredModelListFilters
> from datarobot.enums import RegisteredModelSortKey, RegisteredModelSortDirection
> filters = RegisteredModelListFilters(target_type='Regression')
> registered_models = RegisteredModel.list(
>     filters=filters,
>     sort_key=RegisteredModelSortKey.NAME.value,
>     sort_direction=RegisteredModelSortDirection.DESC.value
>     search='other')
> >>> [RegisteredModel('My Other Registered Model')]
> ```

#### classmethod archive(registered_model_id)

Permanently archive a registered model and all of its versions.

- Parameters: registered_model_id ( str ) – ID of the registered model to be archived
- Return type: None

#### classmethod update(registered_model_id, name)

Update the name of a registered model.

- Parameters:
- Returns: registered_model – Updated registered model object
- Return type: RegisteredModel

#### get_shared_roles(offset=None, limit=None, id=None)

Retrieve access control information for this registered model.

- Parameters:
- Return type: List [ SharingRole ]

#### share(roles)

Share this registered model or remove access from one or more user(s).

- Parameters: roles ( List[SharingRole] ) – A list of SharingRole instances, each of which
  references a user and a role to be assigned.
- Return type: None

> [!NOTE] Examples
> ```
> >>> from datarobot import RegisteredModel, SharingRole
> >>> from datarobot.enums import SHARING_ROLE, SHARING_RECIPIENT_TYPE
> >>> registered_model = RegisteredModel.get('5c939e08962d741e34f609f0')
> >>> sharing_role = SharingRole(
> ...    role=SHARING_ROLE.CONSUMER,
> ...    share_recipient_type=SHARING_RECIPIENT_TYPE.USER,
> ...    username='jim.bob@datarobot.com'
> ...    )
> >>> registered_model.share(roles=[sharing_role])
> ```

#### get_version(version_id)

Retrieve a registered model version.

- Parameters: version_id ( str ) – The ID of the registered model version to retrieve.
- Returns: registered_model_version – A registered model version object.
- Return type: RegisteredModelVersion

> [!NOTE] Examples
> ```
> from datarobot import RegisteredModel
> registered_model = RegisteredModel.get('5c939e08962d741e34f609f0')
> registered_model_version = registered_model.get_version('5c939e08962d741e34f609f0')
> >>> RegisteredModelVersion('My Registered Model Version')
> ```

#### list_versions(filters=None, search=None, sort_key=None, sort_direction=None, limit=None, offset=None)

Retrieve a list of registered model versions.

- Parameters:
- Returns: registered_model_versions – A list of registered model version objects.
- Return type: List[RegisteredModelVersion]

> [!NOTE] Examples
> ```
> from datarobot import RegisteredModel
> from datarobot.models.model_registry import RegisteredModelVersionsListFilters
> from datarobot.enums import RegisteredModelSortKey, RegisteredModelSortDirection
> registered_model = RegisteredModel.get('5c939e08962d741e34f609f0')
> filters = RegisteredModelVersionsListFilters(tags=['tag1', 'tag2'])
> registered_model_versions = registered_model.list_versions(filters=filters)
> >>> [RegisteredModelVersion('My Registered Model Version')]
> ```

#### list_associated_deployments(search=None, sort_key=None, sort_direction=None, limit=None, offset=None)

Retrieve a list of deployments associated with this registered model.

- Parameters:
- Returns: deployments – A list of deployments associated with this registered model.
- Return type: List[VersionAssociatedDeployment]

### class datarobot.models.RegisteredModelVersion

Represents a version of a registered model.

- Parameters:

#### classmethod create_for_leaderboard_item(model_id, name=None, prediction_threshold=None, distribution_prediction_model_id=None, description=None, compute_all_ts_intervals=None, registered_model_name=None, registered_model_id=None, tags=None, registered_model_tags=None, registered_model_description=None)

- Parameters:
- Returns: regitered_model_version – A new registered model version object.
- Return type: RegisteredModelVersion

#### classmethod create_for_external(name, target, model_id=None, model_description=None, datasets=None, timeseries=None, registered_model_name=None, registered_model_id=None, tags=None, registered_model_tags=None, registered_model_description=None, geospatial_monitoring=None)

Create a new registered model version from an external model.

- Parameters:
- Returns: registered_model_version – A new registered model version object.
- Return type: RegisteredModelVersion

#### classmethod create_for_custom_model_version(custom_model_version_id, name=None, description=None, registered_model_name=None, registered_model_id=None, tags=None, registered_model_tags=None, registered_model_description=None)

Create a new registered model version from a custom model version.

- Parameters:
- Returns: registered_model_version – A new registered model version object.
- Return type: RegisteredModelVersion

#### list_associated_deployments(search=None, sort_key=None, sort_direction=None, limit=None, offset=None)

Retrieve a list of deployments associated with this registered model version.

- Parameters:
- Returns: deployments – A list of deployments associated with this registered model version.
- Return type: List[VersionAssociatedDeployment]

### class datarobot.models.model_registry.deployment.VersionAssociatedDeployment

Represents a deployment associated with a registered model version.

- Parameters:

### class datarobot.models.model_registry.RegisteredModelVersionsListFilters

Filters for listing of registered model versions.

- Parameters:

### class datarobot.models.model_registry.RegisteredModelListFilters

Filters for listing registered models.

- Parameters:

## Rulesets

### class datarobot.models.Ruleset

Represents an approximation of a model with DataRobot Prime

- Variables:

#### request_model()

Request training for a model using this ruleset

Training a model using a ruleset is a necessary prerequisite for being able to download
the code for a ruleset.

- Returns: job – the job fitting the new Prime model
- Return type: Job

---
