public class KohonenSOMEx1 extends KohonenSOMTrainer
This example creates a Kohonen network with 40 x 40 nodes using the class
KohonenSOM
. Each node has 3 weights, representing the RGB values of a
color. This network is trained with 8 colors using 500 iterations. Then, the
example prints out a forecast result.
The initial image of the nodes is:
After the training, the image is:
Constructor and Description |
---|
KohonenSOMEx1() |
Modifier and Type | Method and Description |
---|---|
double |
getLearningCoefficient(int t)
Returns the learning coefficient.
|
double |
getNeighborhoodValue(int t,
double d)
Returns the neighborhood function value.
|
static void |
main(String[] args) |
getIterations, getNumberOfThreads, setIterations, setNumberOfThreads, train
public double getNeighborhoodValue(int t, double d)
KohonenSOMTrainer
h(d,t)=exp(−d2/2r2) where r represents the neighborhood radius at index t
getNeighborhoodValue
in class KohonenSOMTrainer
t
- An int
scalar containing the current iteration
of the training.d
- A double
scalar containing the lattice distance
between the best matching node and the
current node.double
scalar containing the computed
neighborhood function value.public double getLearningCoefficient(int t)
KohonenSOMTrainer
t
. Typical forms are linear, power, and inverse
time/step. For example:
power:
α(t)=α0(αTα0)t/Twhere t=t
, T=the number of iterations used for training,
α0 = initial learning coefficient,
αT = final learning coefficient
inverse time:
α(t)=At+Bwhere A and B are user determined constants
getLearningCoefficient
in class KohonenSOMTrainer
t
- An int
scalar containing the current iteration
of the training.double
scalar containing the computed learning
coefficient.public static void main(String[] args)
Copyright © 2020 Rogue Wave Software. All rights reserved.