Skip to content

Instantly share code, notes, and snippets.

@akelleh
Last active June 5, 2017 02:24
Show Gist options
  • Save akelleh/26ed5e50fa336d11b0a96cb7aee32ccc to your computer and use it in GitHub Desktop.
Save akelleh/26ed5e50fa336d11b0a96cb7aee32ccc to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
from keras.models import Model
from keras.layers import Dense, Input
x_in = Input(shape=(2,))
h1 = Dense(2, activation='relu')(x_in)
y = Dense(1, activation='linear')(h1)
model = Model(input=x_in, output=y)
model.compile(optimizer='rmsprop',
loss='mean_squared_error')
model.fit(x=[[0,0],[0,1],[1,0],[1,1]], y=[[0],[1],[1],[0]], nb_epoch=2000)
model.predict([[0,0],[0,1],[1,0],[1,1]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment