select featuressome of the noise features are also selected let' take look at the performancein[ ]x_test_l select transform(x_testscore logisticregression(fit(x_train_l y_trainscore(x_test_l y_testprint("test score{ }format(score)out[ ]test score with the better feature selectionwe also gained some improvements here iterative feature selection in univariate testing we used no modelwhile in model-based selection we used single model to select features in iterative feature selectiona series of models are builtwith varying numbers of features there are two basic methodsstarting with no features and adding features one by one until some stopping criterion is reachedor starting with all features and removing features one by one until some stopping criterion is reached because series of models are builtthese methods are much more computationally expensive than the methods we discussed previously one particular method of this kind is recursive feature elimination (rfe)which starts with all featuresbuilds modeland discards the least important feature according to the model then new model is built using all but the discarded featureand so on until only prespecified number of features are left for this to workthe model used for selection needs to provide some way to determine feature importanceas was the case for the model-based selection herewe use the same random forest model that we used earlierand get the results shown in figure - in[ ]from sklearn feature_selection import rfe select rfe(randomforestclassifier(n_estimators= random_state= )n_features_to_select= select fit(x_trainy_trainvisualize the selected featuresmask select get_support(plt matshow(mask reshape( - )cmap='gray_r'plt xlabel("sample index" representing data and engineering features