Skip to Main Content
Python 机器学习实践:测试驱动的开发方法
book

Python 机器学习实践:测试驱动的开发方法

by Matthew Kirk
January 2018
Intermediate to advanced content levelIntermediate to advanced
211 pages
8h 31m
Chinese
China Machine Press
Content preview from Python 机器学习实践:测试驱动的开发方法
K
最近邻算法
39
3-13:整体编码设计
在回归次数增加时,我们将查看
Regressor
类工作情况的细微变化,来判断模型是否
成功。
KNN
回归结构
为了构造
KNN
回归,我们将使用
KDTree
。你不必精通它的原理,只需要知道
KDTree
可以存储并且可以方便地查询基于距离的数据。我们将使用的距离度量是欧
几里得距离,因为它易于计算,并且很适合这个问题。你也可以尝试很多其他算法来
查看错误率是更好还是更差。
关于打包的说明
你会注意到,我们使用了很多软件包。
Python
有许多很好的工具可用于数据科
学相关的计算,如
NumPy
Pandas
scikit-learn
SciPy
,等等。
我们使用
Pandas
NumPy
来构建以多维数组为核心、操作类似于
SQL
的数据库,
并支持查询。
Pandas
是查询接口,
NumPy
是后台数据处理。在
NumPy
库中还
有一些有用的工具。
scikit-learn
是可用于常见算法的机器学习工具集(本书也会讨论它)。
SciPy
是一个科学计算库,提供诸如
KDTree
等工具。
本书的代码示例将依赖这些库来完成。
Figure 3-13. Overall coding design
For this chapter we will determine success by looking at the nuances of how our
regressor works as we increase folds.
KNN Regressor Construction
To construct ...
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.
Start your free trial

You might also like

Mastering Python for Bioinformatics

Mastering Python for Bioinformatics

Ken Youens-Clark

Publisher Resources

ISBN: 9787111581666