org.apache.mahout.clustering
Class VectorModelClassifier
java.lang.Object
org.apache.mahout.classifier.AbstractVectorClassifier
org.apache.mahout.clustering.VectorModelClassifier
public class VectorModelClassifier
- extends AbstractVectorClassifier
This classifier works with any of the clustering Models. It is initialized with
a list of compatible Models and thereafter it can classify any new Vector into
one or more of the Models based upon the pdf() function which each Model supports.
Method Summary |
Vector |
classify(Vector instance)
Classify a vector returning a vector of numCategories-1 scores. |
double |
classifyScalar(Vector instance)
Classifies a vector in the special case of a binary classifier where
classify(Vector) would return a vector with only one element. |
int |
numCategories()
Returns the number of categories for the target variable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VectorModelClassifier
public VectorModelClassifier(java.util.List<Model<VectorWritable>> models)
classify
public Vector classify(Vector instance)
- Description copied from class:
AbstractVectorClassifier
- Classify a vector returning a vector of numCategories-1 scores. It is assumed that
the score for the missing category is one minus the sum of the scores that are returned.
Note that the missing score is the 0-th score.
- Specified by:
classify
in class AbstractVectorClassifier
- Parameters:
instance
- A feature vector to be classified.
- Returns:
- A vector of probabilities in 1 of n-1 encoding.
classifyScalar
public double classifyScalar(Vector instance)
- Description copied from class:
AbstractVectorClassifier
- Classifies a vector in the special case of a binary classifier where
classify(Vector)
would return a vector with only one element. As such,
using this method can void the allocation of a vector.
- Specified by:
classifyScalar
in class AbstractVectorClassifier
- Parameters:
instance
- The feature vector to be classified.
- Returns:
- The score for category 1.
- See Also:
AbstractVectorClassifier.classify(Vector)
numCategories
public int numCategories()
- Description copied from class:
AbstractVectorClassifier
- Returns the number of categories for the target variable. A vector classifier
will encode it's output using a zero-based 1 of numCategories encoding.
- Specified by:
numCategories
in class AbstractVectorClassifier
- Returns:
- The number of categories.
Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.