## How to Plot an ROC Curve in Python | Machine Learning in Python

In this video, I will show you how to plot the Receiver Operating Characteristic (ROC) curve in Python using the scikit-learn package. I will also you how to calculate the area under an ROC (AUROC) curve. In the tutorial, we will be comparing 2 classifiers via the ROC curve and the AUROC values.

β­ Playlist:
Check out our other videos in the following playlists.
β Data Science 101: https://bit.ly/dataprofessor-ds101
β Data Science Virtual Internship: https://bit.ly/dataprofessor-internship
β Bioinformatics: http://bit.ly/dataprofessor-bioinformatics
β Data Science Toolbox: https://bit.ly/dataprofessor-datasciencetoolbox
β Streamlit (Web App in Python): https://bit.ly/dataprofessor-streamlit
β Shiny (Web App in R): https://bit.ly/dataprofessor-shiny
β Pandas Tips and Tricks: https://bit.ly/dataprofessor-pandas
β Python Data Science Project: https://bit.ly/dataprofessor-python-ds
β R Data Science Project: https://bit.ly/dataprofessor-r-ds

β­ Subscribe:
If you’re new here, it would mean the world to me if you would consider subscribing to this channel.

β­ Recommended Tools:
Kite is a FREE AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while youβre typing. I’ve been using Kite and I love it!

β­ Recommended Books:
β Hands-On Machine Learning with Scikit-Learn : https://amzn.to/3hTKuTt
β Data Science from Scratch : https://amzn.to/3fO0JiZ
β Python Data Science Handbook : https://amzn.to/37Tvf8n
β R for Data Science : https://amzn.to/2YCPcgW
β Artificial Intelligence: The Insights You Need from Harvard Business Review: https://amzn.to/33jTdcv
β AI Superpowers: China, Silicon Valley, and the New World Order: https://amzn.to/3nghGrd

β­ Stock photos, graphics and videos used on this channel:
β https://1.envato.market/c/2346717/628379/4662

β Medium: http://bit.ly/chanin-medium
β Website: http://dataprofessor.org/ (Under construction)
β Instagram: https://www.instagram.com/data.professor/
β GitHub 1: https://github.com/dataprofessor/
β GitHub 2: https://github.com/chaninlab/

β­ Disclaimer:
Recommended books and tools are affiliate links that gives me a portion of sales at no cost to you, which will contribute to the improvement of this channel’s contents.

#dataprofessor #PCA #clustering #cluster #principalcomponentanalysis #scikit #scikitlearn #sklearn #prediction #jupyternotebook #jupyter #googlecolab #colaboratory #notebook #machinelearning #datascienceproject #randomforest #decisiontree #svm #neuralnet #neuralnetwork #supportvectormachine #python #learnpython #pythonprogramming #datascience #datamining #bigdata #datascienceworkshop #dataminingworkshop #dataminingtutorial #datasciencetutorial #ai #artificialintelligence #tutorial #dataanalytics #dataanalysis #factor #principalcomponent #principalcomponents #pc #machinelearningmodel

Source

### Comment List

• Data Professor
January 17, 2021

my god, thank u so much! been looking around for an easy ROC tutorial and this is the one!

props to you! π

• Data Professor
January 17, 2021

how to plot false negative rate with false positive rate?

• Data Professor
January 17, 2021

How to plot a ROC curve using qPCR data?

• Data Professor
January 17, 2021

thank you for the video.
I got this error while plotting:
ValueError: multi_class must be in ('ovo', 'ovr').

What can I do. And is roc is only valid for data with 2 class labels?

• Data Professor
January 17, 2021

Thank you for explaining and showing it!

• Data Professor
January 17, 2021

Really clean code. I read it and understood immediately all of it. I was only bothered by the X,Y instead of the more conventional X,y.

• Data Professor
January 17, 2021

Nice video

• Data Professor
January 17, 2021

Thank You

• Data Professor
January 17, 2021

Sir,
I am trying to run a code of iris recognition, but I get an error in the classification part of iris in roc_curve I,e " value error: multilable- indicators format not supported"

I have the link of code below
https://github.com/OmarMedhat22/Iris-Recognition-CASIA-Iris-Thousand/blob/master/iris_classification_2.ipynb

• Data Professor
January 17, 2021

Hey , Very informitive and helping video. I have one doubt though, does the Y attribute for KNN classification need to be binary in order to plot in roc curve?

• Data Professor
January 17, 2021

Ua fratΓ¨ fai tutt o mast t fai chiammΓ  Data Professor e po tien a zeppla mmocc, m par prop o frat ro cazz!!!!!

• Data Professor
January 17, 2021

I got an error
ValueError: could not convert string to float: 'data'
How can you help?

• Data Professor
January 17, 2021

can i plot roc curve from saved model ?

• Data Professor
January 17, 2021

Can we make a forest plot???????????

• Data Professor
January 17, 2021

There's only 6 thresholds from roc_curve function, how can I add more?

• Data Professor
January 17, 2021

Watching this trying to get through my internship because they expect us to know all this stuff I guess lol. Thanks brah.

• Data Professor
January 17, 2021

Awesome content. I wish you get a million subscribers within 1 year

• Data Professor
January 17, 2021

can i plot ROC with confusion matrix only?

• Data Professor
January 17, 2021

Great job! Thank you for making it simple.

• Data Professor
January 17, 2021

I want to ask you a favor. can you explain how to plot ROC curve using Image Generator(flow from directory) in classification multi classes?

• Data Professor
January 17, 2021

Amazing! Thank You!

• Data Professor
January 17, 2021

Sir with help of this i can predict knn auc score but after that when i write
r_fpr, r_tpr, _ = roc_curve(y_test, r_probs)
the above code shows error "y_true takes value in {'Abnormal', 'Normal'} and pos_label is not specified: either make y_true take value in {0, 1} or {-1, 1} or pass pos_label explicitly"
how do i solve it

• Data Professor
January 17, 2021

what to do if predict_proba is not available when probability=false

• Data Professor
January 17, 2021

Could you please show the same example using 10 fold-cv instead of train test split. Thanks

• Data Professor
January 17, 2021

Thanks you for video. Could your please suggest a book or video about machine leaning to learn?