Complete the code to import the RandomForestClassifier from scikit-learn.
from sklearn.ensemble import [1]
The RandomForestClassifier is imported from sklearn.ensemble to build a random forest model.
Complete the code to create a random forest classifier with 100 trees.
model = RandomForestClassifier(n_estimators=[1])Setting n_estimators=100 creates a random forest with 100 decision trees.
Fix the error in the code to fit the model on training data X_train and y_train.
model.[1](X_train, y_train)The fit() method trains the model on the given data.
Fill both blanks to predict labels for X_test and calculate accuracy score.
predictions = model.[1](X_test) accuracy = accuracy_score(y_test, [2])
Use predict() to get predictions, then pass predictions to accuracy_score to compute accuracy.
Fill all three blanks to create a random forest with max depth 5, fit it, and predict.
model = RandomForestClassifier(n_estimators=[1], max_depth=[2]) model.[3](X_train, y_train) preds = model.predict(X_test)
Set n_estimators=100, max_depth=5, then call fit() to train the model.
