Random Forest Classifier Calculator

Read the Theory Guide →

Enter a two-class categorical dataset, configure the three trees, and build the forest. Each tree shows its bootstrap sample, feature candidates at each split, decision-tree calculations, and prediction before the forest combines the tree predictions by majority vote.

What You Can Explore

  • Edit the categorical feature values and class labels, keeping the dataset to two classes, and fill in the Target row.
  • Set each of the three trees to Auto or switch it to Manual to control its bootstrap rows and allowed feature pool.
  • In Manual mode, enter exactly as many Row IDs as the table contains; repeated IDs are allowed. Select exactly m features for the tree's allowed feature pool.
  • Press Build Random Forest, then open each tree's tab to inspect its bootstrap sample, feature sampling, tree diagram, and step-by-step entropy and information-gain calculations.
Core Mechanics
▼
  • The Wisdom of the Crowd: A Random Forest builds hundreds of independent trees, but gives each one a slightly different, randomly drawn dataset (sampled with replacement). No single tree ever sees the whole picture!
  • Forced Diversity: At every single split, trees are only allowed to look at a random subset of features (usually d\sqrt{d}). This prevents one dominant feature from creating a forest of identical, repetitive trees.
  • The Final Vote: To make a prediction, every tree evaluates the data independently. The forest simply takes the majority vote for Classification tasks, or the exact average (mean) for Regression tasks.
  • More Trees, No Overfitting: Unlike a single decision tree, adding more trees to a forest will *never* cause it to overfit—the accuracy simply plateaus. The only penalty for adding more trees is slower computation!
Initializing Workspace...

Understanding Your Result

The forest is built from your dataset, Target row, and three tree configurations. In Auto mode, each tree receives a bootstrap sample of the rows and randomly selects m candidate features independently at every split. In Manual mode, the selected features form that tree's allowed feature pool. The final result is the majority vote of the tree predictions.

  • Forest Prediction is the majority vote of the tree predictions for your Target row. With three trees, a 2–1 vote produces the class chosen by the majority.
  • Bootstrapped Rows shows the training rows used by that tree. Repeated Row IDs mean the same original row was sampled more than once; rows that never appear are out-of-bag for that tree.
  • Feature Sampling shows the value of m and the candidate features considered at each split. In Auto mode, the candidates are drawn independently at each node from the features still available along that path.
  • Available Features can become smaller as the tree grows because a feature used for a split is removed from that path. The next candidate set is sampled from the remaining features.
  • In Manual mode, the selected features form the tree's allowed feature pool. Candidate features can only come from that pool, so a feature outside the pool cannot become a split in that tree.
  • The information-gain calculations shown in each iteration are performed only for that iteration's candidate features. Features that were available but not selected are not scored for that split.
  • A Perfectly Pure Bootstrap Sample means all sampled rows have the same class. That tree becomes a single leaf and does not need further splits.

Try These Experiments

See Feature Sampling Change by Node

Setup: Use the eight-row example dataset with four features and leave all three trees in Auto mode. Build the forest and open Tree 1.

Action: Compare the Available Features and Random Candidate Features shown for Iteration 1 and the later iterations. Then inspect the Step 2 calculations for each iteration.

What to Observe: At the root, m = 2 candidates are selected from all four available features. After the root feature is used, that feature is removed from that path, leaving three available features. A later node receives a new random selection of two candidates from those remaining features.

Takeaway: Random Forest feature sampling happens at each split, not once for the entire tree. This gives different parts of a tree different feature choices and helps create diversity between trees.

Give Every Tree All Rows

Setup: Switch all three trees to Manual. The example dataset has eight rows, and QA_Level separates the classes: Strict rows are Success and Lax rows are Fail.

Action: Enter Row IDs 1, 2, 3, 4, 5, 6, 7, 8 for every tree. For each tree, select QA_Level and one other feature as its two allowed features, then build the forest.

What to Observe: QA_Level has an Information Gain of 1 because it separates the two classes perfectly. Each tree can therefore split on QA_Level and produce pure Success and Fail branches. The Target row has Strict QA_Level, so the trees predict Success.

Takeaway: When every tree sees the same rows and has access to a feature that perfectly separates the classes, the trees can become identical. Random Forests rely on different samples and feature choices to create useful tree diversity.

Train One Tree on Only Failures

Setup: Keep Trees 2 and 3 using all eight rows. For Tree 1, stay in Manual mode and keep its two allowed features.

Action: Set Tree 1's Row IDs to 2, 4, 5, 7, 2, 4, 5, 7, then build the forest. These rows all have the Fail class.

What to Observe: Tree 1 receives a perfectly pure bootstrap sample and therefore becomes a single Fail leaf. Its prediction is Fail, while Trees 2 and 3 can still predict Success for the Target row. The forest can therefore remain Success through the majority vote.

Takeaway: A forest does not need every individual tree to make the correct prediction. Majority voting can reduce the effect of a tree trained on an unrepresentative bootstrap sample.

Rebuild the Auto Forest

Setup: Switch all three trees back to Auto mode and build the forest once. Note the Bootstrapped Rows, candidate features, and predictions.

Action: Press Build Random Forest again without changing the dataset, Target row, or tree settings. Compare the new tree tabs with the previous run.

What to Observe: The bootstrap samples are randomly generated again, and the candidate features can also change at individual split nodes. As a result, tree structures or predictions may change between builds.

Takeaway: Auto mode introduces randomness in both row bootstrapping and per-node feature selection. Use Manual mode when you need to reproduce a specific set of rows and an allowed feature pool.