-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
Allow for multiple scoring metrics in RFECV
#28937
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
Allow for multiple scoring metrics in RFECV
#28937
Comments
For your "Considerations" section, I wonder if it makes sense to also adopt the (Maybe this should keep in mind #21291 too?) |
This sounds like a legitimate need that cannot be efficiently be addressed with the current API as far as I understand. So we could indeed consider expanding https://scikit-learn.org/stable/auto_examples/model_selection/plot_grid_search_digits.html |
Did we improve a bit the situation by merging: #28360 |
With #28360 the situation is much improved, but we need to be able to understand multiple metrics the same way as This is related to #28944 for me too, since we're choosing sth based on certain metrics values while understanding multiple metrics. |
Workflow
In its current state,
RFECV
only allows for a single scoring metric. In my opinion, calculating multiple scores on each model using k <= K features would be extremely valuable.For example, if I wanted to study how the precision and recall metrics of a binary classifier evolve as I feed less and less features to a model, I would have to run
RFECV
twice: one withscoring='precision'
and another withscoring='recall'
.This is inefficient, as it implies running RFECV twice instead of once.
The
cv_results_
attribute ofGridSearchCV
returns one rank per metric used to evaluate each combination of hyperparameters. Replicating this behavior inRFECV
would be extremely helpful.Proposed solution
Notation
min_features_to_select
<= p <= P.Solution
User can pass a list of strings representing M predefined scoring metrics and at each step, the algorithm stores the performance metric of the k models trained with p <= P features.
The
cv_results_
attribute of the resultingRFECV
would now include the following keys for each metric m and fold k:'split{k}_test_{m}'
mean_test_{m}
'std_test_{m}'
'rank_test_{m}'
Example
Considerations
It is likely that
rank_test_{m1}
will differ fromrank_test_{m2}
for any pair of performance metrics m1 and m2. Hence, adding this feature will no longer allow RFECV to automatically pick the best number of features, as the rankings can differ from one metric to another. This part of the workflow would be up to the user.Describe alternatives you've considered, if relevant
Running
RFECV
as many times as there are metrics.Additional context
I asked this question on StackOverflow and the community agrees that the most viable way to do this is to run one RFECV per performance metric I need to evaluate.
The text was updated successfully, but these errors were encountered: