Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f3a5e0a
separate the management of the group from base permutation
lionelkusch Aug 27, 2025
508ce53
fix some error
lionelkusch Aug 27, 2025
08565c0
fix tests
lionelkusch Aug 27, 2025
bb969c4
fix examples
lionelkusch Aug 27, 2025
3c290d3
fix declaration in the API
lionelkusch Aug 27, 2025
4881d1a
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 1, 2025
cdc963c
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 8, 2025
71bb5e7
change name of groups
lionelkusch Sep 10, 2025
7dae4f8
update docstring
lionelkusch Sep 10, 2025
a3b2da8
fix doc
lionelkusch Sep 10, 2025
ead61c7
rename class
lionelkusch Sep 12, 2025
f8aeefd
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 12, 2025
999d0c8
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 12, 2025
a410e13
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 17, 2025
0f46825
Apply suggestions from code review
lionelkusch Sep 17, 2025
d65e375
Merge branch 'PR_create_group_base' of https://github.com/lionelkusch…
lionelkusch Sep 17, 2025
9df1d1a
chaneg features to feature
lionelkusch Sep 17, 2025
eea423b
rename features to feature
lionelkusch Sep 17, 2025
4f1b61a
groups in the init
lionelkusch Sep 17, 2025
142f93c
fix test
lionelkusch Sep 17, 2025
6248e1a
fix spelling
lionelkusch Sep 17, 2025
77d0279
fix return
lionelkusch Sep 17, 2025
5c85a37
fix docstring
lionelkusch Sep 17, 2025
52b610b
fix format
lionelkusch Sep 17, 2025
bed1460
fix examples
lionelkusch Sep 17, 2025
29d6774
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 24, 2025
f0c94d4
add fit method
lionelkusch Sep 24, 2025
bfbb943
Improve docstring
lionelkusch Sep 24, 2025
4b53325
fix bug
lionelkusch Sep 24, 2025
e5cc1bd
Update src/hidimstat/base_variable_importance.py
lionelkusch Sep 25, 2025
a0b24cd
fix suggestion
lionelkusch Sep 25, 2025
ea7dec7
Apply suggestion from @bthirion
lionelkusch Sep 26, 2025
67e8c89
Update src/hidimstat/base_variable_importance.py
lionelkusch Sep 26, 2025
19b4988
Update src/hidimstat/conditional_feature_importance.py
lionelkusch Sep 26, 2025
9bbb5b5
fix docstring
lionelkusch Sep 26, 2025
c91e698
fix docstring
lionelkusch Sep 26, 2025
ab1d864
error
lionelkusch Sep 26, 2025
a3765a1
Update condition of the string
lionelkusch Sep 26, 2025
6ab4f50
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 26, 2025
c64b6dd
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 29, 2025
1584abb
sort features
lionelkusch Sep 29, 2025
d7f65a8
fix a bug
lionelkusch Sep 29, 2025
ea8415a
fix test
lionelkusch Sep 29, 2025
365ce09
fix docstring
lionelkusch Sep 29, 2025
5f4f7ad
Merge branch 'main' into PR_create_group_base
lionelkusch Sep 30, 2025
f44c270
fix tests
lionelkusch Sep 30, 2025
02c7276
fix function plot
lionelkusch Sep 30, 2025
ec13d80
fix example
lionelkusch Sep 30, 2025
08cce29
create a new check
lionelkusch Oct 1, 2025
4134bde
move check_fetaure type in CFI
lionelkusch Oct 1, 2025
b42eb16
Merge branch 'main' into PR_create_group_base
lionelkusch Oct 1, 2025
d7c2b55
Merge branch 'main' into PR_create_group_base
lionelkusch Oct 2, 2025
639247b
Update src/hidimstat/leave_one_covariate_out.py
lionelkusch Oct 3, 2025
3dded6f
Update src/hidimstat/leave_one_covariate_out.py
lionelkusch Oct 3, 2025
956b177
Update src/hidimstat/leave_one_covariate_out.py
lionelkusch Oct 3, 2025
b29c48a
Update src/hidimstat/leave_one_covariate_out.py
lionelkusch Oct 3, 2025
1aa36f8
Update src/hidimstat/leave_one_covariate_out.py
lionelkusch Oct 3, 2025
7d79d87
Update src/hidimstat/leave_one_covariate_out.py
lionelkusch Oct 3, 2025
269fba1
add option for parameters
lionelkusch Oct 3, 2025
dcf3d5f
Merge branch 'main' into PR_create_group_base
lionelkusch Oct 3, 2025
5c21a11
homogeneis name for features
lionelkusch Oct 3, 2025
77e00d7
update
lionelkusch Oct 3, 2025
93285bc
fix minimal version for test
lionelkusch Oct 3, 2025
0463a83
Merge branch 'main' into PR_create_group_base
jpaillard Oct 5, 2025
7b6acab
[DOC] User guide section 3. model-agnostic methods: CFI (#402)
antoinebaker Oct 7, 2025
40c2fd4
add an exception
lionelkusch Oct 9, 2025
cdd28e1
Merge branch 'main' into PR_create_group_base
lionelkusch Oct 9, 2025
a483f06
Add a black line at this of the file of documentation
lionelkusch Oct 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Base Classes

base_variable_importance.BaseVariableImportance
base_perturbation.BasePerturbation
base_variable_importance.GroupVariableImportanceMixin

Feature Importance Classes
==========================
Expand Down
2 changes: 1 addition & 1 deletion docs/src/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

======================
Definition of concepts
======================
======================
2 changes: 1 addition & 1 deletion docs/src/glm_methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ GLM methods
:maxdepth: 2

glm_methods/desparsified_lasso.rst
glm_methods/knockoffs.rst
glm_methods/knockoffs.rst
2 changes: 1 addition & 1 deletion docs/src/grouping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

==========================================
Measuring the importance of feature groups
==========================================
==========================================
2 changes: 1 addition & 1 deletion docs/src/high_dimension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

===========================
Inference in high dimension
===========================
===========================
2 changes: 1 addition & 1 deletion docs/src/marginal_methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Marginal methods
.. toctree::
:maxdepth: 2

marginal_methods/leave_one_covariate_in.rst
marginal_methods/leave_one_covariate_in.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
Leave-One-Covariate-Out
========================

TODO: Write this section.
TODO: Write this section.
2 changes: 1 addition & 1 deletion docs/src/model_agnostic_methods/total_sobol_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ where :math:`X^{-j}` denotes the feature vector without the :math:`j^{th}` featu
:math:`\mu_{-j}(X^{-j})` is the same predictive model as :math:`\mu(X)` but retrained
on the reduced feature set :math:`X^{-j}`. When :math:`\mathcal{L}` is the squared loss,
for a regression task, :math:`\mu_{-j}(X^{-j}) = \mathbb{E}[y | X^{-j}]` and when
:math:`\mathcal{L}` is the log-loss, for a classification task, :math:`\mu_{-j}(X^{-j}) = P(y | X^{-j})`.
:math:`\mathcal{L}` is the log-loss, for a classification task, :math:`\mu_{-j}(X^{-j}) = P(y | X^{-j})`.
2 changes: 1 addition & 1 deletion docs/src/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

=======================
Tools for visualization
=======================
=======================
4 changes: 3 additions & 1 deletion examples/plot_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@
loss=log_loss,
method="predict_proba",
imputation_model_continuous=RidgeCV(),
features_groups={
feat_name: [i] for i, feat_name in enumerate(load_wine().feature_names)
},
random_state=0,
)
cfi.fit(
X_train,
y_train,
groups={feat_name: [i] for i, feat_name in enumerate(load_wine().feature_names)},
)
importances = cfi.importance(X_test, y_test)

