num_missing = [
np.sum(missing.data[missing.indptr[i]:missing.indptr[i + 1]])
for i in range(missing.shape[0])]
elif scipy.sparse.isspmatrix_csc(missing):
num_missing = [np.sum(missing.data[missing.indices == i])
for i in range(missing.shape[0])]
return float(np.sum([1 if num > 0 else 0 for num in num_missing]))
After Change
def _calculate_sparse(self, X, y, categorical):
missing = helper_functions.get_value("MissingValues")
new_missing = missing.tocsr()
num_missing = [
np.sum(new_missing.data[new_missing.indptr[i]:new_missing.indptr[i + 1]])
for i in range(new_missing.shape[0])]