标签:iris select pre oss target ict com data ima
from sklearn import datasets iris = datasets.load_iris() from sklearn.naive_bayes import GaussianNB gnb = GaussianNB() pred = gnb.fit(iris.data,iris.target) y_pred = pred.predict(iris.data) print (iris.data.shape[0],(iris.target != y_pred).sum())
iris.target
y_pred
from sklearn import datasets iris = datasets.load_iris() from sklearn.naive_bayes import BernoulliNB gnb = BernoulliNB() pred = gnb.fit(iris.data,iris.target) y_pred = pred.predict(iris.data) print (iris.data.shape[0],(iris.target != y_pred).sum())
iris.target
y_pred from sklearn import datasets iris = datasets.load_iris() from sklearn.naive_bayes import MultinomialNB gnb = MultinomialNB() pred = gnb.fit(iris.data,iris.target) y_pred = pred.predict(iris.data) print (iris.data.shape[0],(iris.target != y_pred).sum()) from sklearn.naive_bayes import GaussianNB from sklearn.model_selection import cross_val_score gnb=GaussianNB() scores=cross_val_score(gnb,iris.data,iris.target,cv=10) print("Accuracy:%.3f"%scores.mean()) scores
标签:iris select pre oss target ict com data ima
原文地址:https://www.cnblogs.com/ZHONGmy/p/10019348.html