jsat.classifiers.neuralnetwork
Class SOM
- java.lang.Object
-
- jsat.classifiers.neuralnetwork.SOM
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
public class SOM extends java.lang.Object implements Classifier, Parameterized
An implementation of a Self Organizing Map, also called a Kohonen Map. It is linked to many other algorithms, and is an unsupervised learning algorithm that can perform classification.
The SOM is useful for visualizing data sets, though this is not yet implemented.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static KernelFunctionDEFAULT_KFstatic DecayRateDEFAULT_LEARNING_DECAYstatic doubleDEFAULT_LEARNING_RATEstatic intDEFAULT_MAX_ITERSstatic DecayRateDEFAULT_NEIGHBOR_DECAY
-
Constructor Summary
Constructors Constructor and Description SOM(DistanceMetric dm, int somHeight, int somWeight)Creates a new SOM using the given parametersSOM(DistanceMetric dm, int somHeight, int somWeight, VectorCollection<VecPaired<Vec,java.lang.Integer>> vcFactory)Creates a new SOM using the given parametersSOM(int somHeight, int somWeight)Creates a new SOM using the given parameters using theEuclideanDistance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.SOMclone()doublegetInitialLearningRate()Returns the rate at which input is incorporated at each iteration of the SOMDecayRategetLearningDecay()The rate the SOM learns decays over each iteration, and this defines the way in which the rate decays.intgetMaxIterations()Returns the maximum number of iterations that will be used to convergeDecayRategetNeighborDecay()The range of effect each data point has decays with each iteration, and this defines the way in which the rate decays.intgetSomHeight()Returns the height of the SOM lattice to createintgetSomWidth()Returns the width of the SOM lattice to createvoidsetInitialLearningRate(double initialLearningRate)Sets the rate at which input is incorporated at each iteration of the SOM algorithmvoidsetLearningDecay(DecayRate learningDecay)The rate the SOM learns decays over each iteration, and this defines the way in which the rate decays.voidsetMaxIterations(int maxIters)Sets the maximum number of iterations that will be used to convergevoidsetNeighborDecay(DecayRate neighborDecay)The range of effect each data point has decays with each iteration, and this defines the way in which the rate decays.voidsetSomHeight(int somHeight)Sets the height of the SOM lattice to createvoidsetSomWidth(int somWidth)Sets the width of the SOM lattice to createbooleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.classifiers.Classifier
train
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Field Detail
-
DEFAULT_MAX_ITERS
public static final int DEFAULT_MAX_ITERS
- See Also:
- Constant Field Values
-
DEFAULT_KF
public static final KernelFunction DEFAULT_KF
-
DEFAULT_LEARNING_RATE
public static final double DEFAULT_LEARNING_RATE
- See Also:
- Constant Field Values
-
DEFAULT_LEARNING_DECAY
public static final DecayRate DEFAULT_LEARNING_DECAY
-
DEFAULT_NEIGHBOR_DECAY
public static final DecayRate DEFAULT_NEIGHBOR_DECAY
-
-
Constructor Detail
-
SOM
public SOM(int somHeight, int somWeight)Creates a new SOM using the given parameters using theEuclideanDistance- Parameters:
somHeight- the height of the SOM latticesomWeight- the weight of the SOM lattice
-
SOM
public SOM(DistanceMetric dm, int somHeight, int somWeight)
Creates a new SOM using the given parameters- Parameters:
dm- the distance metric to use when comparing pointssomHeight- the height of the SOM latticesomWeight- the weight of the SOM lattice
-
SOM
public SOM(DistanceMetric dm, int somHeight, int somWeight, VectorCollection<VecPaired<Vec,java.lang.Integer>> vcFactory)
Creates a new SOM using the given parameters- Parameters:
dm- the distance metric to use when comparing pointssomHeight- the height of the SOM latticesomWeight- the weight of the SOM latticevcFactory- the vector collection to use for containing points
-
-
Method Detail
-
setMaxIterations
public void setMaxIterations(int maxIters)
Sets the maximum number of iterations that will be used to converge- Parameters:
maxIters- the max iterations of the algorithm
-
getMaxIterations
public int getMaxIterations()
Returns the maximum number of iterations that will be used to converge- Returns:
- the max iterations of the algorithm
-
setSomWidth
public void setSomWidth(int somWidth)
Sets the width of the SOM lattice to create- Parameters:
somWidth- the width of the lattice
-
setSomHeight
public void setSomHeight(int somHeight)
Sets the height of the SOM lattice to create- Parameters:
somHeight- the height of the lattice
-
getSomHeight
public int getSomHeight()
Returns the height of the SOM lattice to create- Returns:
- the height of the lattice
-
getSomWidth
public int getSomWidth()
Returns the width of the SOM lattice to create- Returns:
- the width of the lattice
-
setInitialLearningRate
public void setInitialLearningRate(double initialLearningRate)
Sets the rate at which input is incorporated at each iteration of the SOM algorithm- Parameters:
initialLearningRate- the rate the SOM learns at
-
getInitialLearningRate
public double getInitialLearningRate()
Returns the rate at which input is incorporated at each iteration of the SOM- Returns:
- the rate the SOM learns at
-
setLearningDecay
public void setLearningDecay(DecayRate learningDecay)
The rate the SOM learns decays over each iteration, and this defines the way in which the rate decays.- Parameters:
learningDecay- the decay for the learning rate
-
getLearningDecay
public DecayRate getLearningDecay()
The rate the SOM learns decays over each iteration, and this defines the way in which the rate decays.- Returns:
- the decay for the learning rate
-
setNeighborDecay
public void setNeighborDecay(DecayRate neighborDecay)
The range of effect each data point has decays with each iteration, and this defines the way in which the rate decays.- Parameters:
neighborDecay- the decay for the neighbor range.
-
getNeighborDecay
public DecayRate getNeighborDecay()
The range of effect each data point has decays with each iteration, and this defines the way in which the rate decays.- Returns:
- the decay for the neighbor range.
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- Parameters:
data- the data point to classify- Returns:
- the results of the classification.
-
train
public void train(ClassificationDataSet dataSet, boolean parallel)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.- Specified by:
trainin interfaceClassifier- Parameters:
dataSet- the data set to train onparallel-trueif multiple threads should be used to train the model.falseif it should be done in a single threaded manner.
-
supportsWeightedData
public boolean supportsWeightedData()
Description copied from interface:ClassifierIndicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.- Specified by:
supportsWeightedDatain interfaceClassifier- Returns:
- true if the model supports weighted data, false otherwise
-
clone
public SOM clone()
- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG