# Which model can I use for this problem with multiple inputs and outputs?

Which model is the most appropriate for this problem with multiple inputs and outputs?

The data set is

A1, A2, A3, A4, A5, A6, B1, B2, B3, B4


where A1, A2, A3, A4, A5, A6 are the inputs and B1, B2, B3, B4 the outputs (this is what I want the model to predict).

What an LSTM be appropriate for this task? Any advice or hint would be much appreciated. Also if anyone can share already done examples, it would really help me a lot.

• Can you please mention what is the nature of your data? In really depends on the types of your inputs and outputs. LSTM works better usually when you are dealing with sequential data or data with temporal relationship. – aminrd Oct 28 '19 at 18:18
• Thanks for your comments....It is basically electrical load/energy consumption dataset containing mainly: Equipment Details(Eg: type of equipment, AC, Fridge, etc) Electrical Load Detail (eg: Power, Voltage, Current, Watts, Heat dissipation ..etc) Output data: Power, Current, Voltage etc prediction using the availale dataset... As you can see for this dataset sequence doesnt matter. Currently the data is being calculated using different electrical power equations depending on type of equipment...So time stamping or sequence is not important.. – Riz Oct 29 '19 at 20:53

This depend on type of data you use.

## Time sequence data

If the data advanced in time, a LSTM or similar RNN should be used. RNN calculate output through time. It works very good on time series data as it have a real sense of time. While CNN and MLP could work for time series data, it often don't work that well as different timestep of data is not defined.

## Non- Time sequence data

According to you previous comment, the data seems to be of this kind. In the case of your data, a normal Multi-layer perceptron works well for this. The data is a direct mapping between the input and the output. If the input data is an image, use a CNN.

For example code in keras, see here: You need the pandas module for this to work. Run pip install pandas to install pandas. from keras.models import Sequential from keras.utils import np_utils from keras.layers.core import Dense, Activation, Dropout

import pandas as pd
import numpy as np

labels = train.ix[:,0].values.astype('int32')
X_train = (train.ix[:,1:].values).astype('float32')

# convert list of labels to binary class matrix
y_train = np_utils.to_categorical(labels)

# pre-processing: divide by max and substract mean
scale = np.max(X_train)
X_train /= scale
X_test /= scale

mean = np.std(X_train)
X_train -= mean
X_test -= mean

input_dim = X_train.shape[1]
nb_classes = y_train.shape[1]

# Here's a Deep Dumb MLP (DDMLP)
model = Sequential()

# we'll use categorical xent for the loss, and RMSprop as the optimizer
model.compile(loss='categorical_crossentropy', optimizer='rmsprop')

print("Training...")
model.fit(X_train, y_train, nb_epoch=10, batch_size=16, validation_split=0.1, show_accuracy=True, verbose=2)

print("Generating test predictions...")
preds = model.predict_classes(X_test, verbose=0)

def write_preds(preds, fname):
pd.DataFrame({"ImageId": list(range(1,len(preds)+1)), "Label": preds}).to_csv(fname, index=False, header=True)

write_preds(preds, "keras-mlp.csv")


In conclusion, in the case of our data, use a multi layer perceptron should work. Hope kit can help you and have a nice day!

• Many thanks..MLP fits my requirement. Would appreciate if you could share any example implementation using Keras if possible.... – Riz Nov 4 '19 at 1:02
• Edited the answer to include example code. Hope it can help you. – Clement Hui Nov 4 '19 at 5:00