classifier model the feature selection got better compared to the univariate and model-based selectionbut one feature was still missed running this code also takes significantly longer than that for the model-based selectionbecause random forest model is trained timesonce for each feature that is dropped let' test the accuracy of the logistic regression model when using rfe for feature selectionin[ ]x_train_rfeselect transform(x_trainx_test_rfeselect transform(x_testscore logisticregression(fit(x_train_rfey_trainscore(x_test_rfey_testprint("test score{ }format(score)out[ ]test score we can also use the model used inside the rfe to make predictions this uses only the feature set that was selectedin[ ]print("test score{ }format(select score(x_testy_test))out[ ]test score herethe performance of the random forest used inside the rfe is the same as that achieved by training logistic regression model on top of the selected features in other wordsonce we've selected the right featuresthe linear model performs as well as the random forest if you are unsure when selecting what to use as input to your machine learning algorithmsautomatic feature selection can be quite helpful it is also great for reducing the amount of features needed--for exampleto speed up prediction or to allow for more interpretable models in most real-world casesapplying feature selection is unlikely to provide large gains in performance howeverit is still valuable tool in the toolbox of the feature engineer automatic feature selection