2
$\begingroup$

I am currently building a neural network using Keras to perform a regression.

I have 4 independent variables W,X,Y,Z. They are used to predict 3 different functions f1(W,X,Y,Z), f2(W,X,Y,Z), f3(W,X,Y,Z).

Should my output layer have 1 or 3 neurons? Also, should I be using a relu or linear activation function for the output layer? I'm currently using MSE for my loss function and adam for my optimizer.

For my metrics, should I use 'accuracy' or 'r2'?

Any suggestions? I'm sorry, I'm new to deep learning...

$\endgroup$

2 Answers 2

2
$\begingroup$

Should my output layer have 1 or 3 neurons?

The easiest thing to do is to create 3 separate networks, one for each function you want to approximate.

While it may certainly be beneficial if you combine all 3 outputs into the same model via a multi-task framework, I'd suggest starting off with separate networks, which is more intuitive. Then, if you want to see if combining them under one network improves your performance, you could check out how to create models with multiple outputs in keras.

Also, should I be using a relu or linear activation function for the output layer?

Linear, definitely.

For my metrics, should I use 'accuracy' or 'r2'?

Accuracy is a metric for classification, not regression. $r^2$ can be used, but for certain problems it isn't very reliable. You could try $r^2$, as well as MSE, MAE, MSLE (MSE of the $log$s of the predicted/actual values), etc.

$\endgroup$
1
$\begingroup$

Create a different networks for each function, each with a single output.

Ensure you have at least one hidden layer in each network. Use ReLU in this layer. Use a linear layer at the output without any activation function.

Since you are performing a regression, use the mean squared error to evaluate your networks https://en.wikipedia.org/wiki/Mean_squared_error.

$\endgroup$

Your Answer

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

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