SHAP¶
class datarobot.models.ShapImpact(count, shap_impacts, row_count=None)¶
Represents SHAP impact score for a feature in a model.
Versionadded¶
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: count : 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_impacts : 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 : id of the project the model belongs to
model_id : id of the model to calculate shap impact for
row_count
: the sample size (specified in rows) to use for Feature Impact computation
* Returns:
job
: an instance of created async job
* Return type:
Job
classmethod get(cls, project_id, model_id)¶
Retrieve SHAP impact scores for features in a model.
- Parameters: project_id : id of the project the model belongs to
model_id
: id of the model the SHAP impact is for
* Returns:
shap_impact
: The queried instance.
* Raises:
ClientError (404)
: If the project or model does not exist or the SHAP impact has not been computed.
* Return type:
ShapImpact