neural: Neural Networks in native Haskell

[ library, machine-learning, mit, program ] [ Propose Tags ]

The goal of neural is to provide a modular and flexible neural network library written in native Haskell.

Features include

• composability via arrow-like instances and pipes,

• automatic differentiation for automatic gradient descent/ backpropagation training (using Edward Kmett's fabulous ad library).

The idea is to be able to easily define new components and wire them up in flexible, possibly complicated ways (convolutional deep networks etc.).

Four examples are included as proof of concept:

• A simple neural network that approximates the sine function on [0,2 pi].

• Another simple neural network that approximates the sqrt function on [0,4].

• A slightly more complicated neural network that solves the famous Iris flower problem.

• A first (still simple) neural network for recognizing handwritten digits from the equally famous MNIST database.

The library is still very much experimental at this point.

Versions 0.1.0.0, 0.1.0.1, 0.1.1.0, 0.2.0.0, 0.3.0.0, 0.3.0.1 ad, ansi-terminal, array, attoparsec, base (>=4.7 && <5), bytestring, containers, deepseq, directory, filepath, ghc-typelits-natnormalise, hspec, JuicyPixels, kan-extensions, lens, monad-par, monad-par-extras, MonadRandom, mtl, neural, parallel, pipes, pipes-bytestring, pipes-safe, pipes-zlib, profunctors, random, reflection, STMonadTrans, text, transformers, typelits-witnesses, vector, vector-sized [details] MIT Copyright: (c) 2016 Lars Bruenjes Lars Bruenjes brunjlar@gmail.com Machine Learning https://github.com/brunjlar/neural https://github.com/brunjlar/neural/issues head: git clone https://github.com/brunjlar/neural.gitthis: git clone https://github.com/brunjlar/neural.git(tag 0.3.0.1) by lbrunjes at Thu Jul 27 21:39:57 UTC 2017 NixOS:0.3.0.1 MNIST, sqrt, sin, iris 1730 total (50 in the last 30 days) 2.0 (votes: 1) [estimated by rule of succession] λ λ λ Docs not available All reported builds failed as of 2017-08-20 Hackage Matrix CI

Modules

• Data
• Data.FixedSize
• Data.FixedSize.Class
• Data.FixedSize.Matrix
• Data.FixedSize.Vector
• Data.FixedSize.Volume
• Data.MyPrelude
• Data.Utils
• Data.Utils.Analytic
• Data.Utils.Arrow
• Data.Utils.Cache
• Data.Utils.List
• Data.Utils.Pipes
• Data.Utils.Random
• Data.Utils.Stack
• Data.Utils.Statistics
• Data.Utils.Traversable
• Numeric
• Numeric.Neural
• Numeric.Neural.Convolution
• Numeric.Neural.Layer
• Numeric.Neural.Model
• Numeric.Neural.Normalization
• Numeric.Neural.Pipes

Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]

neural - Neural Nets in native Haskell

Motivation

The goal of this project is to provide a flexible framework for neural networks (and similar parameterized models) in Haskell.

There are already a couple of neural network libraries out there on Hackage, but as far as I can tell, they either

• are wrappers for an engine written in another language or
• offer a limitted choice of network architectures, training algorithms or error functions or are not easily extensible.

The goal of this library is to have an implementation in native Haskell (reasonably efficient) which offers maximal flexibility.

Furthermore, gradient descent/backpropagation should work automatically, using automatic differentiation. This means that new and complicated activation functions and/or network architectures can be used without the need to first calculate derivatives by hand.

In order to provide a powerful and flexible API, models are constructed using components which behave as if they implemented the Arrow and ArrowChoice typeclasses. They can therefore easily be combined and transformed.

Once a model has been constructed, it can be hooked up into a customized training algorithm using pipes, so that various aspects of the algorithm (loading data, choosing random samples, reporting intermediate results, stop criterium etc.) can be defined in a modular, decoupled way.

Even though neural networks are the primary motivation for this project, any other kind of model can be defined in the same framework, whenever the model depends on a collection of numerical parameters in a differentiable way. - One simple example for this would be linear regression.

Examples

At the moment, four examples are included:

• sin models the regression problem of approximating the sine function on the interval [0,2 pi].

• sqrt models the similar regression problem of approximating the square root function on the interval [0,4].

• iris solves the famous Iris Flower classification problem.

• MNIST tackles the equally famous MNIST problem of recognizing handwritten digits.