# Insights
URL: https://docs.datarobot.com/en/docs/api/reference/sdk/insights.html

# Insights

## Model Performance Insights

### class datarobot.insights.RocCurve

Class for ROC Curve calculations. Use the standard methods of BaseInsight to compute
and retrieve: compute, create, list, get.

Usage example:

> ``pythonfrom datarobot.insights import RocCurve
> RocCurve.compute("67643b2d87bb4954d7917323", data_slice_id="6764389b4bdd48581485a58b")RocCurve.get("67643b2d87bb4954d7917323", data_slice_id="6764389b4bdd48581485a58b")RocCurve.list("67643b2d87bb4954d7917323")
> [, ...]
> RocCurve.list("67643b2d87bb4954d7917323")[0].roc_points
> [{'accuracy': 0.539375, 'f1_score': 0.0, 'false_negative_score': 737, 'true_negative_score': 863, ...}]
> ``

#### property kolmogorov_smirnov_metric : float

Kolmogorov-Smirnov metric for the ROC curve values

#### property auc : float

AUC metric for the ROC curve values

#### property positive_class_predictions : List[float]

List of positive class prediction values for the ROC curve

#### property negative_class_predictions : List[float]

List of negative class prediction values for the ROC curve

#### property roc_points : List[Dict[str, int | float]]

List of ROC values for the ROC curve

#### classmethod compute(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, **kwargs)

Submit an insight compute request. You can use create if you want to
wait synchronously for the completion of the job. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Status check job entity for the asynchronous insight calculation.
- Return type: StatusCheckJob

#### classmethod create(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, max_wait=600, **kwargs)

Create an insight and wait for completion. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Entity of the newly or already computed insights.
- Return type: Self

#### 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 from_server_data to handle paginated responses

- Return type: Self

#### classmethod get(entity_id, source=INSIGHTS_SOURCES.VALIDATION, quick_compute=None, **kwargs)

Return the first matching insight based on the entity id and kwargs.

- Parameters:
- Returns: Previously computed insight.
- Return type: Self

#### get_uri()

This should define the URI to their browser based interactions

- Return type: str

#### classmethod list(entity_id)

List all generated insights.

- Parameters: entity_id ( str ) – The ID of the entity queried for listing all generated insights.
- Returns: List of newly or previously computed insights.
- Return type: List[Self]

#### 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

#### sort(key_name)

Sorts insights data

- Return type: None

### class datarobot.insights.LiftChart

Class for Lift Chart calculations. Use the standard methods of BaseInsight to compute
and retrieve: compute, create, list, get.

Usage example:

> ``pythonfrom datarobot.insights import LiftChart
> LiftChart.compute("67643b2d87bb4954d7917323", data_slice_id="6764389b4bdd48581485a58b")LiftChart.list("67643b2d87bb4954d7917323")
> [, ... ]
> LiftChart.get("67643b2d87bb4954d7917323", data_slice_id="6764389b4bdd48581485a58b").bins
> [{'actual': 0.4, 'predicted': 0.22727272727272724, 'bin_weight': 5.0}, ... ]
> ``

#### property bins : List[Dict[str, Any]]

Lift chart bins.

#### classmethod compute(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, **kwargs)

Submit an insight compute request. You can use create if you want to
wait synchronously for the completion of the job. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Status check job entity for the asynchronous insight calculation.
- Return type: StatusCheckJob

#### classmethod create(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, max_wait=600, **kwargs)

Create an insight and wait for completion. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Entity of the newly or already computed insights.
- Return type: Self

#### 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 from_server_data to handle paginated responses

- Return type: Self

#### classmethod get(entity_id, source=INSIGHTS_SOURCES.VALIDATION, quick_compute=None, **kwargs)

Return the first matching insight based on the entity id and kwargs.

- Parameters:
- Returns: Previously computed insight.
- Return type: Self

#### get_uri()

This should define the URI to their browser based interactions

- Return type: str

#### classmethod list(entity_id)

List all generated insights.

- Parameters: entity_id ( str ) – The ID of the entity queried for listing all generated insights.
- Returns: List of newly or previously computed insights.
- Return type: List[Self]

#### 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

#### sort(key_name)

Sorts insights data

- Return type: None

### class datarobot.insights.Residuals

Class for Residuals calculations. Use the standard methods of BaseInsight to compute
and retrieve: compute, create, list, get.

Usage example:

> ``pythonfrom datarobot.insights import Residuals
> Residuals.list("672e32de69b0b676ced54d9c")
> []
> Residuals.compute("672e32de69b0b676ced54d9c", data_slice_id="677ae1249695103ba9feff97")Residuals.list("672e32de69b0b676ced54d9c")
> [,]
> Residuals.get("672e32de69b0b676ced54d9c", data_slice_id="677ae1249695103ba9feff97")Residuals.get("672e32de69b0b676ced54d9c", data_slice_id="677ae1249695103ba9feff97").histogram
> [{'interval_start': -33.37288135593221, 'interval_end': -32.525000000000006, 'occurrences': 1}, ...]
> ``

#### property histogram : List[Dict[str, int | float]]

Residuals histogram.

#### property coefficient_of_determination : float

Coefficient of determination.

#### property residual_mean : float

Residual mean.

#### property standard_deviation : float

Standard deviation.

#### property chart_data : List[List[float]]

The rows of Residuals chart data in [actual, predicted, residual, row number] form.

#### classmethod compute(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, **kwargs)

Submit an insight compute request. You can use create if you want to
wait synchronously for the completion of the job. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Status check job entity for the asynchronous insight calculation.
- Return type: StatusCheckJob

#### classmethod create(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, max_wait=600, **kwargs)

Create an insight and wait for completion. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Entity of the newly or already computed insights.
- Return type: Self

#### 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 from_server_data to handle paginated responses

- Return type: Self

#### classmethod get(entity_id, source=INSIGHTS_SOURCES.VALIDATION, quick_compute=None, **kwargs)

Return the first matching insight based on the entity id and kwargs.

- Parameters:
- Returns: Previously computed insight.
- Return type: Self

#### get_uri()

This should define the URI to their browser based interactions

- Return type: str

#### classmethod list(entity_id)

List all generated insights.

- Parameters: entity_id ( str ) – The ID of the entity queried for listing all generated insights.
- Returns: List of newly or previously computed insights.
- Return type: List[Self]

#### 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

#### sort(key_name)

Sorts insights data

- Return type: None

## SHAP Insights

### class datarobot.insights.ShapMatrix

Class for SHAP Matrix calculations. Use the standard methods of BaseInsight to compute
and retrieve: compute, create, list, get.

#### property matrix : Any

SHAP matrix values.

#### property base_value : float

SHAP base value for the matrix values

#### property columns : List[str]

List of columns associated with the SHAP matrix

#### property link_function : str

Link function used to generate the SHAP matrix

#### classmethod compute(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, **kwargs)

Submit an insight compute request. You can use create if you want to
wait synchronously for the completion of the job. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Status check job entity for the asynchronous insight calculation.
- Return type: StatusCheckJob

#### classmethod create(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, max_wait=600, **kwargs)

Create an insight and wait for completion. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Entity of the newly or already computed insights.
- Return type: Self

#### 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 from_server_data to handle paginated responses

- Return type: Self

#### classmethod get(entity_id, source=INSIGHTS_SOURCES.VALIDATION, quick_compute=None, **kwargs)

Return the first matching insight based on the entity id and kwargs.

- Parameters:
- Returns: Previously computed insight.
- Return type: Self

#### classmethod get_as_csv(entity_id, **kwargs)

Retrieve a specific insight represented in CSV format.

- Parameters:
- Returns: The retrieved insight.
- Return type: str

#### classmethod get_as_dataframe(entity_id, **kwargs)

Retrieve a specific insight represented as a pandas DataFrame.

- Parameters:
- Returns: The retrieved insight.
- Return type: DataFrame

#### get_uri()

This should define the URI to their browser based interactions

- Return type: str

#### classmethod list(entity_id)

List all generated insights.

- Parameters: entity_id ( str ) – The ID of the entity queried for listing all generated insights.
- Returns: List of newly or previously computed insights.
- Return type: List[Self]

#### 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

#### sort(key_name)

Sorts insights data

- Return type: None

### class datarobot.insights.ShapPreview

Class for SHAP Preview calculations. Use the standard methods of BaseInsight to compute
and retrieve: compute, create, list, get.

#### property previews : List[Dict[str, Any]]

SHAP preview values.

- Returns: preview – A list of the ShapPreview values for each row.
- Return type: List[Dict[str , Any]]

#### property previews_count : int

The number of shap preview rows.

- Return type: int

#### classmethod get(entity_id, source=INSIGHTS_SOURCES.VALIDATION, quick_compute=None, prediction_filter_row_count=None, prediction_filter_percentiles=None, prediction_filter_operand_first=None, prediction_filter_operand_second=None, prediction_filter_operator=None, feature_filter_count=None, feature_filter_name=None, **kwargs)

Return the first matching ShapPreview insight based on the entity id and kwargs.

- Parameters:
- Returns: List of newly or already computed insights.
- Return type: List[Any]

#### classmethod compute(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, **kwargs)

Submit an insight compute request. You can use create if you want to
wait synchronously for the completion of the job. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Status check job entity for the asynchronous insight calculation.
- Return type: StatusCheckJob

#### classmethod create(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, max_wait=600, **kwargs)

Create an insight and wait for completion. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Entity of the newly or already computed insights.
- Return type: Self

#### 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 from_server_data to handle paginated responses

- Return type: Self

#### get_uri()

This should define the URI to their browser based interactions

- Return type: str

#### classmethod list(entity_id)

List all generated insights.

- Parameters: entity_id ( str ) – The ID of the entity queried for listing all generated insights.
- Returns: List of newly or previously computed insights.
- Return type: List[Self]

#### 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

#### sort(key_name)

Sorts insights data

- Return type: None

### class datarobot.insights.ShapImpact

Class for SHAP Impact calculations. Use the standard methods of BaseInsight to compute
and retrieve: compute, create, list, get.

#### classmethod compute(entity_id, source=INSIGHTS_SOURCES.TRAINING, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, **kwargs)

Submit an insight compute request. You can use create if you want to
wait synchronously for the completion of the job.

- Parameters:
- Returns: Status check job entity for the asynchronous insight calculation.
- Return type: StatusCheckJob

#### classmethod create(entity_id, source=INSIGHTS_SOURCES.TRAINING, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, max_wait=600, **kwargs)

Create an insight and wait for completion.

- Parameters:
- Returns: Entity of the newly or already computed insights.
- Return type: Self

#### sort(key_name='-impact_normalized')

Sorts insights data by key name.

- Parameters: key_name ( str ) – item key name to sort data.
  One of ‘feature_name’, ‘impact_normalized’ or ‘impact_unnormalized’.
  Starting with ‘-’ reverses sort order. Default ‘-impact_normalized’
- Return type: None

#### property shap_impacts : List[List[Any]]

SHAP impact values

- Returns: A list of the SHAP impact values
- Return type: shap impacts

#### property base_value : List[float]

A list of base prediction values

#### property capping : Dict[str, Any] | None

Capping for the models in the blender

#### property link : str | None

Shared link function of the models in the blender

#### property row_count : int | None

Number of SHAP impact rows. This is deprecated.

#### 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 from_server_data to handle paginated responses

- Return type: Self

#### classmethod get(entity_id, source=INSIGHTS_SOURCES.VALIDATION, quick_compute=None, **kwargs)

Return the first matching insight based on the entity id and kwargs.

- Parameters:
- Returns: Previously computed insight.
- Return type: Self

#### get_uri()

This should define the URI to their browser based interactions

- Return type: str

#### classmethod list(entity_id)

List all generated insights.

- Parameters: entity_id ( str ) – The ID of the entity queried for listing all generated insights.
- Returns: List of newly or previously computed insights.
- Return type: List[Self]

#### 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

### class datarobot.insights.ShapDistributions

Class for SHAP Distributions calculations. Use the standard methods of BaseInsight to compute
and retrieve: compute, create, list, get.

#### property features : List[Dict[str, Any]]

SHAP feature values

- Returns: features – A list of the ShapDistributions values for each row
- Return type: List[Dict[str , Any]]

#### property total_features_count : int

Number of shap distributions features

- Return type: int

#### classmethod compute(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, **kwargs)

Submit an insight compute request. You can use create if you want to
wait synchronously for the completion of the job. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Status check job entity for the asynchronous insight calculation.
- Return type: StatusCheckJob

#### classmethod create(entity_id, source=INSIGHTS_SOURCES.VALIDATION, data_slice_id=None, external_dataset_id=None, entity_type=ENTITY_TYPES.DATAROBOT_MODEL, quick_compute=None, max_wait=600, **kwargs)

Create an insight and wait for completion. May be overridden by insight subclasses to
accept additional parameters.

- Parameters:
- Returns: Entity of the newly or already computed insights.
- Return type: Self

#### 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 from_server_data to handle paginated responses

- Return type: Self

#### classmethod get(entity_id, source=INSIGHTS_SOURCES.VALIDATION, quick_compute=None, **kwargs)

Return the first matching insight based on the entity id and kwargs.

- Parameters:
- Returns: Previously computed insight.
- Return type: Self

#### get_uri()

This should define the URI to their browser based interactions

- Return type: str

#### classmethod list(entity_id)

List all generated insights.

- Parameters: entity_id ( str ) – The ID of the entity queried for listing all generated insights.
- Returns: List of newly or previously computed insights.
- Return type: List[Self]

#### 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

#### sort(key_name)

Sorts insights data

- Return type: None

## Types

### class datarobot.models.RocCurveEstimatedMetric

Typed dict for estimated metric

### class datarobot.models.AnomalyAssessmentRecordMetadata

Typed dict for record metadata

### class datarobot.models.AnomalyAssessmentPreviewBin

Typed dict for preview bin

### class datarobot.models.ShapleyFeatureContribution

Typed dict for shapley feature contribution

### class datarobot.models.AnomalyAssessmentDataPoint

Typed dict for data points

### class datarobot.models.RegionExplanationsData

Typed dict for region explanations

## Anomaly assessment

### class datarobot.models.anomaly_assessment.AnomalyAssessmentRecord

Object which keeps metadata about anomaly assessment insight for the particular
subset, backtest and series and the links to proceed to get the anomaly assessment data.

Added in version v2.25.

- Variables:

