0
$\begingroup$

I am trying to train a keras NN regression model for music emotion prediction from audio features. (I am a beginner in NN and I am doing this as study project.) I have 193 features for training/prediction and it should predict valence and arousal values.

I have prepared a NN model with 5 layers:

model = Sequential()
model.add(Dense(100, activation='elu', input_dim=193))
model.add(Dense(200, activation='elu'))
model.add(Dense(200, activation='elu'))
model.add(Dense(100, activation='elu'))
model.add(Dense(  2, activation='elu'))

And this is my loss and optimizer metrics:

model.compile( loss = "mean_squared_error", optimizer = 'RMSprop', metrics=['accuracy'] )

When I try to train this model, I get this graph for loss and validation:

So the model is trained and reaches accuracy of >0.9 on training data, but on test data accuracy wont fall, but it stays on ~0.5. enter image description here

I don't know how to interpret this graph. I don't think this is overfitting, because validation accuracy wont fall, but it stays the same. How can I try fix this?

Update: I tried to add dropout and regularization and it worked in a way that now I clearly see that I have a problem with over-fitting. But now I am stuck again. I can not make my model to decrease validation loss. It always stops at about 0.3 validation loss. I tried changing my model architecture, data preprocessing, optimizer function, and nothing helped. enter image description here

$\endgroup$
1
  • $\begingroup$ Change the last Layer's Activation to Linear. Metric to MSE if its a Regression case $\endgroup$
    – 10xAI
    Nov 26, 2020 at 15:40

2 Answers 2

0
$\begingroup$

You say it's a regression task, predicting valence and arousal values, although you use accuracy as a performance metric. This does not make much sense, so your accuracy graph doesn't really say much. MSE is a valid performance metric for regression tasks in general, so your loss graph is more descriptive of what is going on. The loss-graph most definitely displays the characteristic of over-fitting, so I would recommend you to add regularization to your model.

This can be done by for example incorporating dropout and L1/L2-regularisation.

$\endgroup$
2
  • $\begingroup$ Thank you for answer. I am a beginner in NN and I am doing this as study project. I tried to add dropout and regularization and it worked in a way that now I clearly see that I have a problem with over-fitting. But now I am stuck again. I can not make my model to decrease validation loss. It always stops at about 0.3 validation loss. I tried changing my model architecture, data preprocessing, optimizer function, and nothing helped. $\endgroup$
    – Kamion
    Nov 26, 2020 at 9:24
  • $\begingroup$ I would recommend you to start with a much smaller model with only one dense layer, with perhaps 50 neurons, together with regularization-parameters so that training loss and validation loss stay roughly the same. This should give you a baseline performance. Now increase the number of neurons and the number of hidden layers, and tweak the regularization to see if you can get increased performance. $\endgroup$
    – Marcus
    Nov 26, 2020 at 10:35
0
$\begingroup$

In case of any linear model one should not use any kind of activation function as by default nn provides linear output if we dont apply any activation on it. You nn should look like this:

model = Sequential()
model.add(Dense(100, activation='elu', input_dim=193))
model.add(Dense(200, activation='elu'))
model.add(Dense(200, activation='elu'))
model.add(Dense(100, activation='elu'))
model.add(Dense(2))

model.compile( loss = "mean_squared_error", optimizer = 'RMSprop', metrics=['mse'] )
```
$\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.