The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

# NAME

AI::NeuralNet::Kohonen::Node - a node for AI::NeuralNet::Kohonen

# DESCRIPTION

Implimentation of a node in a SOM - see AI::NeuralNet::Kohonen.

# CONSTRUCTOR (new)

Returns a new `Node` object. If no wieghts are supplied, the node's weights are randomized with real nubmers.

dim

The number of dimensions of this node's weights. Do not supply if you are supplying `weight`.

weight

Optional: a reference to an array containing the weight for this node. Supplying this allows the constructor to work out `dim`, above.

values

The values of the vector. Use `x` for unknown values.

Used to donate missing input in the node. Default is `x`.

# METHOD distance_from

Find the distance of this node from the target.

Accepts: the target vector as an array reference.

Returns: the distance.

``````                       __________________
/ i=n            2
Distance  =  /   E  ( V  -  W )
\/   i=0    i     i``````

Where `V` is the current input vector, and `W` is this node's weight vector.

# METHOD distance_effect

Calculates the effect on learning of distance from a given point (intended to be the BMU).

Accepts: the distance of this node from the given point; the radius of the neighbourhood of affect around the given point.

Returns:

``````                       (            2  )
(    distance   )
THETA(t) = exp ( - ----------- )
(          2    )
(   2 sigma (t) )``````

Where `distance` is the distance of the node from the BMU, and `sigma` is the width of the neighbourhood as calculated elsewhere (see "FINDING THE NEIGHBOURS OF THE BMU" in AI::NeuralNet::Kohonen). THETA also decays over time.

The time `t` is always that of the calling object, and is not referenced here.