"Deep Learning in Clojure with Fewer Parentheses than Keras and Python"
Love it! :D What better way to define a neural network in code than an S-expression?
Love it! :D What better way to define a neural network in code than an S-expression?
Python:
model = Sequential()
model.add(Conv2D(32, kernel_size=(3, 3),
activation='relu',
input_shape=(28, 28, 1)))
Clojure: (defonce net-bp
(network (desc [128 1 28 28] :float :nchw)
Which one is more readable? looking on the Clojure code I see 128 1 28 28 thrown on me, without digging in the documentation I have no idea what's happening.Both are equally readable to me.
Now, granted 128 1 28 28 can be difficult to understand without documentation but that is not due to Lisp's fully parenthesized prefix notation. The Clojure code would also look equally readable if it had used keyword arguments.
Are you sure you are not confounding familiarity with readability? With Lisp, after a while, the parentheses become invisible to the programmer.
Python:
model = Sequential()
model.add(Conv2D(32, (3, 3),'relu', (28, 28, 1)))
Clojure: (defonce net-bp
(network (desc :input-shape [128 1 28 28]
:type :float
:something :nchw)
It all depends on how desc is defined.Disclaimer: no idea what those functions mean, I only made syntactic changes.