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)
评论列表
文章目录