public abstract class KohonenSOMTrainer extends Object implements Serializable
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.
Constructor and Description |
---|
KohonenSOMTrainer() |
Modifier and Type | Method and Description |
---|---|
int |
getIterations()
Returns the number of iterations used for training.
|
abstract double |
getLearningCoefficient(int t)
Returns the learning coefficient.
|
abstract double |
getNeighborhoodValue(int t,
double d)
Returns the neighborhood function value.
|
int |
getNumberOfThreads()
Returns the number of
java.lang.Thread instances used for
parallel processing. |
void |
setIterations(int iterations)
Sets the number of iterations to be used for training.
|
void |
setNumberOfThreads(int numberOfThreads)
Sets the number of
java.lang.Thread instances to be used for
parallel processing. |
void |
train(KohonenSOM kohonen,
double[][] data)
Trains a Kohonen network.
|
public abstract double getNeighborhoodValue(int t, double d)
\(h\left( {d,t} \right) = \exp(-d^2/2r^2)\) where r represents the neighborhood radius at index t
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 abstract double getLearningCoefficient(int t)
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
t
- An int
scalar containing the current iteration
of the training.double
scalar containing the computed learning
coefficient.public void setNumberOfThreads(int numberOfThreads)
java.lang.Thread
instances to be used for
parallel processing.numberOfThreads
- an int
specifying the number of
java.lang.Thread
instances to be used for parallel
processing.
Default: numberOfThreads
= 1.
public int getNumberOfThreads()
java.lang.Thread
instances used for
parallel processing.int
containing the number of
java.lang.Thread
instances used for parallel processing.public void setIterations(int iterations)
iterations
- An int
scalar containing the number of
iterations to be used for training.
iterations
must be greater than zero.
Default: iterations
= 100.
public int getIterations()
int
scalar containing the number of iterations
used for training.public final void train(KohonenSOM kohonen, double[][] data)
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
.Copyright © 2020 Rogue Wave Software. All rights reserved.