FITC_network.py 文件源码

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

项目:deepGP_approxEP 作者: thangbui 项目源码 文件源码
def estimate_ls(self, X):
        Ntrain = X.shape[0]
        if Ntrain < 10000:
            X1 = np.copy(X)
        else:
            randind = np.random.permutation(Ntrain)
            X1 = X[randind[0:(5*self.no_pseudos[0])], :]

        # d2 = compute_distance_matrix(X1)
        D = X1.shape[1]
        N = X1.shape[0]
        triu_ind = np.triu_indices(N)
        ls = np.zeros((D, ))
        for i in range(D):
            X1i = np.reshape(X1[:, i], (N, 1))
            d2i = cdist(X1i, X1i, 'euclidean')
            # d2i = d2[:, :, i]
            d2imed = np.median(d2i[triu_ind])
            # d2imed = 0.01
            # print d2imed, 
            ls[i] = np.log(d2imed + 1e-16)
        return ls
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号