Skip to content

Commit ae16933

Browse files
lionelkuschjpaillardbthirionantoinebakerAngelReyero
authored
Create a base for managing groups of features. (#357)
* separate the management of the group from base permutation * fix some error * fix tests * fix examples * fix declaration in the API * change name of groups * update docstring * fix doc * rename class * Apply suggestions from code review Co-authored-by: Joseph Paillard <[email protected]> * chaneg features to feature * rename features to feature * groups in the init * fix test * fix spelling * fix return * fix docstring * fix format * fix examples [skip tests] * add fit method * Improve docstring * fix bug * Update src/hidimstat/base_variable_importance.py Co-authored-by: bthirion <[email protected]> * fix suggestion * Apply suggestion from @bthirion Co-authored-by: bthirion <[email protected]> * Update src/hidimstat/base_variable_importance.py Co-authored-by: bthirion <[email protected]> * Update src/hidimstat/conditional_feature_importance.py Co-authored-by: bthirion <[email protected]> * fix docstring * fix docstring * error * Update condition of the string * sort features * fix a bug * fix test * fix docstring * fix tests * fix function plot * fix example * create a new check * move check_fetaure type in CFI * Update src/hidimstat/leave_one_covariate_out.py Co-authored-by: Joseph Paillard <[email protected]> * Update src/hidimstat/leave_one_covariate_out.py Co-authored-by: Joseph Paillard <[email protected]> * Update src/hidimstat/leave_one_covariate_out.py Co-authored-by: Joseph Paillard <[email protected]> * Update src/hidimstat/leave_one_covariate_out.py Co-authored-by: Joseph Paillard <[email protected]> * Update src/hidimstat/leave_one_covariate_out.py Co-authored-by: Joseph Paillard <[email protected]> * Update src/hidimstat/leave_one_covariate_out.py Co-authored-by: Joseph Paillard <[email protected]> * add option for parameters * homogeneis name for features * update * fix minimal version for test * [DOC] User guide section 3. model-agnostic methods: CFI (#402) * first commit * add section structure * [doc quick] [skip tests] skip * missing .rst? [doc quick] [skip tests] * fix link [doc quick] [skip tests] * add CFI fiirst draft and TSI [doc quick] [skip tests] * missing space? [doc quick] [skip tests] * replace space * [doc quick] [skip tests] * add ref and note section [doc quick] [skip tests] * add code snippets * typo cfi [doc quick] [skip tests] * add total sobol index ref [doc quick] [skip tests] * add copy button [doc quick] [skip tests] * missing sphinx requirements [quick doc] [skip tests] * add copybutton config * [doc quick] [skip tests] * solve example test * clarify "sub-model" for classif and regression * trry add figure + update note * add intro * try fix image path * trigger CI * try not to scale * definition * try image * [skip tests] trigger CI * [tests skip] another one * trigger CI * back to figure * add inference section * add reff * skip tests * [skip tests] * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: lionel kusch <[email protected]> * [skip tests] format bullet * rephrase not * [skip tests] * [skip tests] * [skip tests] linkcheck generated ignore images * [skip tests] linkcheck generated ignore * review * trigger CI * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> * genetic example * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> * Update docs/src/model_agnostic_methods/total_sobol_index.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: bthirion <[email protected]> * Update docs/src/model_agnostic_methods/conditional_feature_importance.rst Co-authored-by: bthirion <[email protected]> * Update docs/src/model_agnostic_methods/total_sobol_index.rst Co-authored-by: Ángel Reyero Lobo <[email protected]> --------- Co-authored-by: jpaillard <[email protected]> Co-authored-by: lionel kusch <[email protected]> Co-authored-by: Ángel Reyero Lobo <[email protected]> Co-authored-by: bthirion <[email protected]> * add an exception * Add a black line at this of the file of documentation [skip tests] --------- Co-authored-by: Joseph Paillard <[email protected]> Co-authored-by: bthirion <[email protected]> Co-authored-by: antoinebaker <[email protected]> Co-authored-by: Ángel Reyero Lobo <[email protected]>
1 parent f8b5446 commit ae16933

25 files changed

+556
-308
lines changed

docs/src/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Base Classes
1515

1616
base_variable_importance.BaseVariableImportance
1717
base_perturbation.BasePerturbation
18+
base_variable_importance.GroupVariableImportanceMixin
1819

1920
Feature Importance Classes
2021
==========================

docs/src/concepts.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
======================
55
Definition of concepts
6-
======================
6+
======================

docs/src/glm_methods.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ GLM methods
99
:maxdepth: 2
1010

1111
glm_methods/desparsified_lasso.rst
12-
glm_methods/knockoffs.rst
12+
glm_methods/knockoffs.rst

docs/src/grouping.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
==========================================
55
Measuring the importance of feature groups
6-
==========================================
6+
==========================================

docs/src/high_dimension.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
===========================
55
Inference in high dimension
6-
===========================
6+
===========================

docs/src/marginal_methods.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Marginal methods
88
.. toctree::
99
:maxdepth: 2
1010

11-
marginal_methods/leave_one_covariate_in.rst
11+
marginal_methods/leave_one_covariate_in.rst

docs/src/model_agnostic_methods/leave_one_covariate_out.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
Leave-One-Covariate-Out
66
========================
77

8-
TODO: Write this section.
8+
TODO: Write this section.

docs/src/model_agnostic_methods/total_sobol_index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ where :math:`X^{-j}` denotes the feature vector without the :math:`j^{th}` featu
1616
:math:`\mu_{-j}(X^{-j})` is the same predictive model as :math:`\mu(X)` but retrained
1717
on the reduced feature set :math:`X^{-j}`. When :math:`\mathcal{L}` is the squared loss,
1818
for a regression task, :math:`\mu_{-j}(X^{-j}) = \mathbb{E}[y | X^{-j}]` and when
19-
:math:`\mathcal{L}` is the log-loss, for a classification task, :math:`\mu_{-j}(X^{-j}) = P(y | X^{-j})`.
19+
:math:`\mathcal{L}` is the log-loss, for a classification task, :math:`\mu_{-j}(X^{-j}) = P(y | X^{-j})`.

docs/src/visualization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
=======================
55
Tools for visualization
6-
=======================
6+
=======================

examples/plot_cfi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@
7272
loss=log_loss,
7373
method="predict_proba",
7474
imputation_model_continuous=RidgeCV(),
75+
features_groups={
76+
feat_name: [i] for i, feat_name in enumerate(load_wine().feature_names)
77+
},
7578
random_state=0,
7679
)
7780
cfi.fit(
7881
X_train,
7982
y_train,
80-
groups={feat_name: [i] for i, feat_name in enumerate(load_wine().feature_names)},
8183
)
8284
importances = cfi.importance(X_test, y_test)
8385

0 commit comments

Comments
 (0)