标签:.data gauss span class number imp ota datasets point
1 from sklearn import datasets 2 iris = datasets.load_iris() 3 from sklearn.naive_bayes import GaussianNB 4 gnb = GaussianNB() 5 y_pred = gnb.fit(iris.data, iris.target).predict(iris.data) 6 print("Number of mislabeled points out of a total %d points : %d" 7 % (iris.data.shape[0],(iris.target != y_pred).sum())) 8 9 10 from sklearn.naive_bayes import MultinomialNB 11 clf = MultinomialNB(alpha=0.5) 12 y_pred1=clf.fit(iris.data, iris.target).predict(iris.data) 13 print("Number of mislabeled points out of a total %d points : %d" 14 % (iris.data.shape[0],(iris.target != y_pred1).sum())) 15 16 a1=clf.fit(iris.data, iris.target).predict_proba(iris.data) 17 a2=clf.fit(iris.data, iris.target).predict_log_proba(iris.data)
标签:.data gauss span class number imp ota datasets point
原文地址:https://www.cnblogs.com/skyturtle/p/10178876.html