【机器学习】基于逻辑回归的癌症预测案例
1 import pandas as pd 2 import numpy as np 3 from sklearn.preprocessing import StandardScaler # 标准化 4 from sklearn.model_selection import train_test_split # 数据集拆分 5 from sklearn.linear_model import LogisticRegression 6 from sklearn.metrics import classification_report 7 from sklearn.metrics import roc_auc_score 8 9 # 加载数据 10 data = pd.read_csv( " ./breast-cancer-wisconsin.data " , header= None) 11 # print("data:\n", data) 12 # 指定其列索引名称 13 columns = [ 14 " Sample code number " , 15 " Clump Thickness " , 16 " Uniformity of Cell Size " , 17 " Uniformity of Cell Shape " , 18 " Marginal Adhesion "