watex.view.plotLearningInspections#

watex.view.plotLearningInspections(models, X, y, fig_size=(22, 18), cv=None, savefig=None, titles=None, subplot_kws=None, **kws)[source]#

Inspect multiple models from their learning curves.

Mutiples Inspection plots that generate the test and training learning curve, the training samples vs fit times curve, the fit times vs score curve for each model.

Parameters:
  • models (list of estimator instances) – Each estimator instance implements fit and predict methods which will be cloned for each validation.

  • X (array-like of shape (n_samples, n_features)) – Training vector, where n_samples is the number of samples and n_features is the number of features.

  • y (array-like of shape (n_samples) or (n_samples, n_features)) – Target relative to X for classification or regression; None for unsupervised learning.

  • 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 y is binary or multiclass, StratifiedKFold used. If the estimator is not a classifier or if y is neither binary nor multiclass, KFold is used.

    Refer Sckikit-learn User Guide for the various cross-validators that can be used here.

  • savefig (str, default =None ,) – the path to save the figures. Argument is passed to matplotlib.Figure class.

  • kws (dict,) – Additional keywords argument passed to plotLearningInspection().

Returns:

axes

Return type:

Matplotlib axes

See also

plotLearningInspection

Inspect single model

Examples

>>> from watex.datasets import fetch_data
>>> from watex.models.premodels import p
>>> from watex.view.mlplot import plotLearningInspections
>>> # import sparse  matrix from Bagoue dataset
>>> X, y = fetch_data ('bagoue prepared')
>>> # import the two pretrained models from SVM
>>> models = [p.SVM.rbf.best_estimator_ , p.SVM.poly.best_estimator_]
>>> plotLearningInspections (models , X, y, ylim=(0.7, 1.01) )