Skip to content

Instantly share code, notes, and snippets.

@EdsonAvelar
Created May 22, 2019 00:34
Show Gist options
  • Select an option

  • Save EdsonAvelar/1598f790cfb42109c43a0acfb6303430 to your computer and use it in GitHub Desktop.

Select an option

Save EdsonAvelar/1598f790cfb42109c43a0acfb6303430 to your computer and use it in GitHub Desktop.
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier()
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
y_pred_probability = clf.predict_proba(X_test)[::,1]
fpr, tpr, _ = metrics.roc_curve(y_test, y_pred_probability)
auc = metrics.roc_auc_score(y_test, y_pred_probability)
plt.plot(fpr,tpr,label="RandomForest, auc="+str(auc))
plt.legend(loc=4)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment