image_output_1.png
from sklearn.ensemble import RandomForestClassifier

from sklearn.metrics import auc

from sklearn.metrics import roc_curve

from sklearn.metrics import roc_curve, auc

from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(max_depth=10)
rf.fit(x_train, y_train)
rf_predict = rf.predict(x_test)
rf_predict_prob = rf.predict_proba(x_test)

fpr, tpr, thresholds = roc_curve(y_test, rf_predict_prob[:, 1])
rf_auc = auc(fpr, tpr)
print(rf_auc)