watex.utils.plot_roc_curves#
- watex.utils.plot_roc_curves(clfs, /, X, y, names=Ellipsis, colors=Ellipsis, ncols=3, all=False, 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.
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.all (str, default=False) – if
True, plot each ROC model separatelynames (list,) – List of model names. If not given, a raw name of the model is passed instead.
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,all=True, ncols = 4 , fig_size = (10, 4))