jhpro.nnet
Class KohonenFeatureMap
- java.lang.Object
-
- jhpro.nnet.KohonenFeatureMap
-
- All Implemented Interfaces:
- java.io.Serializable
public class KohonenFeatureMap extends java.lang.ObjectKohonenFeatureMap. Also called Selforganizing Map (SOM). A feedforward / feedback type neural net. Built of an input layer thats neurons are connected with each neuron of another layer, called "feature map". The feature map can be one- or two-dimensional and each of its neurons is connected to all other neurons on the map. Mainly used for classification.It is probably the most useful neural net type, if the learning process of the human brain shall be simulated. The "heart" of this type is the feature map, a neuron layer where neurons are organizing themselves according to certain input values. The type of this neural net is both feedforward (input layer to feature map) and feedback (feature map).
Number of neuron layers 1 input layer, 1 feature map Input dimension minimum: 1, maximum: 3 Number of neurons in feature map minimum: 1*1, maximum: N*M Number of input values minimum: 1, maximum: N Weight matrices Automatically created and initialized. One matrix connects input layer and feature map. The other matrix is not of the WeightMatrix type and connects the neurons of the feature map among themselves. Biases Not used One learning step includes Selection of a random input value, finding the most activated map neuron, changing of the weights - See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description KohonenFeatureMap()Declares the object kfm to be of type KohonenFeatureMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidconnectLayers(InputMatrix inputmatrix)Connects each input neuron (automatically created, depending on the dimension of the input matrix im) with each neuron of the feature map.voidcreateMapLayer(int i)Creates the net's feature map with xSize*ySize map neurons.voidcreateMapLayer(int i, int j)Creates the net's feature map with xSize*ySize map neurons.voiddecreaseActivationArea()booleandisplayNow()voiderror(int i)booleanfinishedLearning()doublegetActivationArea()java.lang.StringgetElapsedTime()Returns the time that elapsed since the learning process started.doublegetInitActivationArea()Returns the initial activation area of the feature map.doublegetInitLearningRate()Returns the initial learning rate of the net.InputValue[]getInputValues()intgetLearningCycle()Returns the current learning cycle of the net.doublegetLearningRate()Returns the current learning rate of the net.MapNeuron[]getMapNeurons()intgetMapSizeX()Returns the size of the feature map in x-dimension.intgetMapSizeY()Returns the size of the feature map in y-dimension.intgetMaxLearningCycles()intgetNumberOfWeights()Returns the number of weights in the weight matrix that connects the input neurons with the neurons of the feature map.doublegetStopArea()Returns the final activation area of the feature map.float[][]getWeightValues()Returns all weight values of the weight matrix that connects the input neurons with the neurons of the feature map.voidincLearningCycle()voidlearn()Performs one learning cycle.voidresetTime()voidsetActivationArea(double d)voidsetDisplayStep(int i)voidsetInitActivationArea(double d)Sets the net's initial activation area to x.voidsetInitLearningRate(double d)Set initial learning rate.voidsetLearningRate(double d)voidsetMaxLearningCycles(int i)Sets the maximum number of learning cycles to x.voidsetStopArea(double d)Sets the net's final activation area to x.doublesquare(double d)
-
-
-
Constructor Detail
-
KohonenFeatureMap
public KohonenFeatureMap()
Declares the object kfm to be of type KohonenFeatureMap.
-
-
Method Detail
-
createMapLayer
public void createMapLayer(int i)
Creates the net's feature map with xSize*ySize map neurons.- Parameters:
i-
-
createMapLayer
public void createMapLayer(int i, int j)Creates the net's feature map with xSize*ySize map neurons.- Parameters:
i-j-
-
connectLayers
public void connectLayers(InputMatrix inputmatrix)
Connects each input neuron (automatically created, depending on the dimension of the input matrix im) with each neuron of the feature map. Besides, all map neurons are connected among themselves. All weight matrices are created and initialized with random values, taken from the input matrix im.- Parameters:
inputmatrix-
-
setInitLearningRate
public void setInitLearningRate(double d)
Set initial learning rate. Sets the net's initial learning rate to x. The default value is 0.6.- Parameters:
d-
-
getInitLearningRate
public double getInitLearningRate()
Returns the initial learning rate of the net.- Returns:
-
setInitActivationArea
public void setInitActivationArea(double d)
Sets the net's initial activation area to x. The default value is the greater of both map sizes divided by 2.- Parameters:
d-
-
getInitActivationArea
public double getInitActivationArea()
Returns the initial activation area of the feature map.- Returns:
-
setActivationArea
public void setActivationArea(double d)
-
setStopArea
public void setStopArea(double d)
Sets the net's final activation area to x. The default value is initActivationArea divided by 10.- Parameters:
d-
-
getStopArea
public double getStopArea()
Returns the final activation area of the feature map.- Returns:
-
getActivationArea
public double getActivationArea()
-
getMapSizeX
public int getMapSizeX()
Returns the size of the feature map in x-dimension.- Returns:
-
getMapSizeY
public int getMapSizeY()
Returns the size of the feature map in y-dimension.- Returns:
-
getNumberOfWeights
public int getNumberOfWeights()
Returns the number of weights in the weight matrix that connects the input neurons with the neurons of the feature map.- Returns:
-
getWeightValues
public float[][] getWeightValues()
Returns all weight values of the weight matrix that connects the input neurons with the neurons of the feature map.- Returns:
-
getMapNeurons
public MapNeuron[] getMapNeurons()
-
getInputValues
public InputValue[] getInputValues()
-
decreaseActivationArea
public void decreaseActivationArea()
-
learn
public void learn()
Performs one learning cycle. This method is usually called within a loop, which exits, if the finishedLearning() method returns true.
-
finishedLearning
public boolean finishedLearning()
-
error
public void error(int i)
-
square
public double square(double d)
-
setLearningRate
public void setLearningRate(double d)
-
getLearningRate
public double getLearningRate()
Returns the current learning rate of the net.- Returns:
-
setDisplayStep
public void setDisplayStep(int i)
-
displayNow
public boolean displayNow()
-
resetTime
public void resetTime()
-
getElapsedTime
public java.lang.String getElapsedTime()
Returns the time that elapsed since the learning process started.- Returns:
-
setMaxLearningCycles
public void setMaxLearningCycles(int i)
Sets the maximum number of learning cycles to x. The default value is -1 (no maximum).- Parameters:
i-
-
getMaxLearningCycles
public int getMaxLearningCycles()
-
incLearningCycle
public void incLearningCycle()
-
getLearningCycle
public int getLearningCycle()
Returns the current learning cycle of the net.- Returns:
-
-
DMelt 3.0 © DataMelt by jWork.ORG