plot_learning_curve with examples#
An example showing the plot_learning_curve
function
used by a scikit-learn classifier.
9 # Authors: The scikit-plots developers
10 # SPDX-License-Identifier: BSD-3-Clause
Import scikit-plots#
16 from sklearn.datasets import (
17 load_digits as data_10_classes,
18 )
19 from sklearn.linear_model import LogisticRegression
20
21 import numpy as np
22
23 np.random.seed(0) # reproducibility
24 # importing pylab or pyplot
25 import matplotlib.pyplot as plt
26
27 # Import scikit-plot
28 import scikitplot as sp
Loading the dataset#
34 # Load the data
35 X, y = data_10_classes(return_X_y=True, as_frame=False)
Model Training#
41 # Create an instance of the LogisticRegression
42 model = LogisticRegression(max_iter=int(1e5), random_state=0)
Plot!#
48 # Plot!
49 ax = sp.estimators.plot_learning_curve(
50 model,
51 X,
52 y,
53 save_fig=True,
54 save_fig_filename="",
55 # overwrite=True,
56 add_timestamp=True,
57 # verbose=True,
58 )

Total running time of the script: (0 minutes 1.393 seconds)
Related examples