- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to plot ROC curve in Python?
ROC − Receiver operating characteristics (ROC) curve.
Using metrics.plot_roc_curve(clf, X_test, y_test) method, we can draw the ROC curve.
Generate a random n-class classification problem. This initially creates clusters of points normally distributed (std=1) about vertices of an ``n_informative``-dimensional hypercube with sides of length ``2*class_sep`` and assigns an equal number of clusters to each class.
It introduces interdependence between these features and adds various types of further noise to the data. Use the make_classification() method.
Split arrays or matrices into random trains, using train_test_split() method.
Fit the SVM model according to the given training data, using fit() method.
Plot Receiver operating characteristic (ROC) curve, using plot_roc_curve() method.
To show the figure, use plt.show() method.
import matplotlib.pyplot as plt from sklearn import datasets, metrics, model_selection, svm X, y = datasets.make_classification(random_state=0) X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, random_state=0) clf = svm.SVC(random_state=0) clf.fit(X_train, y_train) metrics.plot_roc_curve(clf, X_test, y_test) plt.show()
- How can Tensorflow be used with Estimators to visualize the data, and the ROC curve?
- How can Tensorflow and Estimator be used to find the ROC curve on titanic dataset?
- How to curve text in a polar plot in matplotlib?
- How to plot sine curve on polar axes using Matplotlib?
- How to fill the area under a curve in a Seaborn distribution plot?
- What is the ROC?
- What is ROC Curves?
- How to a plot stem plot in Matplotlib Python?
- How to fill rainbow color under a curve in Python Matplotlib?
- Yield Curve and Inverted Yield Curve
- How to draw a precision-recall curve with interpolation in Python Matplotlib?
- How to Plot Complex Numbers in Python?
- How to plot a graph in Python?
- How to create an exponential curve in R?
- How to animate a sine curve in Matplotlib?