def score(self, y):
groups = numpy.unique(y)
a = len(groups)
Ntx = len(y)
self.a_ = a
self.Ntx_ = Ntx
self._SST = (self.pairs_**2).sum() / (2 * Ntx)
pattern = numpy.zeros((Ntx, Ntx))
for g in groups:
pattern += numpy.outer(y == g, y == g) / \
(numpy.float(numpy.sum(y == g)))
self._SSW = ((self.pairs_**2) * (pattern)).sum() / 2
self._SSA = self._SST - self._SSW
self._F = (self._SSA / (a - 1)) / (self._SSW / (Ntx - a))
return self._F
#######################################################################
stats.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录