Created
June 29, 2017 17:26
-
-
Save cympfh/0fb9bf06c15f88f4a67eb7395906c46c to your computer and use it in GitHub Desktop.
This file contains 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
(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