Insights
- class datarobot.insights.base.BaseInsight(id, entity_id, project_id, source, data, data_slice_id=None, external_dataset_id=None)
Base Insight class for modern insights
This class serves as a template for modern insights created using the Root Insights framework. It provides most necessary functions for easily implementing classes that wrap specific insights.
- get_uri()
This should define the URI to their browser based interactions
- Return type:
str
- sort(key_name)
Sorts insights data
- Return type:
None
- classmethod from_server_data(data, keep_attrs=None)
Override from_server_data to handle paginated responses
- Return type:
Self
- 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:
- StatusCheckJob
Status check job entity for the asynchronous insight calculation.
- Return type:
- 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:
- Self
Entity of the newly or already computed insights.
- Return type:
Self
- 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[Any]
List of newly or already computed insights.
- Return type:
List
[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:
- List[Any]
List of newly or already computed insights.
- Return type:
Self
- class datarobot.insights.ShapMatrix(id, entity_id, project_id, source, data, data_slice_id=None, external_dataset_id=None)
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:
- 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:
- StatusCheckJob
Status check job entity for the asynchronous insight calculation.
- Return type:
- 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:
- Self
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:
- datadict
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:
- List[Any]
List of newly or already computed insights.
- 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[Any]
List of newly or already 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(id, entity_id, project_id, source, data, data_slice_id=None, external_dataset_id=None)
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:
- previewList[Dict[str, Any]]
A list of the ShapPreview values for each row.
- property previews_count: int
The number of shap preview rows.
- Returns:
- 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: int, optional
The maximum number of preview rows to return.
- prediction_filter_percentiles: int, optional
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: float, optional
The first operand to apply to filtered predictions.
- prediction_filter_operand_second: float, optional
The second operand to apply to filtered predictions.
- prediction_filter_operator: str, optional
The operator to apply to filtered predictions.
- feature_filter_count: int, optional
The maximum number of features to return for each preview.
- feature_filter_name: str, optional
The names of specific features to return for each preview.
- Returns:
- List[Any]
List of newly or already computed insights.
- Return type:
Self
- 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:
- StatusCheckJob
Status check job entity for the asynchronous insight calculation.
- Return type:
- 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:
- Self
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:
- datadict
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[Any]
List of newly or already 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(id, entity_id, project_id, source, data, data_slice_id=None, external_dataset_id=None)
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:
- shap impacts
A list of the SHAP impact values
- 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 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:
- StatusCheckJob
Status check job entity for the asynchronous insight calculation.
- Return type:
- 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:
- Self
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:
- datadict
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:
- List[Any]
List of newly or already computed insights.
- 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[Any]
List of newly or already 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(id, entity_id, project_id, source, data, data_slice_id=None, external_dataset_id=None)
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:
- featuresList[Dict[str, Any]]
A list of the ShapDistributions values for each row
- property total_features_count: int
Number of shap distributions features
- Returns:
- 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:
- StatusCheckJob
Status check job entity for the asynchronous insight calculation.
- Return type:
- 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:
- Self
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:
- datadict
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:
- List[Any]
List of newly or already computed insights.
- 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[Any]
List of newly or already 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