1
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – aminrd
    Oct 28, 2019 at 18:18
  • $\begingroup$ 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.. $\endgroup$
    – Riz
    Oct 29, 2019 at 20:53

1 Answer 1

0
$\begingroup$

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

# Read data
train = pd.read_csv('../input/train.csv')
labels = train.ix[:,0].values.astype('int32')
X_train = (train.ix[:,1:].values).astype('float32')
X_test = (pd.read_csv('../input/test.csv').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()
model.add(Dense(128, input_dim=input_dim))
model.add(Activation('relu'))
model.add(Dropout(0.15))
model.add(Dense(128))
model.add(Activation('relu'))
model.add(Dropout(0.15))
model.add(Dense(nb_classes))
model.add(Activation('softmax'))

# 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")

Code source: https://www.kaggle.com/fchollet/simple-deep-mlp-with-keras

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!

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .