custom_logistic.py 文件源码

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

项目:pyAFM 作者: cmaclell 项目源码 文件源码
def predict_proba(self, X):
        """
        Returns the probability of class 1 for each x in X.
        """
        try:
            getattr(self, "intercept_")
            getattr(self, "coef_")
        except AttributeError:
            raise RuntimeError("You must train classifer before predicting data!")

        X = check_array(X)
        if self.fit_intercept:
            X = np.insert(X, 0, 1, axis=1)

        w = np.insert(self.coef_, 0, self.intercept_)
        return invlogit_vect(np.dot(w, np.transpose(X)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号