struct.classification
Class ClassificationPredictor

java.lang.Object
  extended by struct.alg.Predictor
      extended by struct.classification.ClassificationPredictor
All Implemented Interfaces:
java.io.Serializable

public class ClassificationPredictor
extends Predictor

The predictor for classification.

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

Field Summary
private static java.util.logging.Logger logger
           
private static long serialVersionUID
           
 
Fields inherited from class struct.alg.Predictor
avg_weights, weights
 
Constructor Summary
protected ClassificationPredictor(int dimensions)
           
 
Method Summary
 Prediction decode(SLInstance inst, Features feats)
          Evaluates the prediction for the Features
 ClassificationPrediction decode(SLInstance inst, Features feats, int K)
          Evaluates the prediction for the Features
private  ClassificationPrediction getTopKLabels(Features sf, int K)
           
 void grow(int newSize)
          Increases the size of the predictor's weights to make the predictor ready for training with additional features.
protected  void loadModel(java.lang.String file)
          Loads the model from the file.
protected  void saveModel(java.lang.String file)
          Saves the model in the file
private  void sort(int[] indices, double[] scores)
           
 
Methods inherited from class struct.alg.Predictor
averageWeights, score
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static java.util.logging.Logger logger

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

ClassificationPredictor

protected ClassificationPredictor(int dimensions)
Parameters:
dimensions - - the total number of features.
Method Detail

decode

public Prediction decode(SLInstance inst,
                         Features feats)
Evaluates the prediction for the Features

Specified by:
decode in class Predictor

decode

public ClassificationPrediction decode(SLInstance inst,
                                       Features feats,
                                       int K)
Evaluates the prediction for the Features

Specified by:
decode in class Predictor

getTopKLabels

private ClassificationPrediction getTopKLabels(Features sf,
                                               int K)

sort

private void sort(int[] indices,
                  double[] scores)

grow

public void grow(int newSize)
Increases the size of the predictor's weights to make the predictor ready for training with additional features.

Specified by:
grow in class Predictor
Parameters:
newSize - - the new number of features

saveModel

protected void saveModel(java.lang.String file)
                  throws java.lang.Exception
Saves the model in the file

Throws:
java.lang.Exception

loadModel

protected void loadModel(java.lang.String file)
                  throws java.lang.Exception
Loads the model from the file.

Throws:
java.lang.Exception


Copyright (C) 2006 University of Pennsylvania.