Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plotting roc curve

# Import necessary modules
from sklearn.metrics import roc_curve

# Compute predicted probabilities: y_pred_prob
y_pred_prob = logreg.predict_proba(X_test)[:,1]

# Generate ROC curve values: fpr, tpr, thresholds
fpr, tpr, thresholds = roc_curve(y_test, y_pred_prob)

# Plot ROC curve
plt.plot([0, 1], [0, 1], 'k--')
plt.plot(fpr, tpr)
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('ROC Curve')
plt.show()
Comment

roc auc score plotting

import scikitplot as skplt
import matplotlib.pyplot as plt

y_true = # ground truth labels
y_probas = # predicted probabilities generated by sklearn classifier
skplt.metrics.plot_roc_curve(y_true, y_probas)
plt.show()
Comment

roc auc score

# Import roc_auc_score
from sklearn.metrics import roc_auc_score

# Calculate roc_auc_score
print(roc_auc_score(y_test, y_pred_probs))
Comment

PREVIOUS NEXT
Code Example
Python :: python read binary 
Python :: how to make timer in python 
Python :: pandas description of dataframe renaming column values 
Python :: tkinter change button state 
Python :: insert list python 
Python :: python dict sortieren 
Python :: list to csv python 
Python :: python sleep timer 
Python :: from one hot encoding to integer python 
Python :: distance matrix gogle map python 
Python :: classification cross validation 
Python :: how to install package offline 
Python :: python autoclicker 
Python :: Python message popup 
Python :: python time limit for input 
Python :: legend for pie chart matplotlib 
Python :: scrape email in a list from website python 
Python :: private instance attribute python 
Python :: python counter nested dictionary 
Python :: python remove one element from numpy array 
Python :: python print function 
Python :: install fastapi 
Python :: monty hall problem in python 
Python :: pyspark add_months 
Python :: find keys to minimum value in dict 
Python :: datetime from float python 
Python :: flask api 
Python :: numpy multiply element wise 
Python :: python returned non-zero exit status 1. 
Python :: gradient descent python 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =