bayesian_logistic_regression.py 文件源码

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

项目:Stein-Variational-Gradient-Descent 作者: DartML 项目源码 文件源码
def evaluation(self, theta, X_test, y_test):
        theta = theta[:, :-1]
        M, n_test = theta.shape[0], len(y_test)

        prob = np.zeros([n_test, M])
        for t in range(M):
            coff = np.multiply(y_test, np.sum(-1 * np.multiply(nm.repmat(theta[t, :], n_test, 1), X_test), axis=1))
            prob[:, t] = np.divide(np.ones(n_test), (1 + np.exp(coff)))

        prob = np.mean(prob, axis=1)
        acc = np.mean(prob > 0.5)
        llh = np.mean(np.log(prob))
        return [acc, llh]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号