Package com.imsl.test.example.datamining
Class KohonenSOMEx1
java.lang.Object
com.imsl.datamining.KohonenSOMTrainer
com.imsl.test.example.datamining.KohonenSOMEx1
- All Implemented Interfaces:
Serializable
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:
After the training, the image is:
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetLearningCoefficient(int t) Returns the learning coefficient.doublegetNeighborhoodValue(int t, double d) Returns the neighborhood function value.static voidMethods inherited from class com.imsl.datamining.KohonenSOMTrainer
getIterations, getNumberOfThreads, setIterations, setNumberOfThreads, train
-
Constructor Details
-
KohonenSOMEx1
public KohonenSOMEx1()
-
-
Method Details
-
getNeighborhoodValue
public double getNeighborhoodValue(int t, double d) Description copied from class:KohonenSOMTrainerReturns 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:
getNeighborhoodValuein classKohonenSOMTrainer- Parameters:
t- Anintscalar containing the current iteration of the training.d- Adoublescalar containing the lattice distance between the best matching node and the current node.- Returns:
- A
doublescalar containing the computed neighborhood function value.
-
getLearningCoefficient
public double getLearningCoefficient(int t) Description copied from class:KohonenSOMTrainerReturns 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 indext. 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 coefficientinverse time:
$$\alpha \left( t \right) = \frac{A}{t+B}$$where A and B are user determined constants
- Specified by:
getLearningCoefficientin classKohonenSOMTrainer- Parameters:
t- Anintscalar containing the current iteration of the training.- Returns:
- A
doublescalar containing the computed learning coefficient.
-
main
-