跟着Leo机器学习:sklearn之Naive Bayes

一个很有趣的个人博客,不信你来撩 fangzengye.com



sklearn 框架

在这里插入图片描述

函数导图

在这里插入图片描述

1.9. Naive Bayes

1.9.1. Gaussian Naive Bayes

from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=0)
gnb = GaussianNB()
y_pred = gnb.fit(X_train, y_train).predict(X_test)
print("Number of mislabeled points out of a total %d points : %d"
      % (X_test.shape[0], (y_test != y_pred).sum()))

源地址

https://scikit-learn.org/stable/modules/gaussian_process.html

posted @ 2020-02-24 12:57  开源的Boy  阅读(113)  评论(0)    收藏  举报