Package cc.mallet.classify
Class RandomClassifier
- java.lang.Object
-
- cc.mallet.classify.Classifier
-
- cc.mallet.classify.RandomClassifier
-
- All Implemented Interfaces:
AlphabetCarrying
,java.io.Serializable
public class RandomClassifier extends Classifier
A Classifier that will return a randomly selected class label. The Classifier needs to be trained using the RandomAssignmentTrainer. Note that the frequency distribution gives more weight to class labels with a higher frequency in the training data. To create a Classifier which gives equal weight to each class, simply use a Set- Author:
- Martin Wunderlich martin@wunderlich.com
- See Also:
RandomAssignmentTrainer
, Serialized Form
-
-
Field Summary
-
Fields inherited from class cc.mallet.classify.Classifier
instancePipe
-
-
Constructor Summary
Constructors Constructor Description RandomClassifier(Pipe instancePipe)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTargetLabel(Label label)
Classification
classify(Instance instance)
Classify an instance using random selection based on the trained data.-
Methods inherited from class cc.mallet.classify.Classifier
alphabetsMatch, classify, classify, classify, getAccuracy, getAlphabet, getAlphabets, getAverageRank, getF1, getF1, getF1, getFeatureSelection, getInstancePipe, getLabelAlphabet, getPerClassFeatureSelection, getPrecision, getPrecision, getPrecision, getRecall, getRecall, getRecall, print, print
-
-
-
-
Constructor Detail
-
RandomClassifier
public RandomClassifier(Pipe instancePipe)
-
-
Method Detail
-
classify
public Classification classify(Instance instance)
Classify an instance using random selection based on the trained data.- Specified by:
classify
in classClassifier
- Parameters:
Instance
- to be classified. Data field must be a FeatureVector.- Returns:
- Classification containing the labeling of the instance.
-
addTargetLabel
public void addTargetLabel(Label label)
-
-