watex.view.plotLearningInspection#
- watex.view.plotLearningInspection(model, X, y, axes=None, ylim=None, cv=5, n_jobs=None, train_sizes=None, display_legend=True, title=None)[source]#
Inspect model from its learning curve.
Generate 3 plots: the test and training learning curve, the training samples vs fit times curve, the fit times vs score curve.
- Parameters:
model (estimator instance) – An estimator instance implementing fit and predict methods which will be cloned for each validation.
title (str) – Title for the chart.
X (array-like of shape (n_samples, n_features)) – Training vector, where
n_samplesis the number of samples andn_featuresis the number of features.y (array-like of shape (n_samples) or (n_samples, n_features)) – Target relative to
Xfor classification or regression; None for unsupervised learning.axes (array-like of shape (3,), default=None) – Axes to use for plotting the curves.
ylim (tuple of shape (2,), default=None) – Defines minimum and maximum y-values plotted, e.g. (ymin, ymax).
cv (int, cross-validation generator or an iterable, default=None) –
Determines the cross-validation splitting strategy. Possible inputs for cv are:
None, to use the default 5-fold cross-validation,
integer, to specify the number of folds.
CV splitter,
An iterable yielding (train, test) splits as arrays of indices.
For integer/None inputs, if
yis binary or multiclass,StratifiedKFoldused. If the estimator is not a classifier or ifyis neither binary nor multiclass,KFoldis used.Refer User Guide for the various cross-validators that can be used here.
n_jobs (int or None, default=None) – Number of jobs to run in parallel.
Nonemeans 1 unless in ajoblib.parallel_backendcontext.-1means using all processors. See Glossary for more details.train_sizes (array-like of shape (n_ticks,)) – Relative or absolute numbers of training examples that will be used to generate the learning curve. If the
dtypeis float, it is regarded as a fraction of the maximum size of the training set (that is determined by the selected validation method), i.e. it has to be within (0, 1]. Otherwise it is interpreted as absolute sizes of the training sets. Note that for classification the number of samples usually have to be big enough to contain at least one sample from each class. (default: np.linspace(0.1, 1.0, 5))display_legend (bool, default ='True') – display the legend
- Returns:
axes
- Return type:
Matplotlib axes
Examples
>>> from watex.datasets import fetch_data >>> from watex.models import p >>> from watex.view.mlplot import plotLearningInspection >>> # import sparse matrix from Bagoue datasets >>> X, y = fetch_data ('bagoue prepared') >>> # import the pretrained Radial Basis Function (RBF) from SVM >>> plotLearningInspection (p.SVM.rbf.best_estimator_ , X, y )