Skip to content

Instantly share code, notes, and snippets.

@hhefesto
Created November 6, 2018 05:13
Show Gist options
  • Select an option

  • Save hhefesto/4dfd573982b925596a99cc532a1ac796 to your computer and use it in GitHub Desktop.

Select an option

Save hhefesto/4dfd573982b925596a99cc532a1ac796 to your computer and use it in GitHub Desktop.
from keras.models import Sequential
from keras.layers import Dense
model = Sequential()
model.add(Dense(units=64, activation='relu', input_dim=100))
model.add(Dense(units=10, activation='softmax'))
model.compile(loss='categorical_crossentropy',
optimizer='sgd',
metrics=['accuracy'])
model.compile(loss=keras.losses.categorical_crossentropy,
optimizer=keras.optimizers.SGD(lr=0.01, momentum=0.9, nesterov=True))
# x_train and y_train are Numpy arrays --just like in the Scikit-Learn API.
model.fit(x_train, y_train, epochs=5, batch_size=32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment