public class BernoulliVertex extends BoolVertex implements ProbabilisticBoolean
ID_GENERATOR
Constructor and Description |
---|
BernoulliVertex(double probTrue) |
BernoulliVertex(int[] shape,
double probTrue) |
BernoulliVertex(int[] shape,
Vertex<DoubleTensor> probTrue)
One probTrue that must match a proposed tensor shape of Bernoulli.
|
BernoulliVertex(Vertex<DoubleTensor> probTrue)
One to one constructor for mapping some shape of probTrue to
a matching shaped Bernoulli.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.Long,DoubleTensor> |
dLogProb(BooleanTensor value)
The partial derivatives of the natural log prob.
|
Vertex<DoubleTensor> |
getProbTrue() |
double |
logProb(BooleanTensor value)
This is the natural log of the probability at the supplied value.
|
BooleanTensor |
sample(KeanuRandom random) |
and, equalTo, getValue, not, notEqualTo, observe, observe, or, setAndCascade, setAndCascade, setValue, setValue, slice, take
addChild, addParent, addParents, equals, eval, getChildren, getConnectedGraph, getId, getLabel, getObservedValue, getParents, getRawValue, getShape, getValue, hashCode, hasValue, isObserved, isProbabilistic, lazyEval, observe, observeOwnValue, sample, setAndCascade, setLabel, setParents, setParents, setValue, unobserve
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
dLogPmf, dLogPmf, dLogPmf, logPmf, logPmf, logPmf
dLogProbAtValue, getValue, keepOnlyProbabilisticVertices, logProbAtValue, setValue
getObservedValue, isObserved, observableTypeFor, observe, unobserve
public BernoulliVertex(int[] shape, Vertex<DoubleTensor> 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(Vertex<DoubleTensor> probTrue)
probTrue
- probTrue with same shape as desired Bernoulli tensor or scalarpublic BernoulliVertex(double probTrue)
public BernoulliVertex(int[] shape, double probTrue)
public Vertex<DoubleTensor> getProbTrue()
public double logProb(BooleanTensor value)
Probabilistic
logProb
in interface Probabilistic<BooleanTensor>
value
- The supplied value.public java.util.Map<java.lang.Long,DoubleTensor> dLogProb(BooleanTensor value)
Probabilistic
dLogProb
in interface Probabilistic<BooleanTensor>
value
- at a given valuepublic BooleanTensor sample(KeanuRandom random)
sample
in class Vertex<BooleanTensor>
random
- source of randomness