Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max on the wrong axis in _reduce_vars_sklearn #44

Closed
AndreaVidali opened this issue Feb 29, 2024 · 3 comments
Closed

Max on the wrong axis in _reduce_vars_sklearn #44

AndreaVidali opened this issue Feb 29, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@AndreaVidali
Copy link

AndreaVidali commented Feb 29, 2024

Hello, I think I found a possible bug in src/arfs/feature_selection/allrelevant.py, in function _reduce_vars_sklearn:

    # Get mean value from the shadows (max, like in Boruta, median to mitigate variance)
    mean_shadow = (
        shadow_vars.select_dtypes(include=[np.number])
        .max(skipna=True)
        .mean(skipna=True)
        / cutoff
    )

The bug is about max, which should have axis=1. Without it, It takes the maximum shap of all features, for each iteration. But I would expect the contrary, which is the maximum shap of all iteration, for each feature.

I may be wrong here, but I had to ask. Thank you!

Side note: probably that comment above the function is outdated :)

@ThomasBury ThomasBury self-assigned this Mar 2, 2024
@ThomasBury ThomasBury added question Further information is requested bug Something isn't working and removed question Further information is requested labels Mar 2, 2024
@ThomasBury
Copy link
Owner

Hi @AndreaVidali,

Thank you for your thorough review; I appreciate it. You're correct, the axis=1 argument is missing.That will be corrected in the next release.

In the original version, .mean(axis=1).mean() was used. I opted for a more aggressive approach with .max(axis=1).mean() in the current iteration.

@ThomasBury
Copy link
Owner

Solved by 945d8fc

@AndreaVidali
Copy link
Author

Thanks @ThomasBury I am glad to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants