大数据文摘制作

作者:赵培信

去年12月,一个名为《TheHundred-Page Machine LearningBook》的机器学习教程迅速问世,这本书由Gartner的机器学习小组负责人、人工智能博士AndriyBurkov撰写,如题目所说,去除封面目录只有128页,但包含了机器学习50多年来具有实用价值的各种资料。

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

这本书讲了什么?

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

具体目录如下图所示:

示例代码已经开源

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

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

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

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

importnumpy as npimportscipy as as pltimportmath
import KernelDensity
im as in import KernelRidge
ma['ma;]= 'stix'ma[';]= 'STIXGeneral'ma.update({';:18})
mu1,sigma1 = 3.0, 1.0mu2,sigma2 = 8.0, 3.5
defsample_points():s1= np.random.normal(mu1, ma(sigma1), 50)
s2= np.random.normal(mu2, ma(sigma2), 50)return list(s1) + list(s2)
defcompute_bi(mu1local, sigma1local, mu2local, sigma2local, phi1local,phi2local):bis= []forxi in x:bis.append(xi, mu1local, ma(sigma1local)) *phi1local(xi, mu1local, ma(sigma1local)) *phi1local + (xi, mu2local, ma(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 = ([-2,12]([0,0.8]("$x$"("pdf"(x, [0.005] * len(x), color='navy', s=30, marker=2,label="training examples"(x_plot, [(xp, mu1_estimate,ma(sigma1_estimate)) for xp in x_plot], color=colors[1],linewidth=lw, label="$f(x_i \mid \mu_1 ,\sigma_1^2)$"(x_plot, [(xp, mu2_estimate,ma(sigma2_estimate)) for xp in x_plot], color=colors[3],linewidth=lw, label="$f(x_i \mid \mu_2 ,\sigma_2^2)$"(x_plot, [(xp, mu1, ma(sigma1)) forxp in x_plot], color=colors[0], label="true pdf"(x_plot, [(xp, mu2, ma(sigma2)) forxp in x_plot], color=colors[0])
(loc='upper right'()
fig1 = (top = 0.98, bottom = 0.1, right = 0.98, left =0.08, hspace = 0, wspace = 0('../../Illustrations/gaussian-mixture-model-' +str(count) + '.eps', format='eps', dpi=1000, bbox_inches = 'tight',pad_inches = 0('../../Illustrations/gaussian-mixture-model-' +str(count) + '.pdf', format='pdf', dpi=1000, bbox_inches = 'tight',pad_inches = 0('../../Illustrations/gaussian-mixture-model-' +str(count) + '.png', dpi=1000, bbox_inches = 'tight', pad_inches = 0)#()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
(count)
ifcount > 50:break

如何获得书和代码

书的链接:

代码链接:

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

1.《adjustparam,干货看这篇!Gartner力推的“百页机器学习书”,“舒服”搞定概念+代码》援引自互联网,旨在传递更多网络信息知识,仅代表作者本人观点,与本网站无关,侵删请联系页脚下方联系方式。

2.《adjustparam,干货看这篇!Gartner力推的“百页机器学习书”,“舒服”搞定概念+代码》仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证。

3.文章转载时请保留本站内容来源地址,https://www.cxvn.com/gl/djyxgl/168396.html