I am trying to use the functional api of Keras to build a model having multiple inputs and a single output.
The goal is to combine each row of each input to predict the corresponding output (either 1 or 0).
for example concatenate(inputs_1[0], and inputs_2[0])
and predict output outputs[0]
My data structure looks like this :
inputs_1 = [[[-18.73, 8.98, 0.29, 0.23],[58.50, 28.31, 45.89, -1.62], [48.70, 21.31, 25.89, 1.62]],
[[-18.73, 8.98, 0.29, 0.65],[58.50, 28.31, 45.89, -1.62], [48.70, 21.31, 25.89, 1.62]],
[[-18.73, 8.98, 0.29, 9,3],[58.50, 28.31, 45.89, -1.62], [48.70, 21.31, 25.89, 1.62]],
...
[[-18.73, 8.98, 0.29, 8.93],[58.50, 28.31, 45.89, -1.62], [48.70, 21.31, 25.89, 1.62]]]
inputs_2 = [[[0.29, 0.23], [28.31, -1.62]],
[[8.98, 0.65], [21.31, 1.62]],
[[18.50, -1.62], [25.89, 1.62]],
...
[[-48.73, 8.98], [48.70, 1.62]]]
outputs = [1,
1,
0,
...
0]
I am having some difficulties building the model, the first one arises when I want to reshape the data.
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
# scale our data set so that every observation is between 0 and 1
training_data = scaler.fit_transform(inputs_1.reshape(-1, 1))
But list
object has no attribute reshape
I have read this functional api doc but it didn't help me much.
However, I now know that I will merge all available features into a single large vector via concatenation. How to do so with these nested arrays?
Another difficulty was to split the data into train, validation, and test. Articles I have found do it based on a single input data. Is there a way to spit multiple inputs of data?
How could I define the layer, for this case to build the model?
How could I use the api to build my model?
Any hints or a model's skeleton will be welcome.
Thank you in advance.