unb.py 文件源码

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

项目:Bayes 作者: krzjoa 项目源码 文件源码
def _features_in_class(self, X, y_one_hot):
        '''

        Compute complement features counts

        Parameters
        ----------
        X: numpy array (n_samples, n_features)
            Matrix of input samples
        y_one_hot: numpy array (n_samples, n_classes)
            Binary matrix encoding input
        '''
        if not self.is_fitted:
            self.complement_features_ = X.T.dot(np.logical_not(y_one_hot))
            self.features_ = X.T.dot(y_one_hot)
        else:
            self.complement_features_ += X.T.dot(np.logical_not(y_one_hot))
            self.features_ += X.T.dot(y_one_hot)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号