public class BernoulliVertex extends BooleanVertex implements ProbabilisticBoolean, SamplableWithManyScalars<BooleanTensor>, LogProbGraphSupplier
Constructor and Description |
---|
BernoulliVertex(double probTrue) |
BernoulliVertex(DoubleVertex probTrue)
One to one constructor for mapping some shape of probTrue to
a matching shaped Bernoulli.
|
BernoulliVertex(long[] shape,
double probTrue) |
BernoulliVertex(long[] shape,
DoubleVertex probTrue)
One probTrue that must match a proposed tensor shape of Bernoulli.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<Vertex,DoubleTensor> |
dLogProb(BooleanTensor value,
java.util.Set<? extends Vertex> withRespectTo)
The partial derivatives of the natural log prob.
|
DoubleVertex |
getProbTrue() |
double |
logProb(BooleanTensor value)
This is the natural log of the probability at the supplied value.
|
LogProbGraph |
logProbGraph() |
BooleanTensor |
sampleWithShape(long[] shape,
KeanuRandom random) |
and, and, and, assertTrue, assertTrue, concat, equalTo, getValue, loadValue, not, not, notEqualTo, observe, observe, or, or, or, reshape, saveValue, setAndCascade, setAndCascade, setValue, setValue, slice, take
addChild, addParent, addParents, equals, eval, getChildren, getConnectedGraph, getDegree, getId, getIndentation, getLabel, getObservedValue, getParents, getRank, getReference, getShape, getState, getValue, hashCode, hasValue, isDifferentiable, isObserved, isProbabilistic, lazyEval, observe, observeOwnValue, print, print, removeLabel, save, setAndCascade, setLabel, setLabel, setParents, setParents, setState, setValue, toString, unobserve
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
dLogPmf, dLogPmf, dLogPmf, logPmf, logPmf, logPmf
dLogProb, dLogProbAtValue, dLogProbAtValue, getValue, keepOnlyProbabilisticVertices, logProbAtValue
getObservedValue, isObserved, observe, unobserve
sample, sampleManyScalars, sampleManyScalars
sampleWithShape
public BernoulliVertex(long[] shape, DoubleVertex probTrue)
If all provided parameters are scalar then the proposed shape determines the shape
shape
- the desired shape of the vertexprobTrue
- the probability the bernoulli returns truepublic BernoulliVertex(DoubleVertex probTrue)
probTrue
- probTrue with same shape as desired Bernoulli tensor or scalarpublic BernoulliVertex(double probTrue)
public BernoulliVertex(long[] shape, double probTrue)
public DoubleVertex getProbTrue()
public double logProb(BooleanTensor value)
Probabilistic
logProb
in interface Probabilistic<BooleanTensor>
value
- The supplied value.public LogProbGraph logProbGraph()
logProbGraph
in interface LogProbGraphSupplier
public java.util.Map<Vertex,DoubleTensor> dLogProb(BooleanTensor value, java.util.Set<? extends Vertex> withRespectTo)
Probabilistic
dLogProb
in interface Probabilistic<BooleanTensor>
value
- at a given valuewithRespectTo
- list of parents to differentiate with respect topublic BooleanTensor sampleWithShape(long[] shape, KeanuRandom random)
sampleWithShape
in interface SamplableWithShape<BooleanTensor>