Alternatively, we can implement random forests using scikit-learn:
In [13]: from sklearn.ensemble import RandomForestClassifier... forest = RandomForestClassifier(n_estimators=10, random_state=200)
Here, we have a number of options to customize the ensemble:
- n_estimators: This specifies the number of trees in the forest.
- criterion: This specifies the node splitting criterion. Setting criterion='gini' implements the Gini impurity, whereas setting criterion='entropy' implements information gain.
- max_features: This specifies the number (or fraction) of features to consider at each node split.
- max_depth: This specifies the maximum depth of each tree.
- min_samples: This specifies the minimum number ...