public class KohonenUpdateAction extends java.lang.Object implements UpdateAction
update
method modifies the
features w
of the "winning" neuron and its neighbours
according to the following rule:
wnew = wold + α e(-d / σ) * (sample - wold)
where
d
is the number of links to traverse in order to reach
the neuron from the winning neuron.constructor
are instances of thread-safe
classes.
update
method
will increment the internal counter used to compute the current
values for
Modifier and Type | Field and Description |
---|---|
private DistanceMeasure |
distance
Distance function.
|
private LearningFactorFunction |
learningFactor
Learning factor update function.
|
private NeighbourhoodSizeFunction |
neighbourhoodSize
Neighbourhood size update function.
|
private java.util.concurrent.atomic.AtomicLong |
numberOfCalls
Number of calls to
update(Network,double[]) . |
Constructor and Description |
---|
KohonenUpdateAction(DistanceMeasure distance,
LearningFactorFunction learningFactor,
NeighbourhoodSizeFunction neighbourhoodSize) |
Modifier and Type | Method and Description |
---|---|
private double[] |
computeFeatures(double[] current,
double[] sample,
double learningRate)
Computes the new value of the features set.
|
private Neuron |
findAndUpdateBestNeuron(Network net,
double[] features,
double learningRate)
Searches for the neuron whose features are closest to the given
sample, and atomically updates its features.
|
long |
getNumberOfCalls()
Retrieves the number of calls to the
update
method. |
void |
update(Network net,
double[] features)
Updates the network in response to the sample
features . |
private void |
updateNeighbouringNeuron(Neuron n,
double[] features,
double learningRate)
Atomically updates the given neuron.
|
private final DistanceMeasure distance
private final LearningFactorFunction learningFactor
private final NeighbourhoodSizeFunction neighbourhoodSize
private final java.util.concurrent.atomic.AtomicLong numberOfCalls
update(Network,double[])
.public KohonenUpdateAction(DistanceMeasure distance, LearningFactorFunction learningFactor, NeighbourhoodSizeFunction neighbourhoodSize)
distance
- Distance function.learningFactor
- Learning factor update function.neighbourhoodSize
- Neighbourhood size update function.public void update(Network net, double[] features)
features
.update
in interface UpdateAction
net
- Network.features
- Training data.public long getNumberOfCalls()
update
method.private void updateNeighbouringNeuron(Neuron n, double[] features, double learningRate)
n
- Neuron to be updated.features
- Training data.learningRate
- Learning factor.private Neuron findAndUpdateBestNeuron(Network net, double[] features, double learningRate)
net
- Network.features
- Sample data.learningRate
- Current learning factor.private double[] computeFeatures(double[] current, double[] sample, double learningRate)
current
- Current values of the features.sample
- Training data.learningRate
- Learning factor.