1. Learn
  2. /
  3. Courses
  4. /
  5. Practicing Machine Learning Interview Questions in Python

Exercise

Feature selection through feature importance

In the last exercise, you practiced how filter and wrapper methods could be of use when selecting features in machine learning, and in machine learning interviews. In this exercise, you'll practice feature selection methods using the built-in feature importance in tree-based machine learning algorithms on the diabetes DataFrame.

Although there is only time and space to practice with a few of them on DataCamp, there is some excellent documentation available from the scikit-learn website that goes over several other ways to select features.

The feature matrix and target array are saved to your workspace as X and y, respectively.

Recall that feature selection is considered a pre-processing step: Machine learning pipeline

Instructions 1/2

undefined XP
  • 1
    • Import the correct function to instantiate a Random Forest regression model.
    • Fit the model and print feature importance.
  • 2
    • Import the correct function to instantiate an Extra Tree regression model.
    • Fit the model and print feature importance.