第八课 机器学习简单介绍
第14节 模型测试及评价
# 引入包
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.model_selection import train_test_split
准备数据集
# 加载数据
# 乳腺癌数据集,30个特征,二分类问题:良性/恶性
data = pd.read_csv('./dataset/breast_cancer.csv')
print(data.shape)
(569, 31)
data.head()
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 ... f22 f23 f24 f25 f26 f27 f28 f29 f30 label
0 17.99 10.38 122.80 1001.0 0.11840 0.27760 0.3001 0.14710 0.2419 0.07871 ... 17.33 184.60 2019.0 0.1622 0.6656 0.7119 0.2654 0.4601 0.11890 0
1 20.57 17.77 132.90 1326.0 0.08474 0.07864 0.0869 0.07017 0.1812 0.05667 ... 23.41 158.80 1956.0 0.1238 0.1866 0.2416 0.1860 0.2750 0.08902 0
2 19.69 21.25 130.00 1203.0 0.10960 0.15990 0.1974 0.12790 0.2069 0.05999 ... 25.53 152.50 1709.0 0.1444 0.4245 0.4504