Expand Down
34 changes: 24 additions & 10 deletions examples/plot_importance_classification_iris.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def run_one_fold(
train_index,
test_index,
vim_name="CFI",
groups=None,
features_groups=None,
):
model_c = clone(model)
model_c.fit(X[train_index], y[train_index])
Expand All @@ -94,6 +94,7 @@ def run_one_fold(
random_state=2,
method=method,
loss=loss,
features_groups=features_groups,
)
elif vim_name == "PFI":
vim = PFI(
Expand All @@ -102,14 +103,15 @@ def run_one_fold(
random_state=3,
method=method,
loss=loss,
features_groups=features_groups,
)

vim.fit(X[train_index], y[train_index], groups=groups)
vim.fit(X[train_index], y[train_index])
importance = vim.importance(X[test_index], y[test_index])["importance"]

return pd.DataFrame(
{
"feature": groups.keys(),
"feature": features_groups.keys(),
"importance": importance,
"vim": vim_name,
"model": model_name,
Expand Down Expand Up @@ -140,10 +142,16 @@ def run_one_fold(
),
]
cv = KFold(n_splits=5, shuffle=True, random_state=6)
groups = {ft: [i] for i, ft in enumerate(dataset.feature_names)}
features_groups = {ft: [i] for i, ft in enumerate(dataset.feature_names)}
out_list = Parallel(n_jobs=5)(
delayed(run_one_fold)(
X, y, model, train_index, test_index, vim_name=vim_name, groups=groups
X,
y,
model,
train_index,
test_index,
vim_name=vim_name,
features_groups=features_groups,
)
for train_index, test_index in cv.split(X)
for model in models
Expand Down Expand Up @@ -279,16 +287,22 @@ def plot_results(df_importance, df_pval):
# mitigate this issue, we can group correlated features together and measure the
# importance of these feature groups. For instance, we can group 'sepal width' with
# 'sepal length' and 'petal length' with 'petal width' and the spurious feature.
groups = {"sepal features": [0, 1], "petal features": [2, 3, 4]}
features_groups = {"sepal features": [0, 1], "petal features": [2, 3, 4]}
out_list = Parallel(n_jobs=5)(
delayed(run_one_fold)(
X, y, model, train_index, test_index, vim_name=vim_name, groups=groups
X,
y,
model,
train_index,
test_index,
vim_name=vim_name,
features_groups=features_groups,
)
for train_index, test_index in cv.split(X)
for model in models
for vim_name in ["CFI", "PFI"]
)

df_grouped = pd.concat(out_list)
df_pval = compute_pval(df_grouped, threshold=threshold)
plot_results(df_grouped, df_pval)
df_features_grouped = pd.concat(out_list)
df_pval = compute_pval(df_features_grouped, threshold=threshold)
plot_results(df_features_grouped, df_pval)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ style = ["black >= 24.4.2", "codespell >=2.4.0", "isort >= 5.13.2"]
test = [
"coverage >= 6.0, < 8",
"iniconfig >= 0.1, < 3",
"matplotlib >= 3.1.0, < 4",
"matplotlib >= 3.4.0, < 4",
"packaging >= 14.0, < 100",
"pytest >= 8.0, < 9",
"pytest-cov >= 5.0, < 8",
Expand Down
Loading