edu.stanford.nlp.classify
Class ClassProbability

java.lang.Object
  |
  +--edu.stanford.nlp.classify.ClassProbability

public class ClassProbability
extends Object

This class holds the counts and probabilities for the features of a single class (classification category).


Constructor Summary
ClassProbability(int id)
          A constructor that creates an empty ClassProbability of category id.
ClassProbability(int id, HashMap my_probs)
          A constructor that creates a new ClassProbability of category id with the counts from my_probs.
 
Method Summary
 int getClassID()
          Returns the class_id (classification category).
 double getCount(Feature key)
          Returns the count of the Feature key.
 Set getKeys()
          Returns the set of keys in this ClassProbability.
 double getPrior()
          Returns the prior probability of this class.
 double getProb(Feature key)
          Returns the probability of the Feature key.
 int getSize()
          Returns the number of keys in this ClassProbability.
 boolean hasProb(Feature key)
          Returns true if this key has a probability represented in this class, and false otherwise.
 void setCount(Feature key, double count)
          Sets the count of the Feature "key" to "count"
 void setPrior(double pri)
          Sets the prior probability of this class to "pri".
 void setProb(Feature key, double prob)
          Sets the probability of the Feature "key" to "prob"
 void setSize(int new_size)
          Sets the number of keys in this ClassProbability.
 FeatureSet toFeatureSet()
          This method converts this ClassProbability to a FeatureSet, which is used for CrossValidation.
 String toString()
          When you print this Classification probability using System&.out&.println, it simply prints the id and the prior.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassProbability

public ClassProbability(int id)
A constructor that creates an empty ClassProbability of category id.


ClassProbability

public ClassProbability(int id,
                        HashMap my_probs)
A constructor that creates a new ClassProbability of category id with the counts from my_probs.

Method Detail

getPrior

public double getPrior()
Returns the prior probability of this class.


setPrior

public void setPrior(double pri)
Sets the prior probability of this class to "pri".


getProb

public double getProb(Feature key)
Returns the probability of the Feature key.


getCount

public double getCount(Feature key)
Returns the count of the Feature key.


hasProb

public boolean hasProb(Feature key)
Returns true if this key has a probability represented in this class, and false otherwise.


setProb

public void setProb(Feature key,
                    double prob)
Sets the probability of the Feature "key" to "prob"


setCount

public void setCount(Feature key,
                     double count)
Sets the count of the Feature "key" to "count"


getKeys

public Set getKeys()
Returns the set of keys in this ClassProbability.


getClassID

public int getClassID()
Returns the class_id (classification category).


getSize

public int getSize()
Returns the number of keys in this ClassProbability.


setSize

public void setSize(int new_size)
Sets the number of keys in this ClassProbability.


toString

public String toString()
When you print this Classification probability using System&.out&.println, it simply prints the id and the prior.

Overrides:
toString in class Object

toFeatureSet

public FeatureSet toFeatureSet()
This method converts this ClassProbability to a FeatureSet, which is used for CrossValidation.



Stanford NLP Group