SHAP
- class datarobot.models.ShapImpact
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
- Variables:
count (
int
) – the number of SHAP Impact object returnedrow_count (
int
orNone
) – the sample size (specified in rows) to use for Shap Impact computationshap_impacts (
list
) – 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_id (
str
) – id of the project the model belongs tomodel_id (
str
) – id of the model to calculate shap impact forrow_count (
int
) – the sample size (specified in rows) to use for Feature Impact computation
- Returns:
job – 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_id (
str
) – id of the project the model belongs tomodel_id (
str
) – id of the model the SHAP impact is for
- Returns:
shap_impact – The queried instance.
- Return type:
- Raises:
ClientError – If the project or model does not exist or the SHAP impact has not been computed.