#### classmethod list(project_id, model_id, backtest=None, source=None, series_id=None, limit=100, offset=0, with_data_only=False)

Retrieve the list of the anomaly assessment records for the project and model.
Output can be filtered and limited.

- Parameters:
- Returns: The anomaly assessment record.
- Return type: AnomalyAssessmentRecord

#### classmethod compute(project_id, model_id, backtest, source, series_id=None)

Request anomaly assessment insight computation on the specified subset.

- Parameters:
- Returns: The anomaly assessment record.
- Return type: AnomalyAssessmentRecord

#### delete()

Delete anomaly assessment record with preview and explanations.

- Return type: None

#### get_predictions_preview()

Retrieve aggregated predictions statistics for the anomaly assessment record.

- Return type: AnomalyAssessmentPredictionsPreview

#### get_latest_explanations()

Retrieve latest predictions along with shap explanations for the most anomalous records.

- Return type: AnomalyAssessmentExplanations

#### get_explanations(start_date=None, end_date=None, points_count=None)

Retrieve predictions along with shap explanations for the most anomalous records
in the specified date range/for defined number of points.
Two out of three parameters: start_date, end_date or points_count must be specified.

- Parameters:
- Return type: AnomalyAssessmentExplanations

#### get_explanations_data_in_regions(regions, prediction_threshold=0.0)

Get predictions along with explanations for the specified regions, sorted by
predictions in descending order.

- Parameters:
- Returns: dict in a form of {‘explanations’: explanations, ‘shap_base_value’: shap_base_value}
- Return type: RegionExplanationsData

### class datarobot.models.anomaly_assessment.AnomalyAssessmentExplanations

Object which keeps predictions along with shap explanations for the most anomalous records
in the specified date range/for defined number of points.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> `DataPoint` contains:
> 
> shap_explanation
> : None or an array of up to 10 ShapleyFeatureContribution objects.
>   Only rows with the highest anomaly scores have Shapley explanations calculated.
>   Value is None if prediction is lower than prediction_threshold.
> timestamp
> (str) : ISO-formatted timestamp for the row.
> prediction
> (float) : The output of the model for this row.
> 
> `ShapleyFeatureContribution` contains:
> 
> feature_value
> (str) : the feature value for this row. First 50 characters are returned.
> strength
> (float) : the shap value for this feature and row.
> feature
> (str) : the feature name.

#### classmethod get(project_id, record_id, start_date=None, end_date=None, points_count=None)

Retrieve predictions along with shap explanations for the most anomalous records
in the specified date range/for defined number of points.
Two out of three parameters: start_date, end_date or points_count must be specified.

- Parameters:
- Return type: AnomalyAssessmentExplanations

### class datarobot.models.anomaly_assessment.AnomalyAssessmentPredictionsPreview

Aggregated predictions over time for the corresponding anomaly assessment record.
Intended to find the bins with highest anomaly scores.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> `PreviewBin` contains:
> 
> start_date
> (str) : the ISO-formatted datetime of the start of the bin.
> end_date
> (str) : the ISO-formatted datetime of the end of the bin.
> avg_predicted
> (float or None) : the average prediction of the model in the bin. None if
>   there are no entries in the bin.
> max_predicted
> (float or None) : the maximum prediction of the model in the bin. None if
>   there are no entries in the bin.
> frequency
> (int) : the number of the rows in the bin.

#### classmethod get(project_id, record_id)

Retrieve aggregated predictions over time.

- Parameters:
- Return type: AnomalyAssessmentPredictionsPreview

#### find_anomalous_regions(max_prediction_threshold=0.0)

Sort preview bins by max_predicted value and select those with max predicted value
: greater or equal to max prediction threshold.
  Sort the result by max predicted value in descending order.

- Parameters: max_prediction_threshold ( Optional[float] ) – Return bins with maximum anomaly score greater or equal to max_prediction_threshold.
- Returns: preview_bins – Filtered and sorted preview bins
- Return type: list of preview_bin

## Confusion chart

### class datarobot.models.confusion_chart.ConfusionChart

Confusion Chart data for model.

> [!NOTE] Notes
> `ClassMetrics` is a dict containing the following:
> 
> class_name
> (string) name of the class
> actual_count
> (int) number of times this class is seen in the validation data
> predicted_count
> (int) number of times this class has been predicted for the           validation data
> f1
> (float) F1 score
> recall
> (float) recall score
> precision
> (float) precision score
> was_actual_percentages
> (list of dict) one vs all actual percentages in format           specified below.
>   : *
> other_class_name
> (string) the name of the other class
>     *
> percentage
> (float) the percentage of the times this class was predicted when is               was actually class (from 0 to 1)
> was_predicted_percentages
> (list of dict) one vs all predicted percentages in format           specified below.
>   : *
> other_class_name
> (string) the name of the other class
>     *
> percentage
> (float) the percentage of the times this class was actual predicted               (from 0 to 1)
> confusion_matrix_one_vs_all
> (list of list) 2d list representing 2x2 one vs all matrix.
>   : * This represents the True/False Negative/Positive rates as integer for each class.               The data structure looks like:
>     *
> [ [ True Negative, False Positive ], [ False Negative, True Positive ] ]

- Variables:

## Lift chart (legacy)

#### NOTE

