注:本人纯粹为了练手熟悉各个方法的用法
使用高斯朴素贝叶斯对鸢尾花数据进行分类
代码:
1 # 通过朴素贝叶斯对鸢尾花数据进行分类 2 3 from sklearn import datasets 4 from sklearn.model_selection import train_test_split 5 from sklearn.naive_bayes import MultinomialNB, GaussianNB 6 import matplotlib.pyplot as plt 7 import numpy as np 8 import matplotlib as mpl 9 from sklearn.preprocessing import StandardScaler 10 from sklearn.pipeline import Pipeline 11 12 iris = datasets.load_iris() # 加载鸢尾花数据 13 iris_x = iris.data