protected static class NaiveBayes.Count extends Object implements Cloneable, Serializable
Count
object stores two doubles
, one which holds a accumulated
count value and the other intended to hold the natural logarithm of the count. The object
also contains a boolean
flag that is set when the log needs to be updated.Modifier and Type | Field and Description |
---|---|
protected double |
count
The accumulated value.
|
protected double |
logCount
The natural logartihm of
count is sometimes stored here. |
protected boolean |
updateLog
A flag that is set iff
logCount is not up to date. |
Constructor and Description |
---|
Count()
Sets the count to 0.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
This method returns a shallow clone.
|
double |
getCount()
Returns the integer count.
|
double |
getLog()
Returns the log after updating it.
|
void |
increment(double inc)
Increments the count, but does not update the log.
|
void |
read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
Reads the binary representation of a count into this object, overwriting any data that
may already be here.
|
String |
toString()
The string representation of a
Count object is simply the integer count. |
void |
write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
Writes the count's internal representation in binary form.
|
protected double count
protected transient double logCount
count
is sometimes stored here.protected transient boolean updateLog
logCount
is not up to date.public double getCount()
public void increment(double inc)
inc
- The amount the count should be incremented by.public double getLog()
public String toString()
Count
object is simply the integer count.public void write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
out
- The output stream.public void read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
in
- The input stream.Copyright © 2016. All rights reserved.