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\left( {d,t} \right) = \exp(-d^2/2r^2)\) 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:
$$\alpha \left( t \right) = \alpha_{0} \left( \frac{\alpha_{T}}{\alpha_{0}} \right)^{t/T}$$where t=t
, T=the number of iterations used for training,
\(\alpha_{0}\) = initial learning coefficient,
\(\alpha_{T}\) = final learning coefficient
inverse time:
$$\alpha \left( t \right) = \frac{A}{t+B}$$where 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.