# Construct a multivariate neural network

I want to build a neural network with a data input of 15-18 variables. I want to use the model for anomaly detection based on the reconstruction error. I've done some tutorials now but the data was always already given so I have to do the very first step on my own now. Thus, I wonder, how do I handle the multivariate data?

I see three options:

• 1) Build a single neural network for each variable (univariate)
• 2) Build a neural network with a single outcome based on all multivariate input variables
• 3) Build a neural network with a multivariate output based on a multivariate input.

1) and 2) is quite cumbersome I'd say. But is 3) even possible? If so, what do I have to take into account? Will the outcome variable then just be a data frame, or some other type like a certain array or so?

• Assuming a multilayer perceptron and a regression problem, the following code would try to solve it : model = Sequential() model.add(Dense(units= number_neurons, input_dim=number_variable_first_layer, activation = 'relu') model.add(units=number_neurons, activation='relu') model.add(units=number_variable_to_predict) Here, the neural network is a perceptron with 1 input layer 2 hidden layers and 1 output layer. Do not forget to compile it : model.compile(optimizer='rmsprop', loss='mean_squared_error'). Then you can fit and predict. One would also use Dropout to avoid over-fitting – kakarotto Sep 27 '19 at 12:57