tabensemb.model.TorchModel.cal_feature_importance#

method

TorchModel.cal_feature_importance(model_name, method, call_general_method=False, indices: Iterable | None = None, **kwargs)[source]#

Calculate feature importance using a specified model. captum or shap is called.

Parameters:
model_name

The selected model in the model base.

method

The method to calculate importance. “permutation” or “shap”.

call_general_method

Call the general feature importance calculation AbstractModel.cal_feature_importance() instead of the optimized procedure for deep learning models. This is useful when calculating the feature importance of models that require other models.

indices

The indices of data points where feature importance values are evaluated

kwargs

Arguments for tabensemb.model.AbstractModel.cal_feature_importance() or tabensemb.model.AbstractModel.cal_shap()

Returns:
attr

Values of feature importance.

importance_names

Corresponding feature names. All features including derived unstacked features will be included.