思路:利用SVM模型,对乳腺癌进行预测
数据集来源:点击此处进行下载
数据表一共包括32字段,代表含义如下:
1、利用以下代码,可以对数据进行初步的探索
from sklearn import svm
import pandas as pd
#加载数据集
data=pd.read_csv('./data.csv')
pd.set_option('display.max_columns',None)
print(data.info())
print('*'*40)
print(data.describe())
print('*'*40)
print(data.columns)
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 569 entries, 0 to 568
Data columns (total 32 columns):
id 569 non-null int64
diagnosis 569 non-null object
radius_mean 569 non-null float64
texture_mean 569 non-null float64
perimeter_mean 569 non-null float64
area_mean 569 non-null float64
smoothness_mean 569 non-null float64
compactness_mean 569 non-null float64
concavity_mean 569 non-null float64
concave points_mean 569 non-null float64
symmetry_mean 569 non-null float64
fractal_dimension_mean 569 non-null float64
radius_se 569 non-null float64
texture_se 569 non-null float64
perimeter_se 569 non-null float64
area_se 569 non-null float64
smoothness_se 569 non-null float64
compactness_se 569 non-null float64
concavity_se 569 non-null float64
concave points_se 569 non-null float64
symmetry_se 569 non-null float64
fractal_dimension_se 569 non-null float64
radius_worst 569 non-null float64
texture_worst 569 non-null float64
perimeter_worst 569 non-null float64
area_worst 569 non-null float64
smoothness_worst 569 non-null float64
compactness_worst 569 non-null float64
concavity_worst 569 non-null float64
concave points_worst 569 non-null float64
symmetry_worst 569 non-null float64
fractal_dimension_worst 569 non-null float64
dtypes: float64(30), int64(1), object(1)
memory usage: 142.3+ KB
None
****************************************
id radius_mean texture_mean perimeter_mean area_mean \
count 5.690000e+02 569.000000 569.000000 569.000000 569.000000
mean 3.037183e+07 14.127292 19.289649 91.969033 654.889104
std 1.250206e+08 3.524049 4.301036 24.298981 351.914129
min 8.670000e+03 6.981000 9.710000 43.790000 143.500000
25% 8.692180e+05 11.700000 16.170000 75.170000 420.300000
50% 9.060240e+05 13.370000 18.840000 86.240000 551.100000
75% 8.813129e+06 15.780000 21.800000 104.100000 782.700000
max 9.113205e+08 28.110000 39.280000 188.500000 2501.000000
smoothness_mean compactness_mean concavity_mean concave points_mean \
count 569.000000 569.000000 569.000000 569.000000
mean 0.096360 0.104341 0.088799 0.048919
std 0.014064 0.052813 0.079720 0.038803
min 0.052630 0.019380 0.000000 0.000000
25% 0.086370 0.064920 0.029560 0.020310
50% 0.095870 0.092630 0.061540 0.033500
75% 0.105300 0.130400 0.130700 0.074000
max 0.163400 0.345400 0.426800 0.201200
symmetry_mean fractal_dimension_mean radius_se texture_se \
count 569.000000 569.000000 569.000000 569.000000
mean 0.181162 0.062798 0.405172 1.216853
std 0.027414 0.007060 0.277313 0.551648
min 0.106000 0.049960 0.111500 0.360200
25% 0.161900 0.057700 0.232400 0.833900
50% 0.179200 0.061540 0.324200 1.108000
75% 0.195700 0.066120 0.478900 1.474000
max 0.304000 0.097440 2.873000 4.885000
perimeter_se area_se smoothness_se compactness_se concavity_se \
count 569.000000 569.000000 569.000000 569.000000 569.000000
mean 2.866059 40.337079 0.007041 0.025478 0.031894
std 2.021855 45.491006 0.003003 0.017908 0.030186
min 0.757000 6.802000 0.001713 0.002252 0.000000
25% 1.606000 17.85