Gartner力推的“百页机器学习书”,“舒服”搞定概念+代码(附下载)

2023-11-01 02:30

本文主要是介绍Gartner力推的“百页机器学习书”,“舒服”搞定概念+代码(附下载),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

大数据文摘出品

作者:曹培信


去年十二月,一本名为《TheHundred-Page Machine LearningBook》的机器学习教程迅速走火,它由Gartner公司机器学习团队负责人、人工智能博士AndriyBurkov撰写,这本书如标题所言,去除封面目录才128页,但是却包含了机器学习50多年以来有实用价值的各种材料。


作者介绍说:“机器学习的初学者将在本书中获得足够的细节,可以很‘舒服’地理解书的内容;有经验的实践者可以使用这本书作为进一步自我完善的指南。”



这本书讲了什么?


这本书一共分为两大部分,在介绍了机器学习的基本知识之后,本书首先用8章讲了SupervisedLearning(监督式学习),而后用3章介绍了UnsupervisedLearning(非监督式学习)和其他学习方式。


具体目录如下图所示:



示例代码已经开源


如今,这本书所有涉及到的项目代码都在GitHub上开源啦!



也就是说,大家可以一边看书学习,一边用开源的代码进行实验了。不得不说,这些代码对新手真的太友好了,内容特别详细。


比如多元高斯分布(GaussianMixture Model GMM)这个内容,作者在书的9.2.4进行了详细的讲解:



在GitHub上也有对应的详细代码:


























































































importnumpy as npimportscipy as spimportmatplotlibimportmatplotlib.pyplot as pltimportmath
fromsklearn.neighbors import KernelDensity
importscipy.integrate as integratefromsklearn.kernel_ridge import KernelRidge
matplotlib.rcParams['mathtext.fontset']= 'stix'matplotlib.rcParams['font.family']= 'STIXGeneral'matplotlib.rcParams.update({'font.size':18})
mu1,sigma1 = 3.0, 1.0mu2,sigma2 = 8.0, 3.5
defsample_points():s1= np.random.normal(mu1, math.sqrt(sigma1), 50)
s2= np.random.normal(mu2, math.sqrt(sigma2), 50)return list(s1) + list(s2)
defcompute_bi(mu1local, sigma1local, mu2local, sigma2local, phi1local,phi2local):bis= []forxi in x:bis.append((sp.stats.norm.pdf(xi, mu1local, math.sqrt(sigma1local)) *phi1local)/(sp.stats.norm.pdf(xi, mu1local, math.sqrt(sigma1local)) *phi1local + sp.stats.norm.pdf(xi, mu2local, math.sqrt(sigma2local)) *phi2local))return bis#generate points used to plotx_plot= np.linspace(-2, 12, 100)#generate points and keep a subset of themx =sample_points()
colors= ['red', 'blue', 'orange', 'green']lw = 2mu1_estimate= 1.0mu2_estimate= 2.0sigma1_estimate= 1.0sigma2_estimate= 2.0phi1_estimate= 0.5phi2_estimate= 0.5
count =0whileTrue:plt.figure(count)axes = plt.gca()axes.set_xlim([-2,12])axes.set_ylim([0,0.8])plt.xlabel("$x$")plt.ylabel("pdf")plt.scatter(x, [0.005] * len(x), color='navy', s=30, marker=2,label="training examples")plt.plot(x_plot, [sp.stats.norm.pdf(xp, mu1_estimate,math.sqrt(sigma1_estimate)) for xp in x_plot], color=colors[1],linewidth=lw, label="$f(x_i \\mid \\mu_1 ,\\sigma_1^2)$")plt.plot(x_plot, [sp.stats.norm.pdf(xp, mu2_estimate,math.sqrt(sigma2_estimate)) for xp in x_plot], color=colors[3],linewidth=lw, label="$f(x_i \\mid \\mu_2 ,\\sigma_2^2)$")plt.plot(x_plot, [sp.stats.norm.pdf(xp, mu1, math.sqrt(sigma1)) forxp in x_plot], color=colors[0], label="true pdf")plt.plot(x_plot, [sp.stats.norm.pdf(xp, mu2, math.sqrt(sigma2)) forxp in x_plot], color=colors[0])
plt.legend(loc='upper right')plt.tight_layout()
fig1 = plt.gcf()fig1.subplots_adjust(top = 0.98, bottom = 0.1, right = 0.98, left =0.08, hspace = 0, wspace = 0)fig1.savefig('../../Illustrations/gaussian-mixture-model-' +str(count) + '.eps', format='eps', dpi=1000, bbox_inches = 'tight',pad_inches = 0)fig1.savefig('../../Illustrations/gaussian-mixture-model-' +str(count) + '.pdf', format='pdf', dpi=1000, bbox_inches = 'tight',pad_inches = 0)fig1.savefig('../../Illustrations/gaussian-mixture-model-' +str(count) + '.png', dpi=1000, bbox_inches = 'tight', pad_inches = 0)#plt.show()bis1 = compute_bi(mu1_estimate, sigma1_estimate, mu2_estimate,sigma2_estimate, phi1_estimate, phi2_estimate)bis2 = compute_bi(mu2_estimate, sigma2_estimate, mu1_estimate,sigma1_estimate, phi2_estimate, phi1_estimate)#print bis1[:5]#print bis2[:5]mu1_estimate = sum([bis1[i] * x[i] for i in range(len(x))]) /sum([bis1[i] for i in range(len(x))])mu2_estimate = sum([bis2[i] * x[i] for i in range(len(x))]) /sum([bis2[i] for i in range(len(x))])
sigma1_estimate = sum([bis1[i] * (x[i] - mu1_estimate)**2 for i inrange(len(x))]) / sum([bis1[i] for i in range(len(x))])sigma2_estimate = sum([bis2[i] * (x[i] - mu2_estimate)**2 for i inrange(len(x))]) / sum([bis2[i] for i in range(len(x))])#print mu1_estimate, mu2_estimate#print sigma1_estimate, sigma2_estimatephi1_estimate = sum([bis1[i] for i in range(len(x))])/float(len(x))phi2_estimate = 1.0 - phi1_estimate
print phi1_estimate
count += 1
plt.close(count)
ifcount > 50:break