The Lift chart class below is from the legacy API. For new code, use [LiftChart](https://docs.datarobot.com/en/docs/api/reference/sdk/insights.html#datarobot.insights.LiftChart) documented above, which provides `compute()`, `get()`, `list()`, and `create()` methods.

### class datarobot.models.lift_chart.LiftChart

Lift chart data for model.

> [!NOTE] Notes
> `LiftChartBin` is a dict containing the following:
> 
> actual
> (float) Sum of actual target values in bin
> predicted
> (float) Sum of predicted target values in bin
> bin_weight
> (float) The weight of the bin. For weighted projects, it is the sum of           the weights of the rows in the bin. For unweighted projects, it is the number of rows in           the bin.

- Variables:

#### classmethod from_server_data(data, keep_attrs=None, use_insights_format=False, **kwargs)

Overwrite APIObject.from_server_data to handle lift chart data retrieved
from either legacy URL or /insights/ new URL.

- Parameters:

## Data slices

### class datarobot.models.data_slice.DataSlice

Definition of a data slice

- Variables:

#### classmethod list(project, offset=0, limit=100)

List the data slices in the same project

- Parameters:
- Returns: data_slices
- Return type: list[DataSlice]

> [!NOTE] Examples
> ```
> >>> import datarobot as dr
> >>> ...  # set up your Client
> >>> data_slices = dr.DataSlice.list("646d0ea0cd8eb2355a68b0e5")
> >>> data_slices
> [DataSlice(...), DataSlice(...), ...]
> ```

#### classmethod create(name, filters, project)

Creates a data slice in the project with the given name and filters

- Parameters:

> [!NOTE] Examples
> ```
> >>> import datarobot as dr
> >>> ...  # set up your Client and retrieve a project
> >>> data_slice = dr.DataSlice.create(
> >>> ...    name='yes',
> >>> ...    filters=[{'operand': 'binary_target', 'operator': 'eq', 'values': ['Yes']}],
> >>> ...    project=project,
> >>> ...  )
> >>> data_slice
> DataSlice(
>     filters=[{'operand': 'binary_target', 'operator': 'eq', 'values': ['Yes']}],
>     id=646d1296bd0c543d88923c9d,
>     name=yes,
>     project_id=646d0ea0cd8eb2355a68b0e5
> )
> ```

#### delete()

Deletes the data slice from storage

> [!NOTE] Examples
> ```
> >>> import datarobot as dr
> >>> data_slice = dr.DataSlice.get('5a8ac9ab07a57a0001be501f')
> >>> data_slice.delete()
> ```
> 
> ```
> >>> import datarobot as dr
> >>> ... # get project or project_id
> >>> data_slices = dr.DataSlice.list(project)  # project object or project_id
> >>> data_slice = data_slices[0]  # choose a data slice from the list
> >>> data_slice.delete()
> ```

- Return type: None

#### request_size(source, model=None)

Submits a request to validate the data slice’s filters and
calculate the data slice’s number of rows on a given source

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

> [!NOTE] Examples
> ```
> >>> import datarobot as dr
> >>> ... # get project or project_id
> >>> data_slices = dr.DataSlice.list(project)  # project object or project_id
> >>> data_slice = data_slices[0]  # choose a data slice from the list
> >>> status_check_job = data_slice.request_size("validation")
> ```
> 
> Model is required when source is ‘training’
> 
> ```
> >>> import datarobot as dr
> >>> ... # get project or project_id
> >>> data_slices = dr.DataSlice.list(project)  # project object or project_id
> >>> data_slice = data_slices[0]  # choose a data slice from the list
> >>> status_check_job = data_slice.request_size("training", model)
> ```

#### get_size_info(source, model=None)

Get information about the data slice applied to a source

- Parameters:
- Returns: slice_size_info – Information of the data slice applied to a source
- Return type: DataSliceSizeInfo

> [!NOTE] Examples
> ```
> >>> import datarobot as dr
> >>> ...  # set up your Client
> >>> data_slices = dr.DataSlice.list("646d0ea0cd8eb2355a68b0e5")
> >>> data_slice = slices[0]  # can be any slice in the list
> >>> data_slice_size_info = data_slice.get_size_info("validation")
> >>> data_slice_size_info
> DataSliceSizeInfo(
>     data_slice_id=6493a1776ea78e6644382535,
>     messages=[
>         {
>             'level': 'WARNING',
>             'description': 'Low Observation Count',
>             'additional_info': 'Insufficient number of observations to compute some insights.'
>         }
>     ],
>     model_id=None,
>     project_id=646d0ea0cd8eb2355a68b0e5,
>     slice_size=1,
>     source=validation,
> )
> >>> data_slice_size_info.to_dict()
> {
>     'data_slice_id': '6493a1776ea78e6644382535',
>     'messages': [
>         {
>             'level': 'WARNING',
>             'description': 'Low Observation Count',
>             'additional_info': 'Insufficient number of observations to compute some insights.'
>         }
>     ],
>     'model_id': None,
>     'project_id': '646d0ea0cd8eb2355a68b0e5',
>     'slice_size': 1,
>     'source': 'validation',
> }
> ```
> 
> ```
> >>> import datarobot as dr
> >>> ...  # set up your Client
> >>> data_slice = dr.DataSlice.get("6493a1776ea78e6644382535")
> >>> data_slice_size_info = data_slice.get_size_info("validation")
> ```
> 
> When using source=’training’, the model param is required.
> 
> ```
> >>> import datarobot as dr
> >>> ...  # set up your Client
> >>> model = dr.Model.get(project_id, model_id)
> >>> data_slice = dr.DataSlice.get("6493a1776ea78e6644382535")
> >>> data_slice_size_info = data_slice.get_size_info("training", model)
> ```
> 
> ```
> >>> import datarobot as dr
> >>> ...  # set up your Client
> >>> data_slice = dr.DataSlice.get("6493a1776ea78e6644382535")
> >>> data_slice_size_info = data_slice.get_size_info("training", model_id)
> ```

#### classmethod get(data_slice_id)

Retrieve a specific data slice.

- Parameters: data_slice_id ( str ) – The identifier of the data slice to retrieve.
- Returns: data_slice – The required data slice.
- Return type: DataSlice

> [!NOTE] Examples
> ```
> >>> import datarobot as dr
> >>> dr.DataSlice.get('648b232b9da812a6aaa0b7a9')
> DataSlice(filters=[{'operand': 'binary_target', 'operator': 'eq', 'values': ['Yes']}],
>           id=648b232b9da812a6aaa0b7a9,
>           name=test,
>           project_id=644bc575572480b565ca42cd
>           )
> ```

### class datarobot.models.data_slice.DataSliceSizeInfo

Definition of a data slice applied to a source

- Variables:

## Datetime trend plots

### class datarobot.models.datetime_trend_plots.AccuracyOverTimePlotsMetadata

Accuracy over Time metadata for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Backtest/holdout status is a dict containing the following:
> 
> training: string
>   : Status backtest/holdout training. One of
> datarobot.enums.DATETIME_TREND_PLOTS_STATUS
> validation: string
>   : Status backtest/holdout validation. One of
> datarobot.enums.DATETIME_TREND_PLOTS_STATUS
> 
> Backtest/holdout metadata is a dict containing the following:
> 
> training: dict
>   : Start and end dates for the backtest/holdout training.
> validation: dict
>   : Start and end dates for the backtest/holdout validation.
> 
> Each dict in the training and validation in backtest/holdout metadata is structured like:
> 
> start_date: datetime.datetime or None
>   : The datetime of the start of the chart data (inclusive). None if chart data is not computed.
> end_date: datetime.datetime or None
>   : The datetime of the end of the chart data (exclusive). None if chart data is not computed.

### class datarobot.models.datetime_trend_plots.AccuracyOverTimePlot

Accuracy over Time plot for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Bin is a dict containing the following:
> 
> start_date: datetime.datetime
>   : The datetime of the start of the bin (inclusive).
> end_date: datetime.datetime
>   : The datetime of the end of the bin (exclusive).
> actual: float or None
>   : Average actual value of the target in the bin. None if there are no entries in the bin.
> predicted: float or None
>   : Average prediction of the model in the bin. None if there are no entries in the bin.
> frequency: int or None
>   : Indicates number of values averaged in bin.
> 
> Statistics is a dict containing the following:
> 
> durbin_watson: float or None
>   : The Durbin-Watson statistic for the chart data.
>     Value is between 0 and 4. Durbin-Watson statistic
>     is a test statistic used to detect the presence of
>     autocorrelation at lag 1 in the residuals (prediction errors)
>     from a regression analysis. More info
> https://wikipedia.org/wiki/Durbin%E2%80%93Watson_statistic
> 
> Calendar event is a dict containing the following:
> 
> name: string
>   : Name of the calendar event.
> date: datetime
>   : Date of the calendar event.
> series_id: string or None
>   : The series ID for the event. If this event does not specify a series ID,
>     then this will be None, indicating that the event applies to all series.

### class datarobot.models.datetime_trend_plots.AccuracyOverTimePlotPreview

Accuracy over Time plot preview for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Bin is a dict containing the following:
> 
> start_date: datetime.datetime
>   : The datetime of the start of the bin (inclusive).
> end_date: datetime.datetime
>   : The datetime of the end of the bin (exclusive).
> actual: float or None
>   : Average actual value of the target in the bin. None if there are no entries in the bin.
> predicted: float or None
>   : Average prediction of the model in the bin. None if there are no entries in the bin.

### class datarobot.models.datetime_trend_plots.ForecastVsActualPlotsMetadata

Forecast vs Actual plots metadata for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Backtest/holdout status is a dict containing the following:
> 
> training: dict
>   : Dict containing each of
> datarobot.enums.DATETIME_TREND_PLOTS_STATUS
> as dict key,
>     and list of forecast distances for particular status as dict value.
> validation: dict
>   : Dict containing each of
> datarobot.enums.DATETIME_TREND_PLOTS_STATUS
> as dict key,
>     and list of forecast distances for particular status as dict value.
> 
> Backtest/holdout metadata is a dict containing the following:
> 
> training: dict
>   : Start and end dates for the backtest/holdout training.
> validation: dict
>   : Start and end dates for the backtest/holdout validation.
> 
> Each dict in the training and validation in backtest/holdout metadata is structured like:
> 
> start_date: datetime.datetime or None
>   : The datetime of the start of the chart data (inclusive). None if chart data is not computed.
> end_date: datetime.datetime or None
>   : The datetime of the end of the chart data (exclusive). None if chart data is not computed.

### class datarobot.models.datetime_trend_plots.ForecastVsActualPlot

Forecast vs Actual plot for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Bin is a dict containing the following:
> 
> start_date: datetime.datetime
>   : The datetime of the start of the bin (inclusive).
> end_date: datetime.datetime
>   : The datetime of the end of the bin (exclusive).
> actual: float or None
>   : Average actual value of the target in the bin. None if there are no entries in the bin.
> forecasts: list of float
>   : A list of average forecasts for the model for each forecast distance.
>     Empty if there are no forecasts in the bin.
>     Each index in the forecasts list maps to forecastDistances list index.
> error: float or None
>   : Average absolute residual value of the bin.
>     None if there are no entries in the bin.
> normalized_error: float or None
>   : Normalized average absolute residual value of the bin.
>     None if there are no entries in the bin.
> frequency: int or None
>   : Indicates number of values averaged in bin.
> 
> Calendar event is a dict containing the following:
> 
> name: string
>   : Name of the calendar event.
> date: datetime
>   : Date of the calendar event.
> series_id: string or None
>   : The series ID for the event. If this event does not specify a series ID,
>     then this will be None, indicating that the event applies to all series.

### class datarobot.models.datetime_trend_plots.ForecastVsActualPlotPreview

Forecast vs Actual plot preview for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Bin is a dict containing the following:
> 
> start_date: datetime.datetime
>   : The datetime of the start of the bin (inclusive).
> end_date: datetime.datetime
>   : The datetime of the end of the bin (exclusive).
> actual: float or None
>   : Average actual value of the target in the bin. None if there are no entries in the bin.
> predicted: float or None
>   : Average prediction of the model in the bin. None if there are no entries in the bin.

### class datarobot.models.datetime_trend_plots.AnomalyOverTimePlotsMetadata

Anomaly over Time metadata for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Backtest/holdout status is a dict containing the following:
> 
> training: string
>   : Status backtest/holdout training. One of
> datarobot.enums.DATETIME_TREND_PLOTS_STATUS
> validation: string
>   : Status backtest/holdout validation. One of
> datarobot.enums.DATETIME_TREND_PLOTS_STATUS
> 
> Backtest/holdout metadata is a dict containing the following:
> 
> training: dict
>   : Start and end dates for the backtest/holdout training.
> validation: dict
>   : Start and end dates for the backtest/holdout validation.
> 
> Each dict in the training and validation in backtest/holdout metadata is structured like:
> 
> start_date: datetime.datetime or None
>   : The datetime of the start of the chart data (inclusive). None if chart data is not computed.
> end_date: datetime.datetime or None
>   : The datetime of the end of the chart data (exclusive). None if chart data is not computed.

### class datarobot.models.datetime_trend_plots.AnomalyOverTimePlot

Anomaly over Time plot for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Bin is a dict containing the following:
> 
> start_date: datetime.datetime
>   : The datetime of the start of the bin (inclusive).
> end_date: datetime.datetime
>   : The datetime of the end of the bin (exclusive).
> predicted: float or None
>   : Average prediction of the model in the bin. None if there are no entries in the bin.
> frequency: int or None
>   : Indicates number of values averaged in bin.
> 
> Calendar event is a dict containing the following:
> 
> name: string
>   : Name of the calendar event.
> date: datetime
>   : Date of the calendar event.
> series_id: string or None
>   : The series ID for the event. If this event does not specify a series ID,
>     then this will be None, indicating that the event applies to all series.

### class datarobot.models.datetime_trend_plots.AnomalyOverTimePlotPreview

Anomaly over Time plot preview for datetime model.

Added in version v2.25.

- Variables:

> [!NOTE] Notes
> Bin is a dict containing the following:
> 
> start_date: datetime.datetime
>   : The datetime of the start of the bin (inclusive).
> end_date: datetime.datetime
>   : The datetime of the end of the bin (exclusive).

## External scores and insights

### class datarobot.ExternalScores

Metric scores on prediction dataset with target or actual value column in unsupervised
case. Contains project metrics for supervised and special classification metrics set for
unsupervised projects.

Added in version v2.21.

- Variables:

> [!NOTE] Examples
> List all scores for a dataset
> 
> ```
> from datarobot.models.external_dataset_scores_insights.external_scores import ExternalScores
> scores = ExternalScores.list(project_id, dataset_id=dataset_id)
> ```

#### classmethod create(project_id, model_id, dataset_id, actual_value_column=None)

Compute an external dataset insights for the specified model.

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

#### classmethod list(project_id, model_id=None, dataset_id=None, offset=0, limit=100)

Fetch external scores list for the project and optionally for model and dataset.

- Parameters:
- Return type: List [ ExternalScores ]
- Returns: A list of External Scores objects

#### classmethod get(project_id, model_id, dataset_id)

Retrieve external scores for the project, model and dataset.

- Parameters:
- Return type: ExternalScores
- Returns: External Scores object

### class datarobot.ExternalLiftChart

Lift chart for the model and prediction dataset with target or actual value column in
unsupervised case.

Added in version v2.21.

`LiftChartBin` is a dict containing the following:

> actual(float) Sum of actual target values in binpredicted(float) Sum of predicted target values in binbin_weight(float) The weight of the bin. For weighted projects, it is the sum of           the weights of the rows in the bin. For unweighted projects, it is the number of rows in           the bin.Variables:dataset_id(str) – id of the prediction dataset with target or actual value column for unsupervised casebins(listofdict) – List of dicts with schema described asLiftChartBinabove.

#### classmethod list(project_id, model_id, dataset_id=None, offset=0, limit=100)

Retrieve list of the lift charts for the model.

- Parameters:
- Return type: List [ ExternalLiftChart ]
- Returns: A list of ExternalLiftChart objects

#### classmethod get(project_id, model_id, dataset_id)

Retrieve lift chart for the model and prediction dataset.

- Parameters:
- Return type: ExternalLiftChart
- Returns: ExternalLiftChart object

### class datarobot.ExternalRocCurve

ROC curve data for the model and prediction dataset with target or actual value column in
unsupervised case.

Added in version v2.21.

- Variables:

#### classmethod list(project_id, model_id, dataset_id=None, offset=0, limit=100)

Retrieve list of the roc curves for the model.

- Parameters:
- Return type: List [ ExternalRocCurve ]
- Returns: A list of ExternalRocCurve objects

#### classmethod get(project_id, model_id, dataset_id)

Retrieve ROC curve chart for the model and prediction dataset.

- Parameters:
- Return type: ExternalRocCurve
- Returns: ExternalRocCurve object

## Feature association

### class datarobot.models.FeatureAssociationMatrix

Feature association statistics for a project.

> [!NOTE] Notes
> Projects created prior to v2.17 are not supported by this feature.

- Variables:

> [!NOTE] Examples
> ```
> import datarobot as dr
> 
> # retrieve feature association matrix
> feature_association_matrix = dr.FeatureAssociationMatrix.get(project_id)
> feature_association_matrix.strengths
> feature_association_matrix.features
> 
> # retrieve feature association matrix for a metric, association type or a feature list
> feature_association_matrix = dr.FeatureAssociationMatrix.get(
>     project_id,
>     metric=enums.FEATURE_ASSOCIATION_METRIC.SPEARMAN,
>     association_type=enums.FEATURE_ASSOCIATION_TYPE.CORRELATION,
>     featurelist_id=featurelist_id,
> )
> ```

#### classmethod get(project_id, metric=None, association_type=None, featurelist_id=None)

Get feature association statistics.

- Parameters:
- Returns: Feature association pairwise metric strength data, feature clustering data, and
  ordering data for Feature Association Matrix visualization.
- Return type: FeatureAssociationMatrix

#### classmethod create(project_id, featurelist_id)

Compute the Feature Association Matrix for a Feature List

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

## Feature association matrix details

### class datarobot.models.FeatureAssociationMatrixDetails

Plotting details for a pair of passed features present in the feature association matrix.

> [!NOTE] Notes
> Projects created prior to v2.17 are not supported by this feature.

- Variables:

#### classmethod get(project_id, feature1, feature2, featurelist_id=None)

Get a sample of the actual values used to measure the association between a pair of features

Added in version v2.17.

- Parameters:
- Returns: The feature association plotting for provided pair of features.
- Return type: FeatureAssociationMatrixDetails

## Feature association featurelists

### class datarobot.models.FeatureAssociationFeaturelists

Featurelists with feature association matrix availability flags for a project.

- Variables:

#### classmethod get(project_id)

Get featurelists with feature association status for each.

- Parameters: project_id ( str ) – Id of the project of interest.
- Returns: Featurelist with feature association status for each.
- Return type: FeatureAssociationFeaturelists

## Feature effects

### class datarobot.models.FeatureEffects

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.

- Variables:

> [!NOTE] Notes
> `featureEffects` is a dict containing the following:
> 
> feature_name
> (string) Name of the feature
> feature_type
> (string) dr.enums.FEATURE_TYPE,           Feature type either numeric, categorical or datetime
> feature_impact_score
> (float) Feature impact score
> weight_label
> (string) optional, Weight label if configured for the project else null
> partial_dependence
> (List) Partial dependence results
> predicted_vs_actual
> (List) optional, Predicted versus actual results,           may be omitted if there are insufficient qualified samples
> 
> `partial_dependence` is a dict containing the following:
> 
> is_capped
> (bool) Indicates whether the data for computation is capped
> data
> (List) partial dependence results in the following format
> 
> `data` is a list of dict containing the following:
> 
> label
> (string) Contains label for categorical and numeric features as string
> dependence
> (float) Value of partial dependence
> 
> `predicted_vs_actual` is a dict containing the following:
> 
> is_capped
> (bool) Indicates whether the data for computation is capped
> data
> (List) pred vs actual results in the following format
> 
> `data` is a list of dict containing the following:
> 
> label
> (string) Contains label for categorical features           for numeric features contains range or numeric value.
> bin
> (List) optional, For numeric features contains           labels for left and right bin limits
> predicted
> (float) Predicted value
> actual
> (float) Actual value. Actual value is null           for unsupervised timeseries models
> row_count
> (int or float) Number of rows for the label and bin.           Type is float if weight or exposure is set for the project.

#### classmethod from_server_data(data, *args, use_insights_format=False, **kwargs)

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.FeatureEffectMetadata

Feature Effect Metadata for model, contains status and available model sources.

> [!NOTE] Notes
> `source` is expected parameter to retrieve Feature Effect. One of provided sources
> shall be used.

### class datarobot.models.FeatureEffectMetadataDatetime

Feature Effect Metadata for datetime model, contains list of
feature effect metadata per backtest.

> [!NOTE] Notes
> `feature effect metadata per backtest` contains:
> 
> status
> : str.
> backtest_index
> : str.
> sources
> : List[str].
> 
> `source` is expected parameter to retrieve Feature Effect. One of provided sources
> shall be used.
> 
> `backtest_index` is expected parameter to submit compute request and retrieve Feature Effect.
> One of provided backtest indexes shall be used.

- Variables: data ( list[FeatureEffectMetadataDatetimePerBacktest] ) – List feature effect metadata per backtest

### class datarobot.models.FeatureEffectMetadataDatetimePerBacktest

Convert dictionary into feature effect metadata per backtest which contains backtest_index,
status and sources.

## Payoff matrix

### class datarobot.models.PayoffMatrix

Represents a Payoff Matrix, a costs/benefit scenario used for creating a profit curve.

- Variables:

> [!NOTE] Examples
> ```
> import datarobot as dr
> 
> # create a payoff matrix
> payoff_matrix = dr.PayoffMatrix.create(
>     project_id,
>     name,
>     true_positive_value=100,
>     true_negative_value=10,
>     false_positive_value=0,
>     false_negative_value=-10,
> )
> 
> # list available payoff matrices
> payoff_matrices = dr.PayoffMatrix.list(project_id)
> payoff_matrix = payoff_matrices[0]
> ```

#### classmethod create(project_id, name, true_positive_value=1, true_negative_value=1, false_positive_value=-1, false_negative_value=-1)

Create a payoff matrix associated with a specific project.

- Parameters: project_id ( str ) – id of the project with which the payoff matrix will be associated
- Returns: payoff_matrix – The newly created payoff matrix
- Return type: PayoffMatrix

#### classmethod list(project_id)

Fetch all the payoff matrices for a project.

- Parameters: project_id ( str ) – id of the project
- Returns: A list of PayoffMatrix objects
- Return type: List of PayoffMatrix
- Raises:

#### classmethod get(project_id, id)

Retrieve a specified payoff matrix.

- Parameters:
- Return type: PayoffMatrix
- Returns:
- Raises:

#### classmethod update(project_id, id, name, true_positive_value, true_negative_value, false_positive_value, false_negative_value)

Update (replace) a payoff matrix. Note that all data fields are required.

- Parameters:
- Returns: PayoffMatrix with updated values
- Return type: payoff_matrix
- Raises:

#### classmethod delete(project_id, id)

Delete a specified payoff matrix.

- Parameters:
- Returns: response – Empty response (204)
- Return type: requests.Response
- Raises:

#### 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)

Instantiate an object of this class using the data directly from the server,
meaning that the keys may have the wrong camel casing

- Parameters:
- Return type: TypeVar ( T , bound= APIObject)

## Prediction explanations

### class datarobot.PredictionExplanationsInitialization

Represents a prediction explanations initialization of a model.

- Variables:

#### classmethod get(project_id, model_id)

Retrieve the prediction explanations initialization for a model.

Prediction explanations initializations are a prerequisite for computing prediction
explanations, and include a sample what the computed prediction explanations for a
prediction dataset would look like.

- Parameters:
- Returns: prediction_explanations_initialization – The queried instance.
- Return type: PredictionExplanationsInitialization
- Raises: ClientError – If the project or model does not exist or the initialization has not been computed.

#### classmethod create(project_id, model_id)

Create a prediction explanations initialization for the specified model.

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

#### delete()

Delete this prediction explanations initialization.

### class datarobot.PredictionExplanations

Represents prediction explanations metadata and provides access to computation results.

> [!NOTE] Examples
> ```
> prediction_explanations = dr.PredictionExplanations.get(project_id, explanations_id)
> for row in prediction_explanations.get_rows():
>     print(row)  # row is an instance of PredictionExplanationsRow
> ```

- Variables:

#### classmethod get(project_id, prediction_explanations_id)

Retrieve a specific prediction explanations metadata.

- Parameters:
- Returns: prediction_explanations – The queried instance.
- Return type: PredictionExplanations

#### classmethod create(project_id, model_id, dataset_id, max_explanations=None, threshold_low=None, threshold_high=None, mode=None)

Create prediction explanations for the specified dataset.

In order to create PredictionExplanations for a particular model and dataset, you must
first:

> Compute feature impact for the model viadatarobot.Model.get_feature_impact()Compute a PredictionExplanationsInitialization for the model viadatarobot.PredictionExplanationsInitialization.create(project_id, model_id)Compute predictions for the model and dataset viadatarobot.Model.request_predictions(dataset_id)

`threshold_high` and `threshold_low` are optional filters applied to speed up
computation.  When at least one is specified, only the selected outlier rows will have
prediction explanations computed. Rows are considered to be outliers if their predicted
value (in case of regression projects) or probability of being the positive
class (in case of classification projects) is less than `threshold_low` or greater than `thresholdHigh`.  If neither is specified, prediction explanations will be computed for
all rows.

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

#### classmethod create_on_training_data(project_id, model_id, dataset_id, max_explanations=None, threshold_low=None, threshold_high=None, mode=None, datetime_prediction_partition=None)

Create prediction explanations for the the dataset used to train the model.
This can be retrieved by calling `dr.Model.get().featurelist_id`.
For OTV and timeseries projects, `datetime_prediction_partition` is required and limited to the
first backtest (‘0’) or holdout (‘holdout’).

In order to create PredictionExplanations for a particular model and dataset, you must
first:

> Compute Feature Impact for the model viadatarobot.Model.get_feature_impact()/Compute a PredictionExplanationsInitialization for the model viadatarobot.PredictionExplanationsInitialization.create(project_id, model_id).Compute predictions for the model and dataset viadatarobot.Model.request_predictions(dataset_id).

`threshold_high` and `threshold_low` are optional filters applied to speed up
computation.  When at least one is specified, only the selected outlier rows will have
prediction explanations computed. Rows are considered to be outliers if their predicted
value (in case of regression projects) or probability of being the positive
class (in case of classification projects) is less than `threshold_low` or greater than `thresholdHigh`.  If neither is specified, prediction explanations will be computed for
all rows.

- Parameters:
- Returns: job – An instance of created async job.
- Return type: Job

#### classmethod list(project_id, model_id=None, limit=None, offset=None)

List of prediction explanations metadata for a specified project.

- Parameters:
- Returns: prediction_explanations
- Return type: list[PredictionExplanations]

#### get_rows(batch_size=None, exclude_adjusted_predictions=True)

Retrieve prediction explanations rows.

- Parameters:
- Yields: prediction_explanations_row ( PredictionExplanationsRow ) – Represents prediction explanations computed for a prediction row.

#### is_multiclass()

Whether these explanations are for a multiclass project or a non-multiclass project

#### is_unsupervised_clustering_or_multiclass()

Clustering and multiclass XEMP always has either one of num_top_classes or class_names
parameters set

#### get_number_of_explained_classes()

How many classes we attempt to explain for each row

#### get_all_as_dataframe(exclude_adjusted_predictions=True)

Retrieve all prediction explanations rows and return them as a pandas.DataFrame.

Returned dataframe has the following structure:

> row_id : row id from prediction datasetprediction : the output of the model for this rowadjusted_prediction : adjusted prediction values (only appears for projects that
>   utilize prediction adjustments, e.g., projects with an exposure column)class_0_label : a class level from the target (only appears for classification
>   projects)class_0_probability : the probability that the target is this class (only appears for
>   classification projects)class_1_label : a class level from the target (only appears for classification
>   projects)class_1_probability : the probability that the target is this class (only appears for
>   classification projects)explanation_0_feature : the name of the feature contributing to the prediction for
>   this explanationexplanation_0_feature_value : the value the feature took onexplanation_0_label : the output being driven by this explanation.  For regression
>   projects, this is the name of the target feature.  For classification projects, this
>   is the class label whose probability increasing would correspond to a positive
>   strength.explanation_0_qualitative_strength : a human-readable description of how strongly the
>   feature affected the prediction (e.g., ‘+++’, ‘–’, ‘+’) for this explanationexplanation_0_per_ngram_text_explanations : Text prediction explanations data in json
>   formatted string.explanation_0_strength : the amount this feature’s value affected the prediction…explanation_N_feature : the name of the feature contributing to the prediction for
>   this explanationexplanation_N_feature_value : the value the feature took onexplanation_N_label : the output being driven by this explanation.  For regression
>   projects, this is the name of the target feature.  For classification projects, this
>   is the class label whose probability increasing would correspond to a positive
>   strength.explanation_N_qualitative_strength : a human-readable description of how strongly the
>   feature affected the prediction (e.g., ‘+++’, ‘–’, ‘+’) for this explanationexplanation_N_per_ngram_text_explanations : Text prediction explanations data in json
>   formatted string.explanation_N_strength : the amount this feature’s value affected the prediction

For classification projects, the server does not guarantee any ordering on the prediction
values, however within this function we sort the values so that class_X corresponds to
the same class from row to row.

- Parameters: exclude_adjusted_predictions ( bool ) – Optional, defaults to True. Set this to False to include adjusted prediction values in
  the returned dataframe.
- Returns: dataframe
- Return type: pandas.DataFrame

#### download_to_csv(filename, encoding='utf-8', exclude_adjusted_predictions=True)

Save prediction explanations rows into CSV file.

- Parameters:

#### get_prediction_explanations_page(limit=None, offset=None, exclude_adjusted_predictions=True)

Get prediction explanations.

If you don’t want use a generator interface, you can access paginated prediction
explanations directly.

- Parameters:
- Returns: prediction_explanations
- Return type: PredictionExplanationsPage

#### delete()

Delete these prediction explanations.

### class datarobot.models.prediction_explanations.PredictionExplanationsRow

Represents prediction explanations computed for a prediction row.

> [!NOTE] Notes
> `PredictionValue` contains:
> 
> label
> : describes what this model output corresponds to.  For regression projects,
>   it is the name of the target feature.  For classification projects, it is a level from
>   the target feature.
> value
> : the output of the prediction.  For regression projects, it is the predicted
>   value of the target.  For classification projects, it is the predicted probability the
>   row belongs to the class identified by the label.

`PredictionExplanation` contains:

- label : described what output was driven by this explanation.  For regression
  projects, it is the name of the target feature.  For classification projects, it is the
  class whose probability increasing would correspond to a positive strength of this
  prediction explanation.
- feature : the name of the feature contributing to the prediction
- feature_value : the value the feature took on for this row
- strength : the amount this feature’s value affected the prediction
- qualitative_strength : a human-readable description of how strongly the feature
  affected the prediction. A large positive effect is denoted ‘+++’, medium ‘++’, small ‘+’,
  very small ‘<+’. A large negative effect is denoted ‘—’, medium ‘–’, small ‘-’, very
  small ‘<-‘.

- Variables:

### class datarobot.models.prediction_explanations.PredictionExplanationsPage

Represents a batch of prediction explanations received by one request.

- Variables:

#### classmethod get(project_id, prediction_explanations_id, limit=None, offset=0, exclude_adjusted_predictions=True)

Retrieve prediction explanations.

- Parameters:
- Returns: prediction_explanations – The queried instance.
- Return type: PredictionExplanationsPage

### class datarobot.models.ShapMatrix

Represents SHAP based prediction explanations and provides access to score values.

- Variables:

> [!NOTE] Examples
> ```
> import datarobot as dr
> 
> # request SHAP matrix calculation
> shap_matrix_job = dr.ShapMatrix.create(project_id, model_id, dataset_id)
> shap_matrix = shap_matrix_job.get_result_when_complete()
> 
> # list available SHAP matrices
> shap_matrices = dr.ShapMatrix.list(project_id)
> shap_matrix = shap_matrices[0]
> 
> # get SHAP matrix as dataframe
> shap_matrix_values = shap_matrix.get_as_dataframe()
> ```

#### classmethod create(cls, project_id, model_id, dataset_id)

Calculate SHAP based prediction explanations against previously uploaded dataset.

- Parameters:
- Returns: job – The job computing the SHAP based prediction explanations
- Return type: ShapMatrixJob
- Raises:

#### classmethod list(cls, project_id)

Fetch all the computed SHAP prediction explanations for a project.

- Parameters: project_id ( str ) – id of the project
- Returns: A list of ShapMatrix objects
- Return type: List of ShapMatrix
- Raises:

#### classmethod get(cls, project_id, id)

Retrieve the specific SHAP matrix.

- Parameters:
- Return type: ShapMatrix object representing specified record

#### get_as_dataframe(read_timeout=60)

Retrieve SHAP matrix values as dataframe.

- Return type: DataFrame
- Returns:

### class datarobot.models.ClassListMode

Calculate prediction explanations for the specified classes in each row.

- Variables: class_names ( list ) – List of class names that will be explained for each dataset row.

#### get_api_parameters(batch_route=False)

Get parameters passed in corresponding API call

- Parameters: batch_route ( bool ) – Batch routes describe prediction calls with all possible parameters, so to
  distinguish explanation parameters from others they have prefix in parameters.
- Return type: dict

### class datarobot.models.TopPredictionsMode

Calculate prediction explanations for the number of top predicted classes in each row.

- Variables: num_top_classes ( int ) – Number of top predicted classes [1..10] that will be explained for each dataset row.

#### get_api_parameters(batch_route=False)

Get parameters passed in corresponding API call

- Parameters: batch_route ( bool ) – Batch routes describe prediction calls with all possible parameters, so to
  distinguish explanation parameters from others they have prefix in parameters.
- Return type: dict

## Rating table

### class datarobot.models.RatingTable

Interface to modify and download rating tables.

- Variables:

#### classmethod from_server_data(data, should_warn=True, 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:
- Return type: RatingTable

#### classmethod get(project_id, rating_table_id)

Retrieve a single rating table

- Parameters:
- Returns: rating_table – The queried instance
- Return type: RatingTable

#### classmethod create(project_id, parent_model_id, filename, rating_table_name='Uploaded Rating Table')

Uploads and validates a new rating table CSV

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

#### download(filepath)

Download a csv file containing the contents of this rating table

- Parameters: filepath ( str ) – The path at which to save the rating table file.
- Return type: None

#### rename(rating_table_name)

Renames a rating table to a different name.

- Parameters: rating_table_name ( str ) – The new name to rename the rating table to.
- Return type: None

#### create_model()

Creates a new model from this rating table record. This rating table
must not already be associated with a model and must be valid.

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

## ROC curve (legacy)

#### NOTE

The ROC curve class below is from the legacy API. For new code, use [RocCurve](https://docs.datarobot.com/en/docs/api/reference/sdk/insights.html#datarobot.insights.RocCurve) documented above, which provides `compute()`, `get()`, `list()`, and `create()` methods.

### class datarobot.models.roc_curve.RocCurve

ROC curve data for model.

- Variables:

#### classmethod from_server_data(data, keep_attrs=None, use_insights_format=False, **kwargs)

Overwrite APIObject.from_server_data to handle roc curve data retrieved
from either legacy URL or /insights/ new URL.

- Parameters:
- Return type: RocCurve

### class datarobot.models.roc_curve.LabelwiseRocCurve

Labelwise ROC curve data for one label and one source.

- Variables:

## Word Cloud

### class datarobot.models.word_cloud.WordCloud

Word cloud data for the model.

> [!NOTE] Notes
> `WordCloudNgram` is a dict containing the following:
> 
> ngram
> (str) Word or ngram value.
> coefficient
> (float) Value from [-1.0, 1.0] range, describes effect of this ngram on           the target. Large negative value means strong effect toward negative class in           classification and smaller target value in regression models. Large positive - toward           positive class and bigger value respectively.
> count
> (int) Number of rows in the training sample where this ngram appears.
> frequency
> (float) Value from (0.0, 1.0] range, relative frequency of given ngram to           most frequent ngram.
> is_stopword
> (bool) True for ngrams that DataRobot evaluates as stopwords.
> class
> (str or None) For classification - values of the target class for
>   corresponding word or ngram. For regression - None.

- Variables: ngrams ( list of dict ) – List of dicts with schema described as WordCloudNgram above.

#### most_frequent(top_n=5)

Return most frequent ngrams in the word cloud.

- Parameters: top_n ( int ) – Number of ngrams to return
- Returns: Up to top_n top most frequent ngrams in the word cloud.
  If top_n bigger then total number of ngrams in word cloud - return all sorted by
  frequency in descending order.
- Return type: list of dict

#### most_important(top_n=5)

Return most important ngrams in the word cloud.

- Parameters: top_n ( int ) – Number of ngrams to return
- Returns: Up to top_n top most important ngrams in the word cloud.
  If top_n bigger then total number of ngrams in word cloud - return all sorted by
  absolute coefficient value in descending order.
- Return type: list of dict

#### ngrams_per_class()

Split ngrams per target class values. Useful for multiclass models.

- Returns: Dictionary in the format of (class label) -> (list of ngrams for that class)
- Return type: dict

### class datarobot.models.word_cloud.WordCloudNgram

---
