April 2017
Beginner to intermediate
358 pages
9h 30m
English
Random forests in scikit-learn use the Estimator interface, allowing us to use almost the exact same code as before to do cross-fold validation:
from sklearn.ensemble import RandomForestClassifierclf = RandomForestClassifier(random_state=14)scores = cross_val_score(clf, X_teams, y_true, scoring='accuracy')print("Accuracy: {0:.1f}%".format(np.mean(scores) * 100))
This results in an immediate benefit of 65.3 percent, up by 2.5 points by just swapping the classifier.
Random forests, using subsets of the features, should be able to learn more effectively with more features than normal decision trees. We can test this by throwing more features at the algorithm and seeing how it goes:
X_all = np.hstack([X_lastwinner, ...
Read now
Unlock full access