trainWeights = gradDescent(np.array(trainingSet,dtype=float64), trainingLabels)
把dtype设置为float64会报错 NameError: name 'float64' is not defined
但是如果去掉"dtype=float64"会出现warning:DataConversionWarning: Data with input dtype <U3 was converted to float64 by MinMaxScaler.
warnings.warn(msg, DataConversionWarning) 提醒被转换成了float64
请问应该如何显式转换呢?
阿神2017-04-17 17:50:06
Is it possible that you didn’t import float64
Of course it’s not right for you to import like this literally. .
Like this. .
import numpy as np
dtype=np.float64
怪我咯2017-04-17 17:50:06
float64 is a class under numpy. If you want to use float64 without modification, you need to import it like this
import numpy as np
from numpy import float64
c = np.array([], dtype=float64)
If there is no from numpy import float64, use it like this
c = np.array([], dtype=np.float64)