WeCodeAcademy

Random Forests

One tree can be fickle. A random forest grows many different trees on random slices of the data and lets them vote. The crowd is usually more accurate and less prone to overfitting than any single tree. It also reports feature_importances_, showing which features mattered most.

Examplepython
Open in editor »
Quick check

Why can a forest beat a single tree?

Your turn: write the code

Train a forest of 10 trees (random_state=0) and print how many trees it contains using len(forest.estimators_).

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.