Get startedGet started for free

Exploring Random Forest Hyperparameters

Understanding what hyperparameters are available and the impact of different hyperparameters is a core skill for any data scientist. As models become more complex, there are many different settings you can set, but only some will have a large impact on your model.

You will now assess an existing random forest model (it has some bad choices for hyperparameters!) and then make better choices for a new random forest model and assess its performance.

You will have available:

  • X_train, X_test, y_train, y_test DataFrames
  • An existing pre-trained random forest estimator, rf_clf_old
  • The predictions of the existing random forest estimator on the test set, rf_old_predictions

This exercise is part of the course

Hyperparameter Tuning in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Print out the old estimator, notice which hyperparameter is badly set
print(____)

# Get confusion matrix & accuracy for the old rf_model
print("Confusion Matrix: \n\n {} \n Accuracy Score: \n\n {}".format(
  	confusion_matrix(____, ____),
  	accuracy_score(____, ____))) 
Edit and Run Code