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', a
Solution 1:
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.
Solution 2:
from sklearn.preprocessing import normalize
columns_changed = []
for col in df.columns:
col_type = x_m[col].dtypes
if col_type == 'float16':
columns_changed.append(col)
x_m[col] = x_m[col].astype(np.float32)
normalize(x_m, norm="l2", axis=1)
for col in columns_changed:
x_m[col] = x_m[col].astype(np.float16)
x_m
Post a Comment for "Sklearn Preprocessing -- *** Typeerror: No Matching Signature Found"