0
$\begingroup$

I have about 20 targets in a model I'd like to try to forecast, these each take many features (the same ~100 features and use different formula/relations etc. observed/simulated).

Does it make sense to use one neural network predicting many targets or should there always only be one target per neural network? Or is there a way to divide up most 'commonly related' (e.g. correlated) targets and have e.g. 4 neural networks 5 targets each?

$\endgroup$
1
  • $\begingroup$ what is the type of target ? Categorical, Continuous ? It will be greated if you can name some of targets . $\endgroup$
    – amol goel
    Aug 17, 2022 at 12:50

2 Answers 2

1
$\begingroup$

It makes more sense to make one bigger network with 20 neurons in the output layer so you can exploit the whole dataset size and the network will create better data representation on middle layers and generalize better.

It is also a better idea because, even if you have multiple NNs, then you have to figure out a way to use the correct one for a given input and that step requires further optimization and may lead to additional errors

$\endgroup$
0
$\begingroup$

Your best option is to make one large neural network and for the output layer you should use 20 neurons (number of possible outcomes) and you should use a softmax activation function. Your model can look something like this.

input_dim = X_train.shape[1]

model = Sequential()
model.add(layers.Dense(10, activation='relu', input_dim=input_dim))
model.add(layers.Dense(20, activation='softmax'))

model.compile(loss='categorical_crossentropy', 
               optimizer='adam', 
               metrics=['accuracy'])
model.summary()
$\endgroup$
2
  • $\begingroup$ Thank you! Can you clarify why you recommend softmax? $\endgroup$
    – Socorro
    Aug 17, 2022 at 12:38
  • $\begingroup$ The output of a Softmax activation function is a vector with probabilities of each possible outcome. So you will obtain a list of the probabilities for each neuron ( corrisponding to each class ) and the class with the highest probability will be your output. $\endgroup$
    – HasanArcas
    Aug 17, 2022 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.