jsat.classifiers.neuralnetwork
Class LVQLLC
- java.lang.Object
-
- jsat.classifiers.neuralnetwork.LVQ
-
- jsat.classifiers.neuralnetwork.LVQLLC
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
public class LVQLLC extends LVQ
LVQ with Locally Learned Classifier (LVQ-LLC) is an adaption of the LVQ algorithm I have come up with. Given a classification data set, LVQ develops and moves several prototype vectors throughout the space, trying to place them as good representatives. Classification is then done Nearest Neighbor style among the prototypes.
LVQ-LLC trains a local classifier on all of the data points that belong to the prototype, and the data points that lie across the border but are still near the prototype using theLVQ.getEpsilonDistance()parameter that is used to update two prototypes at the same time. Classification can then be done by getting the Classifier for the nearest prototype, or averaging the results of the two closest prototypes if the point is near a boundary.
This is done because, given a complex decision boundary and a sufficient number of prototypes, each prototype's domain will be a smaller subset of the problem and will hopefully resemble a simpler decision problem that can be solved by a less complicated local learner.
LVQ-LLC has the following advantages over LVQ:- Can return probabilities instead of hard classifications
- Approximate decision boundaries can be more complicated than voronoi diagrams
- Increase accuracy given a smaller number of prototypes per class
By default, the local classifier is theMultivariateNormals.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsat.classifiers.neuralnetwork.LVQ
LVQ.LVQVersion
-
-
Field Summary
-
Fields inherited from class jsat.classifiers.neuralnetwork.LVQ
DEFAULT_EPS, DEFAULT_ITERATIONS, DEFAULT_LEARNING_RATE, DEFAULT_LVQ_METHOD, DEFAULT_MSCALE, DEFAULT_REPS_PER_CLASS, DEFAULT_SEED_SELECTION, DEFAULT_STOPPING_DIST
-
-
Constructor Summary
Constructors Constructor and Description LVQLLC(DistanceMetric dm, int iterations)Creates a new LVQ-LLC instance that usesMultivariateNormalsas the local classifier.LVQLLC(DistanceMetric dm, int iterations, Classifier localClasifier)Creates a new LVQ-LLC instanceLVQLLC(DistanceMetric dm, int iterations, Classifier localClasifier, double learningRate, int representativesPerClass)Creates a new LVQ-LLC instanceLVQLLC(DistanceMetric dm, int iterations, Classifier localClasifier, double learningRate, int representativesPerClass, LVQ.LVQVersion lvqVersion, DecayRate learningDecay)Creates a new LVQ-LLC instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.LVQLLCclone()ClassifiergetLocalClassifier()Returns the classifier used for each prototypevoidsetLocalClassifier(Classifier localClassifier)Each prototype will create a classifier that is local to itself, and trained on the points that belong to the prototype and those near the border of the prototype.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.-
Methods inherited from class jsat.classifiers.neuralnetwork.LVQ
getDistanceMetric, getEpsilonDistance, getIterations, getLearningDecay, getLearningRate, getLVQMethod, getMScale, getRepresentativesPerClass, getSeedSelection, getStoppingDist, setDistanceMetric, setEpsilonDistance, setIterations, setLearningDecay, setLearningRate, setLVQMethod, setMScale, setRepresentativesPerClass, setSeedSelection, setStoppingDist, setVecCollection, supportsWeightedData
-
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
-
-
-
-
Constructor Detail
-
LVQLLC
public LVQLLC(DistanceMetric dm, int iterations)
Creates a new LVQ-LLC instance that usesMultivariateNormalsas the local classifier.- Parameters:
dm- the distance metric to useiterations- the number of iterations to perform
-
LVQLLC
public LVQLLC(DistanceMetric dm, int iterations, Classifier localClasifier)
Creates a new LVQ-LLC instance- Parameters:
dm- the distance metric to useiterations- the number of iterations to performlocalClasifier- the classifier to use as a local classifier for each prototype
-
LVQLLC
public LVQLLC(DistanceMetric dm, int iterations, Classifier localClasifier, double learningRate, int representativesPerClass)
Creates a new LVQ-LLC instance- Parameters:
dm- the distance metric to useiterations- the number of iterations to performlocalClasifier- the classifier to use as a local classifier for each prototypelearningRate- the learning rate to use when updatingrepresentativesPerClass- the number of representatives to create for each class
-
LVQLLC
public LVQLLC(DistanceMetric dm, int iterations, Classifier localClasifier, double learningRate, int representativesPerClass, LVQ.LVQVersion lvqVersion, DecayRate learningDecay)
Creates a new LVQ-LLC instance- Parameters:
dm- the distance metric to useiterations- the number of iterations to performlocalClasifier- the classifier to use as a local classifier for each prototypelearningRate- the learning rate to use when updatingrepresentativesPerClass- the number of representatives to create for each classlvqVersion- the version of LVQ to uselearningDecay- the amount of decay to apply to the learning rate
-
-
Method Detail
-
setLocalClassifier
public void setLocalClassifier(Classifier localClassifier)
Each prototype will create a classifier that is local to itself, and trained on the points that belong to the prototype and those near the border of the prototype. This sets the classifier that will be used- Parameters:
localClassifier- the local classifier to use for each prototype
-
getLocalClassifier
public Classifier getLocalClassifier()
Returns the classifier used for each prototype- Returns:
- the classifier used for each prototype
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- Overrides:
classifyin classLVQ- 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- Overrides:
trainin classLVQ- 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.
-
clone
public LVQLLC clone()
- Specified by:
clonein interfaceClassifier- Overrides:
clonein classLVQ
-
-
DataMelt 3.0 © DataMelt by jWork.ORG