loci_importance#
- hidimstat.loci_importance(estimator, X, y, method: str = 'predict', loss: callable = <function mean_squared_error>, features_groups=None, test_statistic='ttest', k_best=None, percentile=None, threshold_min=None, threshold_max=None, n_jobs: int = 1)[source]#
Leave-One-Covariate-In (LOCI) algorithm
The model is re-fitted on each single feature/group of features. The importance is then computed as the difference between the loss of an empty model (mean for regression, and majority vote for classification) and the loss of the model on the single feature/group. For more details, see Ewald et al.[1]. Parameters ———- estimator : sklearn compatible estimator The estimator to use for the prediction. method : str, default=”predict” The method to use for the prediction. This determines the predictions passed to the loss function. Supported methods are “predict”, “predict_proba” or “decision_function”. loss : callable, default=mean_squared_error The loss function to use when comparing the perturbed model to the full model. statistical_test : callable or str, default=”ttest” Statistical test function for computing p-values of importance scores. features_groups: dict or None, default=None A dictionary where the keys are the group names and the values are the list of column names corresponding to each features group. If None, the features_groups are identified based on the columns of X. n_jobs : int, default=1 The number of jobs to run in parallel. Parallelization is done over the variables or groups of variables. X : array-like of shape (n_samples, n_features) Training data. y : array-like of shape (n_samples,) Target values. k_best : int, default=None Selects the top k features based on importance scores. percentile : float, default=None Selects features based on a specified percentile of importance scores. threshold_max : float, default=None Selects features with importance scores below the specified maximum threshold. threshold_min : float, default=None Selects features with importance scores above the specified minimum threshold.
- Returns:
- selectionndarray of shape (n_groups,)
- Boolean array indicating selected feature groups (True = selected).
- importancesndarray of shape (n_groups,)
- Feature group importance scores/test statistics.
- pvaluesndarray of shape (n_groups,)
- P-values computed for the marginal importance.