Explanation
1️⃣ Import the model
from sklearn.ensemble import RandomForestClassifierThis imports the Random Forest classification algorithm from scikit-learn.
2️⃣ Create the model object
model = RandomForestClassifier()Here, you create a Random Forest model without passing any parameters, so it uses default values.
3️⃣ Check number of trees
print(model.n_estimators)n_estimators = number of decision trees in the forest.
-
By default:
✅ Output
100Key Concept
-
Random Forest is an ensemble learning algorithm
-
It combines predictions from multiple decision trees
-
More trees → usually better accuracy (but slower training)


0 Comments:
Post a Comment