def sk_bernoulli_demo(): x = np.random.randint(2, size=(6, 100)) y = np.array([1, 2, 3, 4, 4, 5]) clf = BernoulliNB() clf.fit(x, y) # print clf.predict(x[2:3]) print clf.predict(x[2])