如何获得书和代码


书的链接:

http://themlbook.com/wiki/doku.php?id=start


代码链接:

https://github.com/aburkov/theMLbook


当然,文摘菌也帮大家下载并整理好了书和代码,后台回复“100页”就可以获得啦,赶紧开始学习起来吧!

这篇关于Gartner力推的“百页机器学习书”,“舒服”搞定概念+代码(附下载)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/319842

相关文章

C#实现千万数据秒级导入的代码

《C#实现千万数据秒级导入的代码》在实际开发中excel导入很常见,现代社会中很容易遇到大数据处理业务,所以本文我就给大家分享一下千万数据秒级导入怎么实现,文中有详细的代码示例供大家参考,需要的朋友可... 目录前言一、数据存储二、处理逻辑优化前代码处理逻辑优化后的代码总结前言在实际开发中excel导入很

SpringBoot+RustFS 实现文件切片极速上传的实例代码

《SpringBoot+RustFS实现文件切片极速上传的实例代码》本文介绍利用SpringBoot和RustFS构建高性能文件切片上传系统,实现大文件秒传、断点续传和分片上传等功能,具有一定的参考... 目录一、为什么选择 RustFS + SpringBoot?二、环境准备与部署2.1 安装 RustF

Python实现Excel批量样式修改器(附完整代码)

《Python实现Excel批量样式修改器(附完整代码)》这篇文章主要为大家详细介绍了如何使用Python实现一个Excel批量样式修改器,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一... 目录前言功能特性核心功能界面特性系统要求安装说明使用指南基本操作流程高级功能技术实现核心技术栈关键函

Redis实现高效内存管理的示例代码

《Redis实现高效内存管理的示例代码》Redis内存管理是其核心功能之一,为了高效地利用内存,Redis采用了多种技术和策略,如优化的数据结构、内存分配策略、内存回收、数据压缩等,下面就来详细的介绍... 目录1. 内存分配策略jemalloc 的使用2. 数据压缩和编码ziplist示例代码3. 优化的

redis-sentinel基础概念及部署流程

《redis-sentinel基础概念及部署流程》RedisSentinel是Redis的高可用解决方案,通过监控主从节点、自动故障转移、通知机制及配置提供,实现集群故障恢复与服务持续可用,核心组件包... 目录一. 引言二. 核心功能三. 核心组件四. 故障转移流程五. 服务部署六. sentinel部署

Python 基于http.server模块实现简单http服务的代码举例

《Python基于http.server模块实现简单http服务的代码举例》Pythonhttp.server模块通过继承BaseHTTPRequestHandler处理HTTP请求,使用Threa... 目录测试环境代码实现相关介绍模块简介类及相关函数简介参考链接测试环境win11专业版python

Python从Word文档中提取图片并生成PPT的操作代码

《Python从Word文档中提取图片并生成PPT的操作代码》在日常办公场景中,我们经常需要从Word文档中提取图片,并将这些图片整理到PowerPoint幻灯片中,手动完成这一任务既耗时又容易出错,... 目录引言背景与需求解决方案概述代码解析代码核心逻辑说明总结引言在日常办公场景中,我们经常需要从 W

使用Spring Cache本地缓存示例代码

《使用SpringCache本地缓存示例代码》缓存是提高应用程序性能的重要手段,通过将频繁访问的数据存储在内存中,可以减少数据库访问次数,从而加速数据读取,:本文主要介绍使用SpringCac... 目录一、Spring Cache简介核心特点:二、基础配置1. 添加依赖2. 启用缓存3. 缓存配置方案方案

MySQL的配置文件详解及实例代码

《MySQL的配置文件详解及实例代码》MySQL的配置文件是服务器运行的重要组成部分,用于设置服务器操作的各种参数,下面:本文主要介绍MySQL配置文件的相关资料,文中通过代码介绍的非常详细,需要... 目录前言一、配置文件结构1.[mysqld]2.[client]3.[mysql]4.[mysqldum

Python多线程实现大文件快速下载的代码实现

《Python多线程实现大文件快速下载的代码实现》在互联网时代,文件下载是日常操作之一,尤其是大文件,然而,网络条件不稳定或带宽有限时,下载速度会变得很慢,本文将介绍如何使用Python实现多线程下载... 目录引言一、多线程下载原理二、python实现多线程下载代码说明:三、实战案例四、注意事项五、总结引