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

相关文章

HarmonyOS学习(七)——UI(五)常用布局总结

自适应布局 1.1、线性布局(LinearLayout) 通过线性容器Row和Column实现线性布局。Column容器内的子组件按照垂直方向排列,Row组件中的子组件按照水平方向排列。 属性说明space通过space参数设置主轴上子组件的间距,达到各子组件在排列上的等间距效果alignItems设置子组件在交叉轴上的对齐方式,且在各类尺寸屏幕上表现一致,其中交叉轴为垂直时,取值为Vert

Ilya-AI分享的他在OpenAI学习到的15个提示工程技巧

Ilya(不是本人,claude AI)在社交媒体上分享了他在OpenAI学习到的15个Prompt撰写技巧。 以下是详细的内容: 提示精确化:在编写提示时,力求表达清晰准确。清楚地阐述任务需求和概念定义至关重要。例:不用"分析文本",而用"判断这段话的情感倾向:积极、消极还是中性"。 快速迭代:善于快速连续调整提示。熟练的提示工程师能够灵活地进行多轮优化。例:从"总结文章"到"用

【前端学习】AntV G6-08 深入图形与图形分组、自定义节点、节点动画(下)

【课程链接】 AntV G6:深入图形与图形分组、自定义节点、节点动画(下)_哔哩哔哩_bilibili 本章十吾老师讲解了一个复杂的自定义节点中,应该怎样去计算和绘制图形,如何给一个图形制作不间断的动画,以及在鼠标事件之后产生动画。(有点难,需要好好理解) <!DOCTYPE html><html><head><meta charset="UTF-8"><title>06

学习hash总结

2014/1/29/   最近刚开始学hash,名字很陌生,但是hash的思想却很熟悉,以前早就做过此类的题,但是不知道这就是hash思想而已,说白了hash就是一个映射,往往灵活利用数组的下标来实现算法,hash的作用:1、判重;2、统计次数;

MySQL数据库宕机,启动不起来,教你一招搞定!

作者介绍:老苏,10余年DBA工作运维经验,擅长Oracle、MySQL、PG、Mongodb数据库运维(如安装迁移,性能优化、故障应急处理等)公众号:老苏畅谈运维欢迎关注本人公众号,更多精彩与您分享。 MySQL数据库宕机,数据页损坏问题,启动不起来,该如何排查和解决,本文将为你说明具体的排查过程。 查看MySQL error日志 查看 MySQL error日志,排查哪个表(表空间

常用的jdk下载地址

jdk下载地址 安装方式可以看之前的博客: mac安装jdk oracle 版本:https://www.oracle.com/java/technologies/downloads/ Eclipse Temurin版本:https://adoptium.net/zh-CN/temurin/releases/ 阿里版本: github:https://github.com/

活用c4d官方开发文档查询代码

当你问AI助手比如豆包,如何用python禁止掉xpresso标签时候,它会提示到 这时候要用到两个东西。https://developers.maxon.net/论坛搜索和开发文档 比如这里我就在官方找到正确的id描述 然后我就把参数标签换过来

零基础学习Redis(10) -- zset类型命令使用

zset是有序集合,内部除了存储元素外,还会存储一个score,存储在zset中的元素会按照score的大小升序排列,不同元素的score可以重复,score相同的元素会按照元素的字典序排列。 1. zset常用命令 1.1 zadd  zadd key [NX | XX] [GT | LT]   [CH] [INCR] score member [score member ...]

poj 1258 Agri-Net(最小生成树模板代码)

感觉用这题来当模板更适合。 题意就是给你邻接矩阵求最小生成树啦。~ prim代码:效率很高。172k...0ms。 #include<stdio.h>#include<algorithm>using namespace std;const int MaxN = 101;const int INF = 0x3f3f3f3f;int g[MaxN][MaxN];int n

【机器学习】高斯过程的基本概念和应用领域以及在python中的实例

引言 高斯过程(Gaussian Process,简称GP)是一种概率模型,用于描述一组随机变量的联合概率分布,其中任何一个有限维度的子集都具有高斯分布 文章目录 引言一、高斯过程1.1 基本定义1.1.1 随机过程1.1.2 高斯分布 1.2 高斯过程的特性1.2.1 联合高斯性1.2.2 均值函数1.2.3 协方差函数(或核函数) 1.3 核函数1.4 高斯过程回归(Gauss