当前位置:网站首页>[decision tree] use decision tree to diagnose breast cancer
[decision tree] use decision tree to diagnose breast cancer
2022-07-18 23:12:00 【Ding Jiaxiong】
【 Decision tree 】 Use decision tree to diagnose breast cancer
1. Data sets
Wisconsin breast cancer dataset
2. Data set composition : Healthy tissue ( Benign ) And cancerous tissue ( Malignant ) Digital image of
3. Mission :
Two classification → Classify tissue samples as benign and malignant .
4. Start
4.1.1 Loading data sets
from sklearn import datasets
data = datasets.load_breast_cancer()
data.data.shape

Data set co ownership 569 Zhang image ,30 Different characteristics .


Mission objectives :

4.1.2 Data set partitioning
import sklearn.model_selection as ms
X_train, X_test, y_train, y_test = ms.train_test_split(data.data, data.target, test_size=0.2, random_state=42)
Use here 0.2 namely 20% As a test set .

4.2 Build decision tree
Use scikit-learn Of tree modular .
- Don't use any parameters
from sklearn import tree
dtc1 = tree.DecisionTreeClassifier()
dtc1.fit(X_train,y_train)
View the score of the model on the training data set :

Check the error of the model on the test set :

See what the decision tree looks like :
with open("tree.dot", 'w') as f:
f = tree.export_graphviz(dtc1, out_file=f,
feature_names=data.feature_names,
class_names=data.target_names)

Even if no parameters are set , Thanks to the sklearn Very good default parameters , Also obtained on the test set **94.7%** The accuracy of .
边栏推荐
- leetcode--242. 有效的字母异位词
- parker派克柱塞泵PV140R1K1T1NMMC
- 刘小乐教授:我与生物信息学的不解之缘
- Can't go on, mend the foundation -- C thread develops output string program
- Deepmind's latest 114 page report "emerging barter trade behavior in Multi-Agent Reinforcement Learning"
- Logical loopholes in security testing
- Gao fushuai in unit testing, pytest framework (end) test report
- 【C语言】strlen函数的讲解和模拟实现
- C # - adding thread, loading case of progress bar, adding video effect for the first time
- Tableqa technology of Ali Dharma academy makes tables speak
猜你喜欢

私域运营很火,私域运营是否适合所有企业?
Cache design

C # - adding thread, loading case of progress bar, adding video effect for the first time

Sklearn linear regression fitting first-order term function

NASA took the first clear picture of the moment after the big bang

Servo valve moogd634-374c

3D point cloud course (II) -- nearest neighbor problem

Go如何保证并发读写的顺序?—内存模型

3D point cloud course (I) -- Introduction to point cloud Foundation

Nature Aging | 激活FOXM1基因人类寿命或翻倍
随机推荐
Logical loopholes in security testing
【决策树】使用决策树进行乳腺癌的诊断
openstack 相关博客
【图片编辑小软件】FastStone Photo Resizer支持批量转换和批量重命名
2022 soft test network administrator preparation guide
【百度飞桨】手写数字识别模型部署Paddle Inference
20220714给AIO-3568J适配OpenHarmony-v3.1-beta(编译Buildroot)
ospf综合实验
The best way to practice Animation: cover transition
Overview of multimodal processing technology under data constraints
「接口自动化」软件测试涨薪核心技能、让薪资涨幅200%
Cloud native: docker's practical experience (IV) deploying redis three master and three slave clusters on docker
Program analysis and Optimization - 11 multi branch analysis
安全测试之逻辑漏洞
T-infinite Road
Original Rexroth proportional valve 4wrba10w64-2x/g24n9z4/m
华大110时钟校准
NPM installation tutorial
[NOIP2006普及组]明明的随机数
Deep analysis of fiboracci sequence