Skip to Content
Spark机器学习实战
book

Spark机器学习实战

by Posts & Telecom Press, Siamak Amirghodsi, Meenakshi Rajendran, Broderick Hall, Shuen Mei
May 2024
Beginner to intermediate
549 pages
8h 11m
Chinese
Packt Publishing
Content preview from Spark机器学习实战

第9章 最优化——用梯度下降法寻找最小值

这一章将讨论以下内容:

  • 优化二次损失函数,使用数学方法寻找最小值进行分析;
  • 从零开始使用梯度下降法(GD)编码实现二次损失函数的优化过程;
  • 从零开始编码梯度下降优化算法,解决线性回归问题;
  • 在Spark 2.0中使用正规方程法解决线性回归问题。

理解最优化的工作原理是机器学习相关职业取得成功的基础。我们选择梯度下降方法(GD)进行端到端的研究,演示最优化技术的内部工作原理。我们将使用3个攻略阐述这个概念,这些攻略将和开发人员一起从零开始编写一个完全开发代码,以解决现实的实际问题。第四个攻略使用Spark和正规方程寻找GD的替代方案,以解决回归问题。

现在开始吧!机器是如何学习的?机器真的会从错误中吸取教训吗?当机器使用最优化技术寻找解决方案时到底在想什么?

从高层次上来看,机器采用下面5种技术中的某一种进行学习。

  • 基于误差的学习:在域空间寻找一组参数值(权重)组合,最小化训练数据的总误差(预测值和真实值)。
  • 信息理论学习:使用经典香农信息理论中的熵和信息增益等概念。基于树的机器学习系统(如ID3算法)是这一类别的典型代表,而集成树模型则代表了这一类别中取得的最高成就。我们将在第10章探讨树模型。
  • 概率空间学习:这一分支基于贝叶斯定理,机器学习领域最出名的方法就是朴素贝叶斯(还有多种变种)。朴素贝叶斯的发展在贝叶斯网络时达到顶峰,可以更好地对模型进行控制。
  • 相似性测度学习:该方法试图先定义一个相似性测度,进而使用该测度拟合观察数据的一个分组。众所周知的KNN即是典型代表,其已经成为任何机器学习工具包中的标准组件。Spark的ML实现了拥有并行能力的K-Means算法(K代表并行)K-means++。
  • 遗传算法(GA)和进化学习:可以认为是达尔文理论(物种起源)在最优化和机器学习上的应用。GA的背后思想是先使用递归生成算法创建一组初始候选者,然后使用反馈信息(适应度条件)消除远距离候选者,合并相似候选者,同时对不太可能的候选者引入随机突变(数值或符号抖动),不断重复上述过程直至找到解决方案。 ...
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

Python计算机视觉和自然语言处理

Python计算机视觉和自然语言处理

Posts & Telecom Press, Álvaro Morena Alberolaï, Gonzalo Molina Gallegoï, Unai Garay Maestreï
Python和NLTK实现自然语言处理

Python和NLTK实现自然语言处理

Posts & Telecom Press, Nitin Hardeniya
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu
人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar

Publisher Resources

ISBN: 9781836201830