# How to define a multi-dimensional neural network with keras

I have implemented a simple neural network with keras that takes an input of 50 values and returns a classification of '0' or '1'. I believe the model is expecting an input shape of (50, 1). I'd like to add another 50 data values for each input, but I'd like them to be associated with the original 50 respective inputs. So instead of making the input of shape (100, 1), I guess I'd like to make it of shape (50, 2). I would like the neural network to know from the start that each input feature has two values associated with it, instead of it thinking there are 100 separate input features. Here's what I have so far:

model = Sequential()


Can anyone show me the way the alter this structure to accept my new input shape?

If you want to use a simple neural network which takes in a 50x2 matrix you can do this y flattening your matrix to a 100x1 vector. This will make no difference in the way that the neurons are processed. Each neuron will take all the inputs and make a decision on its weight accordingly.

If you want some neighborhood feature selection then you can use a convolutional neural network like

model = Sequential()
activation='relu',
input_shape=input_shape,

model.compile(loss='binary_crossentropy',
metrics=['accuracy'])


This will do a feature mixing within a 2x2 window across your matrix which will thus mix your two values before feeding them to the deeper part of the network.

Doing this is also a good idea as it serves as a means to reduce the complexity of your model which may lead to better results.