UCI乳腺癌数据集下载
时间: 2023-09-19 09:05:42 浏览: 60
UCI乳腺癌数据集可以在UCI Machine Learning Repository上下载。以下是下载链接:
https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+(Diagnostic)
该数据集包含569个样本,每个样本有30个特征。其中,前10个特征是与乳腺肿块质地、边缘、密度等相关的数字特征,后20个特征是对这些数字特征的标准误差、最坏值等进行的计算结果。每个样本都被标记为良性(B)或恶性(M)。
相关问题
使用UCI库乳腺癌数据集代码
以下是使用UCI库乳腺癌数据集的Python代码示例:
```python
import pandas as pd
import numpy as np
from sklearn.datasets import load_breast_cancer
# 加载UCI乳腺癌数据集
data = load_breast_cancer()
# 将数据集转换为pandas DataFrame格式
df = pd.DataFrame(np.c_[data['data'], data['target']],
columns=np.append(data['feature_names'], ['target']))
# 打印数据集信息
print(df.info())
# 打印数据集前5行
print(df.head())
```
输出结果如下:
```
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 569 entries, 0 to 568
Data columns (total 31 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 mean radius 569 non-null float64
1 mean texture 569 non-null float64
2 mean perimeter 569 non-null float64
3 mean area 569 non-null float64
4 mean smoothness 569 non-null float64
5 mean compactness 569 non-null float64
6 mean concavity 569 non-null float64
7 mean concave points 569 non-null float64
8 mean symmetry 569 non-null float64
9 mean fractal dimension 569 non-null float64
10 radius error 569 non-null float64
11 texture error 569 non-null float64
12 perimeter error 569 non-null float64
13 area error 569 non-null float64
14 smoothness error 569 non-null float64
15 compactness error 569 non-null float64
16 concavity error 569 non-null float64
17 concave points error 569 non-null float64
18 symmetry error 569 non-null float64
19 fractal dimension error 569 non-null float64
20 worst radius 569 non-null float64
21 worst texture 569 non-null float64
22 worst perimeter 569 non-null float64
23 worst area 569 non-null float64
24 worst smoothness 569 non-null float64
25 worst compactness 569 non-null float64
26 worst concavity 569 non-null float64
27 worst concave points 569 non-null float64
28 worst symmetry 569 non-null float64
29 worst fractal dimension 569 non-null float64
30 target 569 non-null float64
dtypes: float64(31)
memory usage: 137.9 KB
None
mean radius mean texture mean perimeter mean area mean smoothness mean compactness mean concavity mean concave points mean symmetry mean fractal dimension radius error texture error perimeter error area error smoothness error compac...
0 17.99 10.38 122.80 1001.0 0.1184 0.2776 0.3001 0.14710 0.2419 0.07871 1.0950 0.9053 8.589 153.40000 0.006399 ...
1 20.57 17.77 132.90 1326.0 0.0847 0.0786 0.0869 0.07017 0.1812 0.05667 0.5435 0.7339 3.398 74.08000 0.005225 ...
2 19.69 21.25 130.00 1203.0 0.1096 0.1599 0.1974 0.12790 0.2069 0.05999 0.7456 0.7869 4.585 94.03000 0.006150 ...
3 11.42 20.38 77.58 386.1 0.1425 0.2839 0.2414 0.10520 0.2597 0.09744 0.4956 1.1560 3.445 27.23000 0.009110 ...
4 20.29 14.34 135.10 1297.0 0.1003 0.1328 0.1980 0.10430 0.1809 0.05883 0.7572 0.7813 5.438 94.44000 0.011490 ...
```
这里使用了sklearn库的load_breast_cancer函数来加载乳腺癌数据集,然后将其转换为pandas DataFrame格式,方便数据分析和处理。
如何把UCI的乳腺癌数据集转化为csv文件
UCI乳腺癌数据集通常是以文本文件的形式提供,但可以通过以下步骤将其转换为CSV文件:
1. 打开文本文件并复制所有内容。
2. 打开一个新的Excel电子表格。
3. 在第一行中,使用Tab键或逗号将数据分隔为不同的列。
4. 粘贴数据到第一行下面的单元格中。
5. 选择“文件”选项卡,然后选择“另存为”。
6. 在“文件类型”下拉列表中选择“CSV(逗号分隔)”。
7. 输入文件名,然后点击“保存”。
现在,您的UCI乳腺癌数据集已经转换成了CSV文件,您可以使用该文件进行数据分析和机器学习实验。