pNorm.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:invo 作者: rafidrm 项目源码 文件源码
def rho(self, points):
        """ Solves the goodness of fit.
        """
        assert self._solved, 'you need to solve first.'

        m, n = self.A.shape
        projections = self.optimal_points(points)
        _pts = [np.mat(pt).T for pt in points]
        numer = [
            np.linalg.norm(pj - pt, self.p)
            for pj, pt in zip(projections, _pts)
        ]
        numer = sum(numer)
        denom = 0
        for i in range(m):
            ai = self.A[i]
            bi = self.b[i]
            result = self._project_to_hyperplane(points, ai, bi)
            denom += result
        rho = 1 - numer / denom
        return rho
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号