Search code examples
pythonnumpyscikit-learnnormalize

Sklearn Preprocessing -- *** TypeError: No matching signature found


I am trying to normalize a CSR matrix,

but I get this error: (*** TypeError: No matching signature found).

from sklearn.preprocessing import normalize
normalize(x_m, norm="l2", axis=1)

The matrix is 609186x849632 sparse matrix of type 'numpy.float16' with 189140200 stored elements in Compressed Sparse Row format


Solution

  • Actually I solved the problem. I think it is because of the data type. Changing np.float16 to np.float32, solved the problem. I do not know why, this problem only happens with np.float16 data type.