feature_selection: select by individual feature performance with a ML algo
A transformer that implements this:
https://github.com/solegalli/feature-selection-for-machine-learning/blob/master/06-Filter-other-metrics/06.1-Univariate-roc-auc.ipynb
Should be able to take pretty much any ML algorithm
can you assign this to me?
With pleasure :)
Please checkout the develop branch (not master) and make the PR to that branch, as I am currently refactoring code, and the modules have changed their names.
This transformer should allow the user to decide which ML model they want to use, and which metric (if possible). So we need to think a bit how to play with this, because some metrics are better when they are smaller, and some when they are bigger.
Look forward to the PR :)
Please reference the issue in the PR.
@rupeshpalwadi any news on the development of this feature?
@NicoGalli
this one is more complicated than correlated, but there is a template that we could use to create the transformer. See for example this: https://github.com/solegalli/feature_engine/blob/master/feature_engine/selection/shuffle_features.py
The idea is:
for feature in X.variables: (so feature per feature)
train a machine learning model using the cross_validate function from sklearn: https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.cross_validate.html
cross_validate takes any machine learning model available in sklearn as input, any metric available in sklearn as input, a cross validation fold (please do a quick search to understand what this is) and it returns trained machine lerning model if return_estimator=True. and the model performance.
https://github.com/solegalli/feature_engine/blob/master/feature_engine/selection/shuffle_features.py you can see how we call all of these
So, as I was saying, feature per feature, using cross_validate, train a machine learning model (user enters this) with the single feature, against the target). Determine the performance and store it
the fit attributes should be a dictionary of feature:performance pairs and the selected features. Selected features are those which performance is above a threshold, the threshold is defined by the user.
The code should be a simpler version of the shuffle_features.
I would say, make an initial PR with whatever you understand from all of what I am saying and we take it from there :)
OK @solegalli I will give it a try. Would you please assign the issue to me? Thanks, N.-