|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mahout.classifier.AbstractVectorClassifier
public abstract class AbstractVectorClassifier
Defines the interface for classifiers that take input as a vector. This is implemented as an abstract class so that it can implement a number of handy convenience methods related to classification of vectors.
| Constructor Summary | |
|---|---|
AbstractVectorClassifier()
|
|
| Method Summary | |
|---|---|
Matrix |
classify(Matrix data)
Returns n-1 probabilities, one for each category but the last, for each row of a matrix. |
abstract Vector |
classify(Vector instance)
Classify a vector returning a vector of numCategories-1 scores. |
Matrix |
classifyFull(Matrix data)
Returns n probabilities, one for each category, for each row of a matrix. |
Vector |
classifyFull(Vector instance)
Returns n probabilities, one for each category. |
Vector |
classifyFull(Vector r,
Vector instance)
Returns n probabilities, one for each category into a pre-allocated vector. |
Vector |
classifyNoLink(Vector features)
Classify a vector, but don't apply the inverse link function. |
Vector |
classifyScalar(Matrix data)
Returns a vector of probabilities of the first category, one for each row of a matrix. |
abstract 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. |
double |
logLikelihood(int actual,
Vector data)
Returns a measure of how good the classification for a particular example actually is. |
abstract 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 |
| Constructor Detail |
|---|
public AbstractVectorClassifier()
| Method Detail |
|---|
public abstract int numCategories()
public abstract Vector classify(Vector instance)
instance - A feature vector to be classified.
public Vector classifyNoLink(Vector features)
features - A feature vector to be classified.
public abstract double classifyScalar(Vector instance)
classify(Vector) would return a vector with only one element. As such,
using this method can void the allocation of a vector.
instance - The feature vector to be classified.
classify(Vector)public Vector classifyFull(Vector instance)
instance - A vector of features to be classified.
classify(Vector),
classifyFull(Vector r, Vector instance)
public Vector classifyFull(Vector r,
Vector instance)
r - Where to put the results.instance - A vector of features to be classified.
public Matrix classify(Matrix data)
data - The matrix whose rows are vectors to classify
public Matrix classifyFull(Matrix data)
data - The matrix whose rows are vectors to classify
public Vector classifyScalar(Matrix data)
data - The matrix whose rows are vectors to classify
public double logLikelihood(int actual,
Vector data)
actual - The correct category for the example.data - The vector to be classified.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||