struct.classification
Class LinearClassifier

java.lang.Object
  extended by edu.umass.cs.mallet.base.classify.Classifier
      extended by struct.classification.LinearClassifier
All Implemented Interfaces:
java.io.Serializable

public class LinearClassifier
extends edu.umass.cs.mallet.base.classify.Classifier
implements java.io.Serializable

The Linear Classifier.

Version:
08/20/2006
See Also:
Serialized Form

Field Summary
private  edu.umass.cs.mallet.base.types.Alphabet phiAlphabet
           
private  Predictor predictor
           
private static long serialVersionUID
           
private  edu.umass.cs.mallet.base.types.LabelAlphabet tagAlphabet
           
 
Fields inherited from class edu.umass.cs.mallet.base.classify.Classifier
instancePipe
 
Constructor Summary
protected LinearClassifier()
           
protected LinearClassifier(edu.umass.cs.mallet.base.pipe.Pipe dataPipe)
           
 
Method Summary
 edu.umass.cs.mallet.base.classify.Classification classify(edu.umass.cs.mallet.base.types.Instance instance)
          Classifies the instance according to this classifier.
private  SLFeatureVector createFeatureVector(edu.umass.cs.mallet.base.types.FeatureVector featureVector, java.lang.String next, SLFeatureVector fv)
           
protected  void createPhiAlphabet(edu.umass.cs.mallet.base.types.InstanceList trainingSet)
          Adds features to the phiAlphabet.
private  void createU(edu.umass.cs.mallet.base.types.FeatureVector featureVector)
           
private  void getClassificationScores(edu.umass.cs.mallet.base.types.Instance instance, double[] scores)
           
private  ClassificationInstance getInstance(edu.umass.cs.mallet.base.types.Instance inst)
           
 edu.umass.cs.mallet.base.pipe.Pipe getPipe()
           
protected  Predictor getPredictor()
           
protected  void grow(edu.umass.cs.mallet.base.types.Alphabet tagAlphabet, edu.umass.cs.mallet.base.types.InstanceList trainingSet)
          Expands the classifier for training with new features.
private  void growPhiAlphabet(edu.umass.cs.mallet.base.types.InstanceList trainingSet)
           
private  void readObject(java.io.ObjectInputStream stream)
           
protected  void setInstanceAlphabets()
           
private  void writeObject(java.io.ObjectOutputStream stream)
           
 
Methods inherited from class edu.umass.cs.mallet.base.classify.Classifier
classify, classify, classify, getAccuracy, getAccuracy, getAlphabet, getF1, getF1, getF1, getF1, getInstancePipe, getLabelAlphabet, getPrecision, getPrecision, getPrecision, getPrecision, getRecall, getRecall, getRecall, getRecall, print, print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

predictor

private Predictor predictor

tagAlphabet

private edu.umass.cs.mallet.base.types.LabelAlphabet tagAlphabet

phiAlphabet

private edu.umass.cs.mallet.base.types.Alphabet phiAlphabet
Constructor Detail

LinearClassifier

protected LinearClassifier()

LinearClassifier

protected LinearClassifier(edu.umass.cs.mallet.base.pipe.Pipe dataPipe)
Method Detail

classify

public edu.umass.cs.mallet.base.classify.Classification classify(edu.umass.cs.mallet.base.types.Instance instance)
Classifies the instance according to this classifier.

Specified by:
classify in class edu.umass.cs.mallet.base.classify.Classifier

getClassificationScores

private void getClassificationScores(edu.umass.cs.mallet.base.types.Instance instance,
                                     double[] scores)

createPhiAlphabet

protected void createPhiAlphabet(edu.umass.cs.mallet.base.types.InstanceList trainingSet)
Adds features to the phiAlphabet.


createFeatureVector

private SLFeatureVector createFeatureVector(edu.umass.cs.mallet.base.types.FeatureVector featureVector,
                                            java.lang.String next,
                                            SLFeatureVector fv)

createU

private void createU(edu.umass.cs.mallet.base.types.FeatureVector featureVector)

setInstanceAlphabets

protected void setInstanceAlphabets()

getInstance

private ClassificationInstance getInstance(edu.umass.cs.mallet.base.types.Instance inst)

grow

protected void grow(edu.umass.cs.mallet.base.types.Alphabet tagAlphabet,
                    edu.umass.cs.mallet.base.types.InstanceList trainingSet)
Expands the classifier for training with new features.

Parameters:
tagAlphabet - - the expanded labelAlphabet
trainingSet - - the new training set

growPhiAlphabet

private void growPhiAlphabet(edu.umass.cs.mallet.base.types.InstanceList trainingSet)

getPredictor

protected Predictor getPredictor()

writeObject

private void writeObject(java.io.ObjectOutputStream stream)
                  throws java.io.IOException
Throws:
java.io.IOException

readObject

private void readObject(java.io.ObjectInputStream stream)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

getPipe

public edu.umass.cs.mallet.base.pipe.Pipe getPipe()


Copyright (C) 2006 University of Pennsylvania.