instinct-0.1.0: Fast artifical neural networks

MaintainerErtugrul Soeylemez <es@ertes.de>

AI.Instinct.Brain

Contents

Description

This module provides artifical neural networks.

Synopsis

Brains

data Brain Source

A Brain value is an aritifical neural network.

Constructors

Brain 

Fields

brainAct :: Activation

Activation function.

brainConns :: ConnMatrix

Connection matrix.

brainInputs :: Int

Number of input neurons.

brainOutputs :: Int

Number of output neurons.

Instances

type Pattern = Vector DoubleSource

A signal pattern.

Initialization

data NetInit Source

Network builder configuration. See buildNet.

Constructors

InitMLP

Recipe for a multi-layer perceptron. This is a neural network, which is made up of neuron layers, where adjacent layers are (in this case fully) connected.

Fields

mlpActFunc :: Activation

Network's activation function.

mlpLayers :: [Int]

Layer sizes from input to output.

Instances

buildNet :: NetInit -> IO BrainSource

Build a random neural network from the given description.

High level

runNet :: Brain -> Pattern -> PatternSource

Pass the given input pattern through the given neural network and return its output.

runNetList :: Brain -> [Double] -> [Double]Source

Convenience wrapper around runNet using lists instead of vectors. If you care for performance, use runNet.

Low level

activation :: Brain -> Pattern -> Vector DoubleSource

Feeds the given input vector into the network and calculates the activation vector.

netInput :: Brain -> Pattern -> Vector DoubleSource

Calculate the net input vector, i.e. the values just before applying the activation function.

netInputFrom :: Brain -> Vector Double -> Pattern -> Vector DoubleSource

Calculate the net input vector from the given activation vector.

Utility functions

listPat :: [Double] -> PatternSource

Construct a pattern vector from a list.

patError :: Pattern -> Pattern -> DoubleSource

The total discrepancy between the two given patterns. Can be used to calculate the total network error.