|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.AbstractCondProbDistrib blog.distrib.Bernoulli
public class Bernoulli
A distribution over Boolean values. It is defined by one
parameter, which is the probability of true
. This
parameter can be specified when the distribution is initialized, in
which case the distribution takes no arguments; or the distribution
can be initialized with no parameters, in which case it takes the
probability as an argument.
Constructor Summary | |
---|---|
Bernoulli(double pi)
Creates a new Bernoulli distribution with the probability of true set to pi. |
|
Bernoulli(java.util.List params)
Creates a new Bernoulli distribution. |
Method Summary | |
---|---|
double |
getLogProb(boolean value)
Returns the log probability of the given Boolean value under this distribution. |
double |
getProb(boolean value)
Returns the probability of the given Boolean value under this distribution. |
double |
getProb(java.util.List args,
java.lang.Object value)
For a discrete distribution, returns the conditional probability of childValue given the argument values args . |
boolean |
sampleVal()
Returns a boolean value sampled from this distribution. |
java.lang.Object |
sampleVal(java.util.List args,
Type childType)
Samples a value according to this CPD given the args
. |
Methods inherited from class blog.AbstractCondProbDistrib |
---|
getLogProb, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Bernoulli(double pi)
true
set to pi.
public Bernoulli(java.util.List params)
params
is empty, then the distribution takes one CPD argument, which is the
probability of true
. Otherwise, params
should contain one element, a Number specifying this probability.
Method Detail |
---|
public double getProb(boolean value)
ensureProbsInited
has just been called.
public double getProb(java.util.List args, java.lang.Object value)
CondProbDistrib
childValue
given the argument values args
.
For a continuous distribution, returns the conditional probability
density at childValue
.
public double getLogProb(boolean value)
ensureProbsInited
has just been called.
public boolean sampleVal()
ensureProbsInited
has just been called.
public java.lang.Object sampleVal(java.util.List args, Type childType)
CondProbDistrib
args
. The object returned should be of the specified type.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |