Manhattan distance weight function
mandist is the Manhattan distance weight function. Weight functions
apply weights to an input to get weighted inputs.
mandist is also a layer distance function, which can be used to find
the distances between neurons in a layer.
This example shows how to calculate the weighted input matrix.
Define a random weight matrix
W and input vector
P and calculate the corresponding weighted input
W = rand(4,3); P = rand(3,1); Z = mandist(W,P)
This example shows how to calculate the distances of 10 neurons arranged in a three-dimensional space.
Define a random matrix of positions for 10 neurons arranged in three-dimensional space and then find their distances.
pos = rand(3,10); D = mandist(pos)
W— Weight matrix
Weight matrix, specified as an
P— Input matrix
Input matrix, specified as an
Q matrix of
Q input (column) vectors.
pos— Neuron positions
Matrix of neuron positions, specified as an
Z— Vector distances
Matrix of vector distances, returned as an
Matrix of distances, returned as an
To change a network so an input weight uses
'mandist'. For a
layer weight, set
To change a network so a layer’s topology uses
The Manhattan distance
D between two vectors
D = sum(abs(x-y))