hidimstat.CPI¶
- class hidimstat.CPI(estimator, imputation_model, n_permutations: int = 50, loss: callable = <function root_mean_squared_error>, method: str = 'predict', random_state: int = None, n_jobs: int = 1)¶
Conditional Permutation Importance (CPI) algorithm. CHAMMA et al.[1] and for group-level see Chamma et al.[2].
- Parameters:
- estimator: scikit-learn compatible estimator
The predictive model.
- imputation_model: scikit-learn compatible estimator or list of estimators
The model(s) used to estimate the covariates. If a single estimator is provided, it will be cloned for each covariate group. Otherwise, a list of potentially different estimators can be provided, the length of the list must match the number of covariate groups.
- n_permutations: int, default=50
Number of permutations to perform.
- loss: callable, default=root_mean_squared_error
Loss function to evaluate the model performance.
- method: str, default=’predict’
Method to use for predicting values that will be used to compute the loss and the importance scores. The method must be implemented by the estimator. Supported methods are ‘predict’, ‘predict_proba’, ‘decision_function’ and ‘transform’.
- random_state: int, default=None
Random seed for the permutation.
- n_jobs: int, default=1
Number of jobs to run in parallel.
References
- __init__(estimator, imputation_model, n_permutations: int = 50, loss: callable = <function root_mean_squared_error>, method: str = 'predict', random_state: int = None, n_jobs: int = 1)¶
Methods
__init__
(estimator, imputation_model[, ...])fit
(X[, y, groups])Fit the covariate estimators to predict each group of covariates from the others.
get_metadata_routing
()Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
predict
(X[, y])Compute the prediction of the model with perturbed data for each group.
score
(X, y)Compute the importance scores for each group of covariates.
set_fit_request
(*[, groups])Request metadata passed to the
fit
method.set_params
(**params)Set the parameters of this estimator.