Created
September 24, 2018 13:35
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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