Skip to Content
机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)
book

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

by Aurélien Géron
October 2020
Intermediate to advanced
693 pages
16h 26m
Chinese
China Machine Press
Content preview from 机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)
166
|
第
6
章
6.4 CART 训练算法
Scikit-Learn 使用分类和回归树(Classification and Regression Tree,CART)算法来训练
决策树(也称为“增长树”)。该算法的工作原理是:首先使用单个特征
k
和阈值
t
k
(例如,
“花瓣长度”
≤
2.45cm”)将训练集分为两个子集。如何选择
k
和
t
k
?它搜索产生最纯子
集(按其大小加权)的一对 (
k
,
t
k
)。公式 6-2 给出了算法试图最小化的成本函数。
公式 6-2:CART 分类成本函数
其中
Jkt G G(, )
k
G
m
left/right
left/right
= +
m
mm
left
测量左右子集的不纯度
测量左右子集的实例数
left right
m
right
一旦 CART 算法成功地将训练集分为两部分,它就会使用相同的逻辑将子集进行分割,然
后再分割子集,以此类推。一旦达到最大深度(由超参数 max_depth 定义),或者找不
到可减少不纯度的分割,它将停止递归。其他一些超参数(稍后描述)可以控制其他一些
停止条件(min_samples_split、min_samples_leaf、min_weight_fraction_
leaf 和 max_leaf_nodes)。
如你所见,CART 是一种贪婪算法:从顶层开始搜索最优分裂,然后每层
重复这个过程。几层分裂之后,它并不会检视这个分裂的不纯度是否为可
能的最低值。贪婪算法通常会产生一个相当不错的解,但是不能保证是最
优解。
而不幸的是,寻找最优树是一个已知的 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey

Publisher Resources

ISBN: 9787111665977