Negative distance weight function
Syntax
Z = negdist(W,P)
df = negdist('deriv')
Description
negdist
is a weight function. Weight functions apply weights to an input to get weighted inputs.
negdist(W,P)
takes these inputs,
and returns the S
x Q
matrix of negative vector distances.
negdist('deriv')
returns ''
because negdist
does not have a derivative function.
Examples
Here we define a random weight matrix W
and input vector P
and calculate the corresponding weighted input Z
.
W = rand(4,3);
P = rand(3,1);
Z = negdist(W,P)
Network Use
You can create a standard network that uses negdist
by calling newc
or newsom
.
To change a network so an input weight uses negdist,
set net.inputWeight{i,j}.weightFcn
to 'negdist'
. For a layer weight set net.inputWeight{i,j}.weightFcn
to 'negdist'
.
In either case, call sim
to simulate the network with negdist
. See newc
or newsom
for simulation examples.
Algorithm
negdist
returns the negative Euclidean distance:
z = -sqrt(sum(w-p)^2)
See Also
sim
,
dotprod
,
dist
[ Previous | Help Desk | Next ]