T
- the label (category) classpublic abstract class Probabilities<T> extends Object
Constructor and Description |
---|
Probabilities() |
Modifier and Type | Method and Description |
---|---|
void |
addIn(T t,
double probability,
int count)
Compounds the existing probability mass on the label with the new probability passed in to the method.
|
void |
discardCountsBelow(double i) |
Double |
get(T t)
Returns the probability associated with a label
|
Map<T,Double> |
getAll()
Returns the probabilities associated with all labels
|
double |
getConfidence()
Returns the best confidence with which this set of probabilities has been calculated.
|
Set<T> |
getKeys()
Returns the probabilities associated with all labels
|
Double |
getLog(T t)
Returns the log probability associated with a label
|
T |
getMax()
Returns the most likely label
|
double |
getMaxValue()
Returns the probability of the most likely label
|
void |
set(T t,
double probability)
Assigns a probability to a label, discarding any previously assigned probability.
|
void |
set(T t,
Probability<T> probability)
Assigns a probability to a label, discarding any previously assigned probability.
|
void |
setConfidence(double confidence)
Sets the best confidence with which this set of probabilities has been calculated.
|
void |
setIfLarger(T t,
double probability)
Assigns a probability to a label, discarding any previously assigned probability,
if the new probability is greater than the old one.
|
void |
setLog(T t,
double probability)
Assigns a log probability to a label, discarding any previously assigned probability.
|
String |
toString() |
public void set(T t, double probability)
t
- the label to which the probability is being assignedprobability
- the probability to assignpublic void set(T t, Probability<T> probability)
t
- the label to which the probability is being assignedprobability
- the probability to assignpublic void setIfLarger(T t, double probability)
t
- the label to which the probability is being assignedprobability
- the probability to assignpublic void setLog(T t, double probability)
t
- the label to which the log probability is being assignedprobability
- the log probability to assignpublic void addIn(T t, double probability, int count)
t
- the label whose probability mass is being updatedprobability
- the probability weight to addcount
- the amplifying factor for the probability compoundingpublic Double get(T t)
t
- the label whose probability needs to be returnedpublic Double getLog(T t)
t
- the label whose log probability needs to be returnedpublic Set<T> getKeys()
public Map<T,Double> getAll()
public T getMax()
public double getMaxValue()
public void discardCountsBelow(double i)
public double getConfidence()
public void setConfidence(double confidence)
confidence
- the confidence in the probabilitiesCopyright © 2017 The Apache Software Foundation. All rights reserved.