Rewrite in Keras for dinosaur-name homework

Hey there,

I tried to focus on writing dinosaur naming assignments, using Keras. But I could never get the loss and accuracy to an acceptable level, even WEIGHT exploded, asking for help.

Here is the notebook I did.

Merci :clap:

image
LSTM is a keras layer class, every time you initialize a class means a new instance is created. In RNN model, we share the same object (and its weights) at each step. Thus, you should initialize only one LSTM (as well as Dense and Reshape) object before the loop. Jazz Improvisation with has similar implementation.

I have tried global variables, as well as creation in loops. These 2 approaches produced similar results and did not change the training results of the whole model. It always hovered around high loss and low accuracy.

(Also, if I use models.Sequential, everything is yet OK, although, for learning purposes, I don’t want to use it.)

@edwardyu

Did you move Dense layer object outside the loop?

I move all layers to the global to share weights, the result is still uncool, do you have any idea @edwardyu :joy:

Output layer (Dense layer) should apply softmax activation function for multi-class model.

LGTM now @edwardyu

Merci :bowing_man: