3 ms·
Just for comparison this is almost the same using a library [1]: import numpy as np X = np.array([ [0,0,1],[0,1,1],[1,0,1],[1,1,1]]) y = np.array([[0,0,1
by elyase 11y ago
Just for comparison this is almost the same using a library [1]:
import numpy as np
X = np.array([ [0,0,1],[0,1,1],[1,0,1],[1,1,1]])
y = np.array([[0,0,1,1]]).T
from keras.models import Sequential
from keras.layers.core import Dense
model = Sequential([Dense(3, 1, init='uniform', activation='sigmoid')])
model.compile(loss='mean_absolute_error', optimizer='sgd')
model.fit(X, y, nb_epoch=10000)
model.predict(X)
[1] http://keras.io http://keras.io
- avyfain 11y agoBut this is not nearly as clear for a beginner, or someone who doesn't know what Sequential, compile, fit and predict are doing.