Neural networks in Haskell - advice
You may find this sample application useful. It uses back-propagation. I wrote an article discussing the example, explaining how the use of a functional paradigm affects the design. The article should appear in the next issue of The Monad Reader.
The DataHaskell community keeps a more up-to-date list of Hackage packages at http://www.datahaskell.org/docs/community/current-environment.html#neural-networks
As of 2019-08-26, it recommends these packages:
- neural (CPU-only, see issue 10)
- backprop-learn uses the backprop library (CPU-only?)
- grenade (dependently typed! Comfortable API, but CPU-only so far, see issue 55 / issue 35 / issue 6)
- hasktorch (Haskell bindings to the C libs underlying PyTorch, early development but it should let you train on GPU)
- tensorflow (Haskell bindings to TF; most likely what you'd use in production, but intimidating API; can run on GPU)
- (and sibe (CPU-only), though under the ML heading, implements neural networks)
There's a series of blog posts on using TensorFlow from Haskell at https://mmhaskell.com/blog/2017/8/14/starting-out-with-haskell-tensor-flow / https://mmhaskell.com/blog/2017/8/21/digging-in-deep-solving-a-real-problem-with-haskell-tensor-flow etc.
If you're interested in autograd/differentiable programming, the backprop-learn author shows how to add dependent types to a neural network and how to do automatic differentiation (as in TF) from Haskell, which is what eventually turned into the backprop library. See also the ad library (quick demo here).
There are several libraries on Hackage:
HaskellNN A Haskell library which uses hmatrix (and, transitively, GSL and libLBFGS C libraries) to do heavy lifting (GPL). Claims to be fast.
instinct A pure-Haskell library which claims to be fast (BSD).
hnn A minimal Haskell Neural Network Library (LGPL).
bindings-fann Bindings to FANN library.
hfann Other bindings to FANN library.