Class KohonenSOMEx1

java.lang.Object
com.imsl.datamining.KohonenSOMTrainer
com.imsl.test.example.datamining.KohonenSOMEx1
All Implemented Interfaces:
Serializable

public class KohonenSOMEx1 extends KohonenSOMTrainer

Creates and trains a Kohonen self-organizing map.

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:

<img src="doc-files/KohonenSOMEx1_1.png" width="202" height="202"/img>

After the training, the image is:

<img src="doc-files/KohonenSOMEx1_2.png" width="202" height="202"/img>
See Also:
  • Constructor Details

    • KohonenSOMEx1

      public KohonenSOMEx1()
  • Method Details

    • getNeighborhoodValue

      public double getNeighborhoodValue(int t, double d)
      Description copied from class: KohonenSOMTrainer
      Returns the neighborhood function value. In the simplest form, the neighborhood function \(h\left( {d,t} \right)\) is 1 for all nodes closest to the BMU and 0 for others, but a Gaussian function is also commonly used. For example:

      \(h\left( {d,t} \right) = \exp(-d^2/2r^2)\) where r represents the neighborhood radius at index t

      Specified by:
      getNeighborhoodValue in class KohonenSOMTrainer
      Parameters:
      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.
      Returns:
      A double scalar containing the computed neighborhood function value.
    • getLearningCoefficient

      public double getLearningCoefficient(int t)
      Description copied from class: KohonenSOMTrainer
      Returns the learning coefficient. The monotonically decreasing learning coefficient function \(\alpha \left( t \right)\) is a scalar factor that defines the size of the update correction. The value of \(\alpha \left( t \right)\) decreases with the step index 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

      Specified by:
      getLearningCoefficient in class KohonenSOMTrainer
      Parameters:
      t - An int scalar containing the current iteration of the training.
      Returns:
      A double scalar containing the computed learning coefficient.
    • main

      public static void main(String[] args)