机器学习fit模型时报错

ValueErrorInput contains NaNinfinity or a value too large for dtype('float32').

解决办法:

https://www.kaggle.com/c/word2vec-nlp-tutorial/forums/t/11266/valueerror-array-contains-nan-or-infinity


Just for the record, I had the same error message and found that it was caused by NaN's. I imputed them as follows:

from sklearn.preprocessing import Imputer

df = Imputer().fit_transform(df)

后面就可以继续使用df做机器学习模型建模了

猜你喜欢

转载自blog.csdn.net/wshzd/article/details/78904642