机器学习-贝叶斯数据集
#朴素贝叶斯定力 import numpy as np import pandas as pd import matplotlib from matplotlib import pyplot as plt %matplotlib inline matplotlib.rcParams['font.sans-serif'] = ['SimHei'] data = pd.read_csv('./010-data_multivar.csv',header=None) #拆分数据 dataset_X,dataset_y = data.iloc[:,:-1],data.iloc[:,-1] # print(dataset_X.head()) dataset_X = dataset_X.values dataset_y = dataset_y.values # print(dataset_y) #将标签去重 classes = list(set(dataset_y)) print(classes) #数据集可视化 def visual_2D_dataset(dataset_X,dataset_y): '''将二维数据集dataset_X和对应的类别dataset_y显示在散点图中''' assert dataset_X.shape[1]==2,'only support dataset with