watex.utils.plot_roc_curves#
- watex.utils.plot_roc_curves(clfs, /, X, y, names=Ellipsis, colors=Ellipsis, ncols=3, score=False, kind='inone', ax=None, fig_size=(7, 7), **roc_kws)[source]#
Quick plot of Receiving Operating Characterisctic (ROC) of fitted models
- Parameters
clfs (list,) – list of models for ROC evaluation. Model should be a scikit-learn or XGBoost estimators
X ({array-like, sparse matrix} of shape (n_samples, n_features)) – Training instances to cluster. It must be noted that the data will be converted to C ordering, which will cause a memory copy if the given data is not C-contiguous. If a sparse matrix is passed, a copy will be made if it’s not in CSR format.
y (ndarray or Series of length (n_samples, )) – An array or series of target or class values. Preferably, the array represent the test class labels data for error evaluation.
names (list,) – List of model names. If not given, a raw name of the model is passed instead.
kind (str, default='inone') –
If
['individual'|'2'|'single'], plot each ROC model separately. Any other value, group of ROC curves into a single plot.Changed in version 0.2.5: Parameter all is deprecated and replaced by kind. It henceforth accepts arguments
allinone|1|groupedorindividual|2|singlefor plotting mutliple ROC curves in one or separate each ROC curves respecively.colors (str, list) – Colors to specify each model plot.
ncols (int, default=3) – Number of plot to be placed inline before skipping to the next column. This is feasible if many is set to
True.score (bool,default=False) –
Append the Area Under the curve score to the legend.
New in version 0.2.4.
kws (dict,) – keyword argument of :func:`sklearn.metrics.roc_curve
- Returns
ax
- Return type
Axes.Subplot.
Examples
>>> from watex.utils.plotutils import plot_roc_curves >>> from sklearn.datasets import make_moons >>> from watex.exlib import ( train_test_split, KNeighborsClassifier, SVC , XGBClassifier, LogisticRegression ) >>> X, y = make_moons (n_samples=2000, noise=0.2) >>> X, Xt, y, yt = train_test_split (X, y, test_size=0.2) >>> clfs = [ m().fit(X, y) for m in ( KNeighborsClassifier, SVC , XGBClassifier, LogisticRegression)] >>> plot_roc_curves(clfs, Xt, yt) Out[66]: <AxesSubplot:xlabel='False Positive Rate (FPR)', ylabel='True Positive Rate (FPR)'> >>> plot_roc_curves(clfs, Xt, yt,kind='2', ncols = 4 , fig_size = (10, 4))