data = np.array(y) scaler = MinMaxScaler(feature_range=(-1, 1)) train_data_normalized = scaler.fit_transform(data.reshape(-1, 1))