Python - Predicting data based on multidimensional array with Keras I've a list of data which is so called 3D array. Each of 10350 rows contains a 2D matrix with size of 150x16 (elements are float) (x_train). Corresponding training data for this huge array a linear array with size of 10350 integer which can be either 0 or 1 (y_train).



I used different methods to estimate the test_data. None of them worked with such type of array.

from matplotlib import pyplot as plt

from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from sklearn.preprocessing import MinMaxScaler

min_max_scaler = MinMaxScaler()

train_data_set = np.load("files/samples/A08_Block_sample.npy")
test_data_set = np.load("files/samples/A10_BLOCK_sample.npy")

x_train = []
y_train = []

for i in range(len(train_data_set)):
   x_train.append(train_data_set[i].arr_)
   y_train.append(train_data_set[i].flag_)

   num_units = 4
   activation_function = 'sigmoid'
   optimizer = 'adam'
   loss_function = 'mean_squared_error'
   batch_size = 5
   num_epochs = 100

   regressor = Sequential()

   regressor.add(LSTM(units=num_units, activation=activation_function, input_shape=(10403, 16, 150)))

   regressor.add(Dense(units=1))

   regressor.compile(optimizer=optimizer, loss=loss_function)

   regressor.fit(x_train, y_train, batch_size=batch_size, epochs=num_epochs)

   inputs_x = []
   inputs_y = []
   for i in range(len(test_data_set)):
      inputs_x.append(test_data_set[i].arr_)
      inputs_x.append(test_data_set[i].flag_)

   predicted_price = regressor.predict(inputs_x)


The library that I'm using is Keras. I'm new at data science, any suggestion will be welcome for me.
Change first layer with

regressor.add(LSTM(units=num_units, input_shape=(x_train.shape[1],x_train.shape[2])))


You need to have 2 numbers as input shape. 

Hope will help you.