Class KohonenSOMTrainer

java.lang.Object
com.imsl.datamining.KohonenSOMTrainer
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
KohonenSOMEx1

public abstract class KohonenSOMTrainer extends Object implements Serializable
Trains a Kohonen network.

KohonenSOMTrainer is an abstract class with 2 abstract methods, getNeighborhoodValue and getLearningCoefficient. Therefore, a subclass of KohonenSOMTrainer needs to implement the getNeighborhoodValue and getLearningCoefficient methods.

See Also:
  • Constructor Details

    • KohonenSOMTrainer

      public KohonenSOMTrainer()
  • Method Details

    • getNeighborhoodValue

      public abstract double getNeighborhoodValue(int t, double d)
      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

      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 abstract double getLearningCoefficient(int t)
      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

      Parameters:
      t - An int scalar containing the current iteration of the training.
      Returns:
      A double scalar containing the computed learning coefficient.
    • setNumberOfThreads

      public void setNumberOfThreads(int numberOfThreads)
      Sets the number of java.lang.Thread instances to be used for parallel processing.
      Parameters:
      numberOfThreads - an int specifying the number of java.lang.Thread instances to be used for parallel processing.

      Default: numberOfThreads = 1.

    • getNumberOfThreads

      public int getNumberOfThreads()
      Returns the number of java.lang.Thread instances used for parallel processing.
      Returns:
      an int containing the number of java.lang.Thread instances used for parallel processing.
    • setIterations

      public void setIterations(int iterations)
      Sets the number of iterations to be used for training.
      Parameters:
      iterations - An int scalar containing the number of iterations to be used for training. iterations must be greater than zero.

      Default: iterations = 100.

    • getIterations

      public int getIterations()
      Returns the number of iterations used for training.
      Returns:
      An int scalar containing the number of iterations used for training.
    • train

      public final void train(KohonenSOM kohonen, double[][] data)
      Trains a Kohonen network.
      Parameters:
      kohonen - A KohonenSOM object to be trained.
      data - A double matrix containing the data to be used for training the Kohonen network. data[i].length must be equal to dim, the number of weights for each node, in kohonen.