public class ProbDist
extends java.lang.Object
Constructor and Description |
---|
ProbDist(java.util.HashMap<State,java.lang.Double> dist_in,
boolean lock)
Constructs a probability distribution with initial values and lock.
|
ProbDist(int numStates)
Constructs the empty probability distribution.
|
ProbDist(State[] sts_in,
double[] pmf_in)
Constructs a probability distribution with initial values.
|
ProbDist(State[] sts_in,
double[] pmf_in,
boolean lock)
Constructs a probability distribution with initial values and lock.
|
ProbDist(java.lang.String[] stateNames,
double[] pmf)
Returns the probability distribution on a given array of states
with a given probability mass function.
|
ProbDist(java.lang.String[] stateNames,
double[] pmf,
boolean lock)
Returns the probability distribution on a given array of states
with a given probability mass function.
|
Modifier and Type | Method and Description |
---|---|
void |
checkWellDefined(double error)
Print whether the probability distribution is well-defined or not.
|
boolean |
consistentChannelsAndPrior(int numChannels)
Check whether the number of channels matches with
the size of the (prior) input distribution.
|
static double[] |
cumulativeProbArray(double[] pmf)
Returns the array of the cumulative distribution of a given array of PMF.
|
ProbDist |
cumulativeProbDist()
Returns the cumulative probability distribution of this distribution.
|
ProbDist[] |
getAllMarginals()
Returns all the marginals of this probability distribution.
|
ProbDist |
getMarginal(int num)
Returns a marginal probability distribution.
|
int |
getNumJoint()
Returns the number of elements in a joint input.
|
double[] |
getPMFArray()
Returns the array of the probabilities of this probability distribution.
|
java.util.Collection<java.lang.Double> |
getPMFCollection()
Returns the collection of the probabilities of this probability distribution.
|
double |
getProb(State st)
Returns the probability of the state in the probability distribution.
|
double |
getProb(java.lang.String str)
Returns the probability of the state in the probability distribution.
|
java.lang.String |
getProjectedState(State jst,
int numElements)
Returns the string that denotes a projection of a given joint state.
|
State[] |
getStatesArray()
Returns the array of the states of this probability distribution.
|
java.util.Collection<State> |
getStatesCollection()
Returns the collection of the states of this probability distribution.
|
boolean |
isJointlySupported()
Check whether this probabiltiy distribution is jointly supported,
i.e., p(x_1, ...
|
boolean |
isWellDefined(double error)
Decides whether the probability distribution is well-defined or not.
|
void |
printProb(State st)
Print the probability of a state.
|
void |
printProbDist()
Print the probability distribution.
|
void |
printProbDist(java.io.File file)
Output the probability distribution to a file.
|
double[] |
probDistToPMFArray(java.lang.String[] inputNames)
Returns the array of a given probability distribution
that is sorted in the order of a given array inputNames.
|
State[] |
probDistToStatesArray(java.lang.String[] inputNames)
Returns the array of the states in a given probability distribution
that is sorted in the order of a given array inputNames.
|
void |
removeProb(State st)
Removes a state from the probability distribution.
|
ProbDist |
sharedProbDist(int numJoint,
boolean lock)
Returns the joint distribution of a shared input.
|
int |
sizeSampleSpace()
Returns the size of the sample space.
|
static double[] |
uniformProbArray(int noOfInputs)
Returns the array of the uniform probabilities.
|
static ProbDist |
uniformProbDist(java.lang.String[] stateNames,
boolean lock)
Returns the uniform probability distribution on
a given array of states.
|
void |
updateProb(State st,
double prob)
Updates the probability distribution as to the probability of a state.
|
public ProbDist(java.util.HashMap<State,java.lang.Double> dist_in, boolean lock)
dist_in
- a hash map that represents a probability distributionlock
- forbids overwriting the probability distributionpublic ProbDist(int numStates)
numStates
- the number of statespublic ProbDist(State[] sts_in, double[] pmf_in)
sts_in
- array of statespmf_in
- array of PMFpublic ProbDist(State[] sts_in, double[] pmf_in, boolean lock)
sts_in
- array of statespmf_in
- array of PMFlock
- forbids overwriting the probability distributionpublic ProbDist(java.lang.String[] stateNames, double[] pmf)
stateNames
- array of strings of state namespmf
- array of PMFpublic ProbDist(java.lang.String[] stateNames, double[] pmf, boolean lock)
stateNames
- array of strings of state namespmf
- array of PMFlock
- forbids overwriting the probability distributionpublic void checkWellDefined(double error)
error
- acceptable error rate for the calculation of probability distributionpublic boolean consistentChannelsAndPrior(int numChannels)
numChannels
- the number of channelspublic static double[] cumulativeProbArray(double[] pmf)
pmf
- array of PMFpublic ProbDist cumulativeProbDist()
pd
- probability distributionpublic ProbDist[] getAllMarginals()
public ProbDist getMarginal(int num)
num
- the number s.t. X_num is the input domain
on which we take marginal distributionpublic int getNumJoint()
public double[] getPMFArray()
public java.util.Collection<java.lang.Double> getPMFCollection()
public double getProb(State st)
st
- statepublic double getProb(java.lang.String str)
str
- string that represents a statepublic java.lang.String getProjectedState(State jst, int numElements)
jst
- joint statenumElements
- the number of elements that a state consists ofpublic State[] getStatesArray()
public java.util.Collection<State> getStatesCollection()
public boolean isJointlySupported()
public boolean isWellDefined(double error)
error
- acceptable error rate for the calculation of probability distributionpublic void printProb(State st)
st
- statepublic void printProbDist()
public void printProbDist(java.io.File file)
public double[] probDistToPMFArray(java.lang.String[] inputNames)
inputNames
- array of the input action labelspublic State[] probDistToStatesArray(java.lang.String[] inputNames)
inputNames
- array of the input action labelspublic void removeProb(State st)
st
- statepublic ProbDist sharedProbDist(int numJoint, boolean lock)
numJoint
- the number of elements in a joint inputlock
- forbids overwriting the probability distributionpublic int sizeSampleSpace()
public static double[] uniformProbArray(int noOfInputs)
noOfInputs
- the size of uniform distributionpublic static ProbDist uniformProbDist(java.lang.String[] stateNames, boolean lock)
stateNames
- array of strings of state nameslock
- forbids overwriting the probability distributionpublic void updateProb(State st, double prob)
st
- stateprob
- probability