10 Random Forest
10 Random Forest
Random Forest
What is Random Forest Prof. Kailash Singh
MNIT Jaipur
• Step 1: Bootstrapping
– Draw several bootstrapped samples from the training data
(sampling with replacement).
– Build a decision tree from each bootstrapped sample.
• Step 2: Random Feature Selection
– For each node in a tree, instead of considering all features,
select a random subset of features and choose the best one.
– This process reduces correlation between individual trees,
making the model more robust.
• Step 3: Tree Voting/Averaging
– In classification, trees "vote" for the class.
– In regression, each tree produces a numeric prediction, and the
average of these predictions becomes the final result.
Random Forest Hyperparameters Prof. Kailash Singh
MNIT Jaipur
# Evaluate model
print(f"Accuracy: {accuracy_score(y_test, y_pred)}")
Advantages of Random Forest Prof. Kailash Singh
MNIT Jaipur