Aan de slagGa gratis aan de slag

Recursive Feature Elimination with random forests

You'll wrap a Recursive Feature Eliminator around a random forest model to remove features step by step. This method is more conservative compared to selecting features after applying a single importance threshold. Since dropping one feature can influence the relative importances of the others.

You'll need these pre-loaded datasets: X, X_train, y_train.

Functions and classes that have been pre-loaded for you are: RandomForestClassifier(), RFE(), train_test_split().

Deze oefening maakt deel uit van de cursus

Dimensionality Reduction in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Wrap the feature eliminator around the random forest model
rfe = ____(estimator=____, n_features_to_select=____, verbose=1)
Code bewerken en uitvoeren