Skip to content

Instantly share code, notes, and snippets.

/test.py Secret

Created August 29, 2017 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/eef4e163441fd98e78c901df79287092 to your computer and use it in GitHub Desktop.
Save anonymous/eef4e163441fd98e78c901df79287092 to your computer and use it in GitHub Desktop.
# build and compile model
# length (in chars) of a label (this is a fixed value)
n = 7
# total number (in chars) in label "alphabet": (0,1,2,3,4,5,6,7,8,9)
k = len("0123456789")
model = models.Sequential()
model.add(layers.Dense(x, activation='relu', input_shape=((N,))))
...
model.add(layers.Dense(n * k, activation=None))
model.add(layers.Reshape((n, k)))
model.add(layers.Dense(n, activation='softmax'))
model.compile(optimizer='rmsprop',
loss='categorical_crossentropy',
metrics=['accuracy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment