I am making a neural network in Clojure that can take an array of integers,and return a data structure representing the layers of a neural network: so (make-layers [1 4 5])
would evaluate to:
[[0] <-- input
[0 0 0 0] <-- hidden
[0 0 0 0 0]] <-- output
When I run my activation function on the weights of the network, however, I get a core.matrix error saying that it can't do the matrix multiplication on an input of a one-dimensional vector with the transpose of the weights:
(core.matrix.operators/* inputs (transpose weights))
user=> Incompatible shapes, cannot broadcast [1] to [4 2]
I understand why this is not working from the perspective of matrix multiplication, but I am not sure how to rewrite the function to deal with layers of arbitrary length.
Here is a gist that shows what I am working on: https://gist.github.com/gamma235/b8db845a512c60d123af