C3W2 - problem with

{Please do not post codes which will grade your assignment, it is against community guidelines and can cause revoke of your membership at the discourse community}

return model

my code only can run if I set the output layer units at 7, and the model is overfitting, train_accuracy to 1, val_acc is 0.75. why is this happen?

Hello @wyxenia

Please choose the course and weeks’ categories correctly as I had changed it as per your header now.

Choosing an incorrect category can cause delay in response or incorrect response from mentors due mismatch information.

Also refrain from posting any codes from grade cell, rather you could take a screenshot of the model training results or your output with the expected output or accuracy the assignment instructions mentions.

Next based on

This is indeed overfitting issue. The last layer being chosen as 7 could be related to the class of the data being using.

Can you explain more a bit on what kind of data in hand you have and the choice of layers you chose in brief explanation.

Regards
DP

Hey,

Sorry for the confusion, I thought I put the right category.

there is the result from the function, all the outputs previously are the same as the expected results. If I changed the output layer to unit 5, I got the error I attached below. If I changed it to 7, the model can run but overfit no matter how I tune the hyperparameters (epochs/ layers/ units). Could you help me with it?

Thank you!

Best regards,
Xenia

issue is not only with unit choice of dense layer, issue is more with the labelling of your data.

You have given a label value of 87 where as the assignment is looking for [0,5] based on your error output.

Regards
DP