Reputation: 775
I did my feature minmax scaling, previously the shape is (10000,) after i scaled it with MinMaxScaler it the shape changed into (10000,1). I need the shape to be (10000,) or else somehow my Keras model cannot process it due to different shape of the dimension. How to turn the shape into (10000,) again?
Upvotes: 2
Views: 365
Reputation: 51
you can try using this, I don't know if this is helpful but I thought to post it.
a = a.reshape(12,1)
print(a.shape)
array_1d = a.flatten()
print(array_1d.shape)
output
(12, 1)
(12,)
Upvotes: 1
Reputation: 22031
here a possibility
import numpy as np
from sklearn.preprocessing import MinMaxScaler
X = np.random.uniform(-10,10, 10000)
print(X.shape) # (10000,)
scaler = MinMaxScaler()
scaled_X = scaler.fit_transform(X.reshape(-1,1))
print(scaled_X.shape) # (10000,1)
scaled_X = scaled_X.ravel()
print(scaled_X.shape) # (10000,)
Upvotes: 1