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 机器学习实践:测试驱动的开发方法
172
9
阵的决定因素。实际上它是可以从这个函数中获得的最大值。假如行向量远离平均值
向量,那么
p
ij
会由于之前的求幂和负分数而变得越来越小。
值得高兴的是,这与行向量在平均值中的高斯概率成比例。由于这是成比例的而不是
相等的,在最后一部分我们将其归一化到总和为
1
现在我们可以继续进入到最大化的步骤:
class EMClustering(object):
# __init__
# setup()
# expect
def maximize(self):
for cluster_num, cluster in enumerate(self._clusters):
weights = self._membership_weights[:, cluster_num]
weight = np.average(weights)
mean = np.average(self._data, axis=0, weights=weights)
covariance = np.cov(self._data, rowvar=False, ddof=0, aweights=weights)
self._clusters[cluster_num] = self.cluster(weight, mean, covariance)
Again here we are iterating over the clusters called @classes. We first make an array
called ...
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