Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ranpelta/c3a0fa6d4addd23c7caa48a971a7e6f8 to your computer and use it in GitHub Desktop.
Save ranpelta/c3a0fa6d4addd23c7caa48a971a7e6f8 to your computer and use it in GitHub Desktop.
Xscaler = MinMaxScaler(feature_range=(0, 1)) # scale so that all the X data will range from 0 to 1
Xscaler.fit(X_train)
scaled_X_train = Xscaler.transform(X_train)
print(X_train.shape)
Yscaler = MinMaxScaler(feature_range=(0, 1))
Yscaler.fit(y_train)
scaled_y_train = Yscaler.transform(y_train)
print(scaled_y_train.shape)
scaled_y_train = scaled_y_train.reshape(-1) # remove the second dimention from y so the shape changes from (n,1) to (n,)
print(scaled_y_train.shape)
scaled_y_train = np.insert(scaled_y_train, 0, 0)
scaled_y_train = np.delete(scaled_y_train, -1)
>>>(28916, 3)
>>>(28916, 1)
>>>(28916,)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment