algorithms.py 文件源码

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

项目:scikit-cmeans 作者: bm424 项目源码 文件源码
def converge(self, x):
        """Finds cluster centers through an alternating optimization routine.

        Terminates when either the number of cycles reaches `max_iter` or the
        objective function changes by less than `tol`.

        Parameters
        ----------
        x : :obj:`np.ndarray`
            (n_samples, n_features)
            The original data.

        """
        centers = []
        j_new = np.infty
        for i in range(self.max_iter):
            j_old = j_new
            self.update(x)
            centers.append(self.centers)
            j_new = self.objective(x)
            if np.abs(j_old - j_new) < self.tol:
                break
        return np.array(centers)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号