In [12]:
import sys 
sys.path.append("../..")

import numpy as np
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from sklearn.datasets import load_digits
from sklearn.model_selection import ShuffleSplit

Data Loading


In [2]:
digits = load_digits()
X, y = digits.data, digits.target

Configuration


In [3]:
# Set the train sizes 
train_sizes = np.linspace(.1, 1.0, 10)

Visualizers


In [4]:
from yellowbrick.classifier.learning_curve import LearningCurveVisualizer

Visualizing using GaussianNB


In [5]:
viz = LearningCurveVisualizer(GaussianNB())
viz.fit(X,y)
viz.show()


Visualizing using GaussianNB with Varying Training Samples


In [10]:
viz = LearningCurveVisualizer(GaussianNB(), train_sizes=np.linspace(.1, 1.0, 15))
viz.fit(X,y)
viz.show()


Visualizing using GaussianNB with Varying Training Samples and Cross Validation


In [14]:
viz = LearningCurveVisualizer(GaussianNB(), 
                              train_sizes=np.linspace(.1, 1.0, 15),
                              cv = ShuffleSplit(n_splits=100, test_size=0.2, random_state=0))
viz.fit(X,y)
viz.show()


Visualizing using SVC with Varying Training Samples and Cross Validation


In [20]:
viz = LearningCurveVisualizer(SVC(kernel='linear'), 
                              train_sizes=np.linspace(0.1, 1.0, 5),
                              cv = ShuffleSplit(n_splits=100, test_size=0.2, random_state=0))
viz.fit(X,y)
viz.show()



In [ ]: