Created
May 1, 2017 09:47
-
-
Save tranghaviet/400324f56fd1557ca4caa55bd11316d5 to your computer and use it in GitHub Desktop.
A GaussianNB example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]) | |
Y = np.array([1, 1, 1, 2, 2, 2]) | |
from sklearn.naive_bayes import GaussianNB | |
clf = GaussianNB() | |
clf.fit(X, Y) | |
print(clf.predict([[-0.8, -1]])) | |
clf_pf = GaussianNB() | |
clf_pf.partial_fit(X, Y, np.unique(Y)) | |
print(clf_pf.predict([[-0.8, -1]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment