1. Learn
  2. /
  3. Courses
  4. /
  5. Dimensionality Reduction in Python

Connected

Exercise

Building a random forest model

You'll again work on the Pima Indians dataset to predict whether an individual has diabetes. This time using a random forest classifier. You'll fit the model on the training data after performing the train-test split and consult the feature importance values.

The feature and target datasets have been pre-loaded for you as X and y. Same goes for the necessary packages and functions.

Instructions

100 XP
  • Set a 25% test size to perform a 75%-25% train-test split.
  • Fit the random forest classifier to the training data.
  • Calculate the accuracy on the test set.
  • Print the feature importances per feature.