Key Concepts

Review core concepts you need to learn to master this subject

Random Forest overfitting

Random Forests are used to avoid overfitting. By aggregating the classification of multiple trees, having overfitted trees in the random forest is less impactful. Reduced overfitting translates to greater generalization capacity, which increases classification accuracy on new unseen data.

Random Forests
Lesson 1 of 1
  1. 1
    In this lesson, you’ll learn what random forests are, how the random forest algorithm works and how to implement it in scikit-learn. We’ve seen that [decision trees](https://www.codecademy.com/pat…
  2. 2
    You might be wondering how the trees in the random forest get created. After all, right now, our algorithm for creating a decision tree is deterministic — given a training set, the same tree …
  3. 3
    Random forests create different trees using a process known as bagging, which is short for bootstrapped aggregating. As we already covered bootstrapping, the process starts with creating a single d…
  4. 4
    In addition to using bootstrapped samples of our dataset, we can continue to add variety to the ways our trees are created by randomly selecting the features that are used. Recall that for our car…
  5. 5
    The two steps we walked through above, created trees on bootstrapped samples and randomly selecting features, can be combined together at the same time. This adds additional variation to the base …
  6. 6
    Now that we have covered two major ways to build trees on a resampled dataset, both in terms of samples and features, we are ready to get to the implementation of random forests! This will be simil…
  7. 7
    Just like for decision trees, we can use random forests for regression as well! It is important to know when to use which – this comes down to what type of variable your target is. Previously, we…
  8. 8
    Nice work! Here are some of the major takeaways about random forests: - A random forest is an ensemble machine learning model. It makes a classification by aggregating the classifications of many …

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo