Last active
April 25, 2017 16:23
-
-
Save sortofsleepy/b17417e2cbca1a39d33b32d325f07995 to your computer and use it in GitHub Desktop.
keras-test
This file contains hidden or 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.layers import Lambda | |
from keras.models import Sequential | |
from keras.optimizers import RMSprop | |
# declares toy model that just multiplies input by 2 | |
def mult(x): | |
return x * 2 | |
# declare sequential layer | |
model = Sequential() | |
lam = Lambda(mult,input_shape=(1,), name="out") | |
model.add(lam) | |
# optimizer | |
optim = RMSprop() | |
# compile the model | |
model.compile(optimizer=optim, loss='mean_squared_error') | |
# training data | |
X = np.zeros((1,1)) | |
y = np.zeros((1,1)) | |
# train | |
model.fit(X,y,epochs=1) | |
# run new input against model | |
#inData = np.zeros((1)) | |
#inData[0] = 8 | |
#print(inData) | |
#print(model.predict(inData)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment