Module connectome.visualization.group_imp
functions to calculate the group feature importance
Functions
def group_only_permutation_FI(model, Xtest, ytest, groups_df, m=10)-
group only permutation feature importance, see paper: Au, Quay, et al. "Grouped feature importance and combined features effect plot." arXiv preprint arXiv:2104.11688 (2021), section 2.2.2. Compare the metric after permuting all features jointly with he metric after permuting all features except the considered group. For more information on how to use this function within the framework, see the documentation of the viz_framework function.
Args
model- fitted model
Xtest- pd.Dataframe containing test data
ytest- pd.Series containing labels of test data
groups_df- pd.Dataframe with columns region (e.g. yeo7) and conn_name (names of connectivity matrix)
m- number of random shuffles per group, default 10
Returns
a pd.DataFrame containing the regions and the associated increase in MSE/decrease in accuracy
def grouped_permutation_FI(model, Xtest, ytest, groups_df, m=10)-
grouped permutation feature importance, see paper: Au, Quay, et al. "Grouped feature importance and combined features effect plot." arXiv preprint arXiv:2104.11688 (2021), section 2.2.1. Shuffle observations of group g and calculate metric after shuffle. For more information on how to use this function within the framework, see the documentation of the viz_framework function.
Args
model- fitted model
Xtest- pd.Dataframe containing test data
ytest- pd.Series containing labels of test data
groups_df- pd.Dataframe with columns region (e.g. yeo7) and conn_name (names of connectivity matrix)
m- number of random shuffles per group, default 10
Returns
a pd.DataFrame containing the regions and the associated increase in MSE/decrease in accuracy if features from that group are shuffled