SHAP
- class datarobot.models.ShapImpact(count, shap_impacts, row_count=None)
Represents SHAP impact score for a feature in a model.
Added in version v2.21.
Notes
SHAP impact score for a feature has the following structure:
feature_name
: (str) the feature name in datasetimpact_normalized
: (float) normalized impact score value (largest value is 1)impact_unnormalized
: (float) raw impact score value
- Attributes:
- countint
the number of SHAP Impact object returned
- row_count: int or None
the sample size (specified in rows) to use for Shap Impact computation
- shap_impactslist
a list which contains SHAP impact scores for top 1000 features used by a model
- classmethod create(cls, project_id, model_id, row_count=None)
Create SHAP impact for the specified model.
- Parameters:
- project_idstr
id of the project the model belongs to
- model_idstr
id of the model to calculate shap impact for
- row_countint
the sample size (specified in rows) to use for Feature Impact computation
- Returns:
- jobJob
an instance of created async job
- Return type:
- classmethod get(cls, project_id, model_id)
Retrieve SHAP impact scores for features in a model.
- Parameters:
- project_idstr
id of the project the model belongs to
- model_idstr
id of the model the SHAP impact is for
- Returns:
- shap_impactShapImpact
The queried instance.
- Raises:
- ClientError (404)
If the project or model does not exist or the SHAP impact has not been computed.
- Return type: