Running a model using ranges
You have just finished creating a list of hyperparameters and ranges to use when tuning a predictive model for an assignment. You have used max_depth
, min_samples_split
, and max_features
as your range variable names.
This exercise is part of the course
Model Validation in Python
Exercise instructions
- Randomly select a
max_depth
,min_samples_split
, andmax_features
using your range variables. - Print out all of the parameters for
rfr
to see which values were randomly selected.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
from sklearn.ensemble import RandomForestRegressor
# Fill in rfr using your variables
rfr = RandomForestRegressor(
n_estimators=100,
max_depth=random.____(____),
min_samples_split=random.____(____),
max_features=random.____(____))
# Print out the parameters
print(rfr.____)