types
Class LinearClassifier
java.lang.Object
types.LinearClassifier
public class LinearClassifier
- extends Object
A linear model for classification. It has the form h(x) = arg_max_y f(x,y).w
- Author:
- kuzman
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
w
public double[] w
yAlphabet
public Alphabet yAlphabet
xAlphabet
public Alphabet xAlphabet
LinearClassifier
public LinearClassifier(Alphabet xAlpha,
Alphabet yAlpha,
FeatureFunction fxy)
scores
public double[] scores(SparseVector x)
- computes the score of each label 'y' defined as f(x,y) . w
- Parameters:
x
-
- Returns:
- [f(x,0).w, f(x,1).w, ...]
label
public int label(SparseVector x)
- computes the classification according to this linear classifier.
arg_max_y f(x,y) . w
- Parameters:
x
-
- Returns:
- y that maximizes f(x,y) . w
writeObject
public void writeObject(ObjectOutputStream out)
throws IOException
- Throws:
IOException
readObject
public void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
- Throws:
IOException
ClassNotFoundException
Copyright © 2009. All Rights Reserved.