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

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:
  • entity_id (str) – The ID of the entity to compute the insight.

  • source (str) – The source type to use when computing the insight.

  • data_slice_id (Optional[str]) – Data slice ID to use when computing the insight.

  • external_dataset_id (Optional[str]) – External dataset ID to use when computing the insight.

  • entity_type (Optional[ENTITY_TYPES]) – The type of the entity associated with the insight. Select one of the ENTITY_TYPE enum values, or accept the default, “datarobotModel”.

  • quick_compute (Optional[bool]) – Sets whether to use quick-compute for the insight. If True or unspecified, the insight is computed using a 2500-row data sample. If False, the insight is computed using all rows in the chosen source.

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:
  • entity_id (str) – The ID of the entity to compute the insight.

  • source (str) – The source type to use when computing the insight.

  • data_slice_id (Optional[str]) – Data slice ID to use when computing the insight.

  • external_dataset_id (Optional[str]) – External dataset ID to use when computing the insight.

  • entity_type (Optional[ENTITY_TYPES]) – The type of the entity associated with the insight. Select one of the ENTITY_TYPE enum values, or accept the default, “datarobotModel”.

  • quick_compute (Optional[bool]) – Sets whether to use quick-compute for the insight. If True or unspecified, the insight is computed using a 2500-row data sample. If False, the insight is computed using all rows in the chosen source.

  • max_wait (int) – The number of seconds to wait for the result.

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:
  • entity_id (str) – The ID of the entity to retrieve generated insights.

  • source (str) – The source type to use when retrieving the insight.

  • quick_compute (Optional[bool]) – Sets whether to retrieve the insight that was computed using quick-compute. If not specified, quick_compute is not used for matching.

Returns:

Previously computed insight.

Return type:

Self

classmethod get_as_csv(entity_id, **kwargs)

Retrieve a specific insight represented in CSV format.

Parameters:
  • entity_id (str) – ID of the entity to retrieve the insight.

  • **kwargs (Any) – Additional keyword arguments to pass to the retrieve function.

Returns:

The retrieved insight.

Return type:

str

classmethod get_as_dataframe(entity_id, **kwargs)

Retrieve a specific insight represented as a pandas DataFrame.

Parameters:
  • entity_id (str) – ID of the entity to retrieve the insight.

  • **kwargs (Any) – Additional keyword arguments to pass to the retrieve function.

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:
  • entity_id (str) – The ID of the entity to retrieve generated insights.

  • source (str) – The source type to use when retrieving the insight.

  • quick_compute (Optional[bool]) – Sets whether to retrieve the insight that was computed using quick-compute. If not specified, quick_compute is not used for matching.

  • prediction_filter_row_count (Optional[int]) – The maximum number of preview rows to return.

  • prediction_filter_percentiles (Optional[int]) – The number of percentile intervals to select from the total number of rows. This field will supersede predictionFilterRowCount if both are present.

  • prediction_filter_operand_first (Optional[float]) – The first operand to apply to filtered predictions.

  • prediction_filter_operand_second (Optional[float]) – The second operand to apply to filtered predictions.

  • prediction_filter_operator (Optional[str]) – The operator to apply to filtered predictions.

  • feature_filter_count (Optional[int]) – The maximum number of features to return for each preview.

  • feature_filter_name (Optional[str]) – The names of specific features to return for each preview.

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:
  • entity_id (str) – The ID of the entity to compute the insight.

  • source (str) – The source type to use when computing the insight.

  • data_slice_id (Optional[str]) – Data slice ID to use when computing the insight.

  • external_dataset_id (Optional[str]) – External dataset ID to use when computing the insight.

  • entity_type (Optional[ENTITY_TYPES]) – The type of the entity associated with the insight. Select one of the ENTITY_TYPE enum values, or accept the default, “datarobotModel”.

  • quick_compute (Optional[bool]) – Sets whether to use quick-compute for the insight. If True or unspecified, the insight is computed using a 2500-row data sample. If False, the insight is computed using all rows in the chosen source.

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:
  • entity_id (str) – The ID of the entity to compute the insight.

  • source (str) – The source type to use when computing the insight.

  • data_slice_id (Optional[str]) – Data slice ID to use when computing the insight.

  • external_dataset_id (Optional[str]) – External dataset ID to use when computing the insight.

  • entity_type (Optional[ENTITY_TYPES]) – The type of the entity associated with the insight. Select one of the ENTITY_TYPE enum values, or accept the default, “datarobotModel”.

  • quick_compute (Optional[bool]) – Sets whether to use quick-compute for the insight. If True or unspecified, the insight is computed using a 2500-row data sample. If False, the insight is computed using all rows in the chosen source.

  • max_wait (int) – The number of seconds to wait for the result.

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.

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

