Skip to content

Instantly share code, notes, and snippets.

@anj-s
Last active July 10, 2018 20:04
Show Gist options
  • Save anj-s/5c3396f3c33653c3b2a4b2a1cb0778f2 to your computer and use it in GitHub Desktop.
Save anj-s/5c3396f3c33653c3b2a4b2a1cb0778f2 to your computer and use it in GitHub Desktop.
import tensorflow as tf
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Dense(32, activation='relu', input_dim=100))
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
model.compile(optimizer=tf.keras.optimizers.Adadelta(rho=0.9),
loss='binary_crossentropy',
metrics=['accuracy'])
# Generate dummy data
import numpy as np
data = np.random.random((1000, 100))
labels = np.random.randint(2, size=(1000, 1))
# Train the model, iterating on the data in batches of 32 samples
model.fit(data, labels, epochs=10, batch_size=32)S)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment