I'm trying to fit_transform an Numpy array, but when run fit_transfort()
, it will fill only zero values.
data = [[3],[9],[3],[12],[3],[8],[8],[13],[12],[2],[0],['42'],['58'],[12],[12],[6],[3],[6],[4],[7],[10]];
data=np.array(data).reshape(1, -1)
scaler = MinMaxScaler()
data_fit = scaler.fit_transform(data)
pred_prova=ll.predict(data_fit)
X_test_std[0] # <---- it is right and return from X_train_std = ss.fit_transform(X_train)
array([-0.23130257, 0.19945477, -0.49045489, -2.40903789, 0.62833204, ........
data_fit
array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]])
You don't need to reshape
the data before fit_transform
, do it afterwards
data = [[3],[9],[3],[12],[3],[8],[8],[13],[12],[2],[0],['42'],['58'],[12],[12],[6],[3],[6],[4],[7],[10]]
data=np.array(data)
scaler = MinMaxScaler()
data_fit = scaler.fit_transform(data)
pred_prova=ll.predict(data_fit)
X_test_std[0] # <---- it is right and return from X_train_std = ss.fit_transform(X_train)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.