Shared link function of the models in the blender

property row_count: int | None

Number of SHAP impact rows. This is deprecated.

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:
  • entity_id (str) – The ID of the entity to compute the insight.

  • source (str) – The source type to use when computing the insight.

  • data_slice_id (Optional[str]) – Data slice ID to use when computing the insight.

  • external_dataset_id (Optional[str]) – External dataset ID to use when computing the insight.

  • entity_type (Optional[ENTITY_TYPES]) – The type of the entity associated with the insight. Select one of the ENTITY_TYPE enum values, or accept the default, “datarobotModel”.

  • quick_compute (Optional[bool]) – Sets whether to use quick-compute for the insight. If True or unspecified, the insight is computed using a 2500-row data sample. If False, the insight is computed using all rows in the chosen source.

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:
  • entity_id (str) – The ID of the entity to compute the insight.

  • source (str) – The source type to use when computing the insight.

  • data_slice_id (Optional[str]) – Data slice ID to use when computing the insight.

  • external_dataset_id (Optional[str]) – External dataset ID to use when computing the insight.

  • entity_type (Optional[ENTITY_TYPES]) – The type of the entity associated with the insight. Select one of the ENTITY_TYPE enum values, or accept the default, “datarobotModel”.

  • quick_compute (Optional[bool]) – Sets whether to use quick-compute for the insight. If True or unspecified, the insight is computed using a 2500-row data sample. If False, the insight is computed using all rows in the chosen source.

  • max_wait (int) – The number of seconds to wait for the result.

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:
  • entity_id (str) – The ID of the entity to retrieve generated insights.

  • source (str) – The source type to use when retrieving the insight.

  • quick_compute (Optional[bool]) – Sets whether to retrieve the insight that was computed using quick-compute. If not specified, quick_compute is not used for matching.

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:
  • entity_id (str) – The ID of the entity to compute the insight.

  • source (str) – The source type to use when computing the insight.

  • data_slice_id (Optional[str]) – Data slice ID to use when computing the insight.

  • external_dataset_id (Optional[str]) – External dataset ID to use when computing the insight.

  • entity_type (Optional[ENTITY_TYPES]) – The type of the entity associated with the insight. Select one of the ENTITY_TYPE enum values, or accept the default, “datarobotModel”.

  • quick_compute (Optional[bool]) – Sets whether to use quick-compute for the insight. If True or unspecified, the insight is computed using a 2500-row data sample. If False, the insight is computed using all rows in the chosen source.

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:
  • entity_id (str) – The ID of the entity to compute the insight.

  • source (str) – The source type to use when computing the insight.

  • data_slice_id (Optional[str]) – Data slice ID to use when computing the insight.

  • external_dataset_id (Optional[str]) – External dataset ID to use when computing the insight.

  • entity_type (Optional[ENTITY_TYPES]) – The type of the entity associated with the insight. Select one of the ENTITY_TYPE enum values, or accept the default, “datarobotModel”.

  • quick_compute (Optional[bool]) – Sets whether to use quick-compute for the insight. If True or unspecified, the insight is computed using a 2500-row data sample. If False, the insight is computed using all rows in the chosen source.

  • max_wait (int) – The number of seconds to wait for the result.

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:
  • entity_id (str) – The ID of the entity to retrieve generated insights.

  • source (str) – The source type to use when retrieving the insight.

  • quick_compute (Optional[bool]) – Sets whether to retrieve the insight that was computed using quick-compute. If not specified, quick_compute is not used for matching.

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