/morphine

A neural network built on top of Elixir

Primary LanguageElixirMIT LicenseMIT

Morphine

A neural network library built on top of Elixir.

Inspired by Mind and this awesome blog post

Api examples

alias Morphine.NeuralNetwork, as: Network

### XOR gate
inputs  = [[0, 0, 1], [0, 1, 1], [1, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1], [0, 0, 0]]
outputs = Morphing.Calc.Matrix.transpose([[0, 1, 1, 1, 1, 0, 0]])

{:ok, network} = Network.start_link
Network.setup_layers(network, [{4, 3}, {1, 4} # {number_of_neurons, number_of_weights}])

Network.learn(network, inputs, outputs, 100000)

output = Network.predict(network, [[1, 1, 0]])
# output ~ [[0.007]]

output = Network.predict(network, [[1, 0, 2]])
# output ~ [[0.994]]

Development (using Docker)

make mix.deps.get
make mix.test

Author

@leandronsp