In the previous recipe, we reviewed how to use the random forest classifier. In this recipe, we'll walk through how to tune its performance by tuning its parameters.
In order to tune a random forest model, we'll need to first create a dataset that's a little more difficult to predict. Then, we'll alter the parameters and do some preprocessing to fit the dataset better.
So, let's create the dataset first:
>>> from sklearn import datasets >>> X, y = datasets.make_classification(n_samples=10000, n_features=20, n_informative=15, flip_y=.5, weights=[.2, .8])
In this recipe, we will do the following: