TF-AT C1W3 Assignment: Custom Quadratic Layer: How to improve accuracy without modifying the last code cell

In this assignment, we implemented SimpleQuadratic layer. The final code cell instructed not to modify the code, but achieve 97%+ accuracy. I only got around 87% accuracy, but since all the hyperparameters are in the code block where we are not supposed to modify, what else can we do to improve accuracy?

@Jack_Changfan, I don’t see anything you should need to tweak in order to 97%+ accuracy. For me, it was good enough to just follow the instructions for __init__, build, and call.

For me, accuracy increased pretty quickly, getting up to about 92% after just the first epoch. For comparison, in case it helps, here are my results:
Train on 60000 samples
Epoch 1/5 60000/60000 [==============================] - 12s 205us/sample - loss: 0.2660 - accuracy: 0.9218
Epoch 2/5 60000/60000 [==============================] - 12s 197us/sample - loss: 0.1306 - accuracy: 0.9607
Epoch 3/5 60000/60000 [==============================] - 12s 198us/sample - loss: 0.0997 - accuracy: 0.9694
Epoch 4/5 60000/60000 [==============================] - 12s 198us/sample - loss: 0.0826 - accuracy: 0.9739- loss: 0.0837
Epoch 5/5 60000/60000 [==============================] - 12s 197us/sample - loss: 0.0694 - accuracy: 0.9775 10000/10000 [==============================] - 1s 86us/sample - loss: 0.0698 - accuracy: 0.9791

Some things you might try:

  1. Double-check that your implementation for __init__, build, and call matches the instructions
  2. Double-check that the unit tests are passing
  3. Submit the assignment to see if that gives you any additional hints about where the issue is
  4. Possibly try refreshing the assignment on the off-chance that you inadvertently changed something in a section you weren’t supposed to modify. (To do this, you can rename your current assignment, and then click the help button and choose Get latest version. You’ll need to copy your portion of the code from your renamed file to the new one.)

Thanks for your suggestion. I checked again and indeed found that I indeed added some code in the beginning of the class to be clear what variables are defined under this class (out of C++ coder’s habit :slight_smile: ).
units = None
activation = None
a = None
b = None
c = None

Didn’t expect that would change the behavior. But they actually changed the result. Once I remove them, I got 97% accuracy without needing to tune.


:thinking: I’m not sure why that had an effect either, but glad it worked.