Skip to content

Instantly share code, notes, and snippets.

@sweemeng
Created September 24, 2018 13:35
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 sweemeng/fb7241ba75cccc7bb530022939196d5b to your computer and use it in GitHub Desktop.
Save sweemeng/fb7241ba75cccc7bb530022939196d5b to your computer and use it in GitHub Desktop.
just an implementation of neural network model for imdb from Deep Learning With Python book
from keras import models
from keras import layers
def model(training_data, training_label, epochs=20):
model = models.Sequential()
model.add(layers.Dense(16, activation='relu', input_shape=(10000,)))
model.add(layers.Dense(16, activation='relu'))
model.add(layers.Dense(1, activation='sigmoid'))
model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy'])
model.fit(x_train, y_train, epochs=epochs, batch_size=512)
return model
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment