c2v.utils.correct_shap#
- c2v.utils.correct_shap(shapdata, shap_key='mean_shap', corr_key='gex_r', correct_sign=True, normalize=False, key_added=None)#
Correct SHAP values by dividing by the maximum absolute value of SHAP values for each feature.
- Parameters:
- shapdata sc.AnnData
AnnData object with SHAP values in varm[shap_key].
- shap_key str, optional
Key in varm to store SHAP values. Default is “mean_shap”.
- corr_key str, optional
Key in varm to store correlation values. Default is “gex_r”.
- correct_sign bool, optional
Whether to correct the sign of SHAP values based on the correlation sign. Default is True.
- normalize bool, optional
Whether to normalize SHAP values by dividing by the maximum absolute value for each prediction column. Default is True.
- key_added str, optional
Key in varm to store normalized SHAP values. Default is “norm_mean_shap”.
- Return type:
- Returns:
None Corrected SHAP values are stored in varm[key_added].