Skip to content

Instantly share code, notes, and snippets.

@cympfh
Created June 29, 2017 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cympfh/0fb9bf06c15f88f4a67eb7395906c46c to your computer and use it in GitHub Desktop.
Save cympfh/0fb9bf06c15f88f4a67eb7395906c46c to your computer and use it in GitHub Desktop.
(import
(numpy)
(keras.layers (Dense))
(keras.models (Sequential)))
(def model
(doto
(Sequential)
(.add (Dense 10 :input_shape (, 1) :activation "relu"))
(.add (Dense 10 :activation "relu"))
(.add (Dense 1))
(.compile :loss "mae" :optimizer "sgd")
(.summary)))
(def batch-size 500)
(def dummy-x (numpy.random.randn batch-size 1))
(def dummy-y (* dummy-x dummy-x))
(print (get dummy-x (slice None 10)))
(print (get dummy-y (slice None 10)))
(.fit model dummy-x dummy-y :epochs 1000 :verbose 2)
(def predicted-y (.predict model dummy-x))
(print (get predicted-y (slice None 10)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment