public class CategoricalResults extends Object implements Cloneable, Serializable
Constructor and Description |
---|
CategoricalResults(double[] probabilities)
Creates a new Categorical Result using the given array.
|
CategoricalResults(int numCategories)
Create a new Categorical Results, values will default to all zero.
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
clone()
Creates a deep clone of this
|
void |
divideConst(double c)
Divides all the probabilities by a constant value in order to scale them
|
double |
getProb(int cat)
Returns the stored probability for the given category
|
Vec |
getVecView() |
void |
incProb(int cat,
double prob)
Increments the stored probability that a sample belongs to a given category
|
int |
mostLikely()
Returns the category that is the most likely according to the current probability values
|
void |
normalize()
Adjusts the probabilities by dividing each value by the total sum, so
that all values are in the range [0, 1]
|
void |
setProb(int cat,
double prob)
Sets the probability that a sample belongs to a given category.
|
int |
size()
Returns the number of classes that are in the result.
|
String |
toString() |
public CategoricalResults(int numCategories)
numCategories
- the number of options to support.public CategoricalResults(double[] probabilities)
probabilities
- the array of probabilities for each outcomepublic int size()
public void setProb(int cat, double prob)
cat
- the categoryprob
- the value to set, may be greater then one.IndexOutOfBoundsException
- if a non existent category is specifiedArithmeticException
- if the value set is negative or not a numberpublic void incProb(int cat, double prob)
cat
- the categoryprob
- the value to increment by, may be greater then one.IndexOutOfBoundsException
- if a non existent category is specifiedArithmeticException
- if the value set is negative or not a numberpublic int mostLikely()
public void divideConst(double c)
c
- the constant to divide all probabilities bypublic void normalize()
public Vec getVecView()
public double getProb(int cat)
cat
- the categorypublic CategoricalResults clone()
Copyright © 2017. All rights reserved.