Hallo Friends,
:::::::::The Error Message:::::::::
NameError Traceback (most recent call last)
in
1 # classification
----> 2 rf = RandomForestClassifier(n_estimators = n_trees, bootstrap=True)
3 rf.fit(x_feature_train, y_train)
4
5 # training metrics
NameError: name ‘n_trees’ is not defined
:::::::::::::::::::::::::The Code Below::::::::::::::::::::::::::
# classification
rf = RandomForestClassifier(n_estimators = n_trees, bootstrap=True)
rf.fit(x_feature_train, y_train)
# training metrics
y_pred_train = rf.predict(x_feature_train)
if verbose == 1:
print("Training metrics:")
print(sklearn.metrics.classification_report(y_true=y_train, y_pred=y_pred_train))
else:
train_acc = sklearn.metrics.accuracy_score(y_true=y_train, y_pred=y_pred_train)