Neural Network Toolbox Previous page   Next Page

Distance Funct. (dist, linkdist, mandist, boxdist)

In this toolbox, there are four distinct ways to calculate distances from a particular neuron to its neighbors. Each calculation method is implemented with a special function.

The dist function has been discussed before. It calculates the Euclidean distance from a home neuron to any other neuron. Suppose we have three neurons:

We find the distance from each neuron to the other with

Thus, the distance from neuron 1 to itself is 0, the distance from neuron 1 to neuron 2 is 1.414, etc. These are indeed the Euclidean distances as we know them.

The graph below shows a home neuron in a two-dimensional (gridtop) layer of neurons. The home neuron has neighborhoods of increasing diameter surrounding it. A neighborhood of diameter 1 includes the home neuron and its immediate neighbors. The neighborhood of diameter 2 includes the diameter 1 neurons and their immediate neighbors.

As for the dist function, all the neighborhoods for an S neuron layer map are represented by an S-by-S matrix of distances. The particular distances shown above (1 in the immediate neighborhood, 2 in neighborhood 2, etc.), are generated by the function boxdist. Suppose that we have six neurons in a gridtop configuration.

Then the box distances are

The distance from neuron 1 to 2, 3, and 4 is just 1, for they are in the immediate neighborhood. The distance from neuron 1 to both 5 and 6 is 2. The distance from both 3 and 4 to all other neurons is just 1.

The link distance from one neuron is just the number of links, or steps, that must be taken to get to the neuron under consideration. Thus, if we calculate the distances from the same set of neurons with linkdist we get

The Manhattan distance between two vectors x and y is calculated as

Thus if we have

and

then we get for the distances

The distances calculated with mandist do indeed follow the mathematical expression given above.


Previous page  Topologies (gridtop, hextop, randtop) Architecture Next page

© 1994-2005 The MathWorks, Inc.