hnn-0.1: A minimal Haskell Neural Network Library

AI.HNN.Neuron

Contents

Description

Neuron module, defining an artificial neuron type and the basical operations we can do on it

Synopsis

Type Definitions, type class instances

data Neuron Source

Our Artificial Neuron type

Constructors

Neuron 

Instances

Neuron creation

createNeuronU :: Double -> UArr Double -> (Double -> Double) -> NeuronSource

Creates a Neuron with the given threshold, weights and transfer function

createNeuronHeavysideU :: Double -> UArr Double -> NeuronSource

Equivalent to `createNeuronU t ws heavyside'

createNeuronSigmoidU :: Double -> UArr Double -> NeuronSource

Equivalent to `createNeuronU t ws sigmoid'

createNeuron :: Double -> [Double] -> (Double -> Double) -> NeuronSource

Same as createNeuronU, with a list instead of an UArr for the weights (converted to UArr anyway)

createNeuronHeavyside :: Double -> [Double] -> NeuronSource

Same as createNeuronHeavysideU, with a list instead of an UArr for the weights (converted to UArr anyway)

createNeuronSigmoid :: Double -> [Double] -> NeuronSource

Same as createNeuronSigmoidU, with a list instead of an UArr for the weights (converted to UArr anyway)

Transfer functions

heavyside :: Double -> DoubleSource

The Heavyside function

sigmoid :: Double -> DoubleSource

The Sigmoid function

Neuron output computation

computeU :: Neuron -> UArr Double -> DoubleSource

Computes the output of a given Neuron for given inputs

compute :: Neuron -> [Double] -> DoubleSource

Computes the output of a given Neuron for given inputs

Neuron learning with Widrow-Hoff (Delta rule)

learnSampleU :: Double -> Neuron -> (UArr Double, Double) -> NeuronSource

Trains a neuron with the given sample, of the form (inputs, wanted_result) and the given learning ratio (alpha)

learnSamplesU :: Double -> Neuron -> [(UArr Double, Double)] -> NeuronSource

Trains a neuron with the given samples and the given learning ratio (alpha)

learnSamples :: Double -> Neuron -> [([Double], Double)] -> NeuronSource

Trains a neuron with the given samples and the given learning ratio (alpha)