counts -= nnz_per_row
if weights is not None:
counts *= weights
return np.sum(counts)
def bincount(X, max_val=None, weights=None, minlength=None):
Return counts of values in array X.
After Change
def _count_nans_per_row_sparse(X, weights):
Count the number of nans (undefined) values per row.
counts = np.fromiter((np.isnan(row.data).sum() for row in X), dtype=np.float)
if weights is not None:
counts *= weights
return counts
def bincount(X, max_val=None, weights=None, minlength=None):
Return counts of values in array X.