public class CategoricalVertex<CATEGORY,TENSOR extends Tensor<CATEGORY>> extends GenericTensorVertex<TENSOR> implements Probabilistic<TENSOR>, NonSaveableVertex
Constructor and Description |
---|
CategoricalVertex(long[] tensorShape,
java.util.Map<CATEGORY,DoubleVertex> selectableValues) |
CategoricalVertex(java.util.Map<CATEGORY,DoubleVertex> selectableValues) |
Modifier and Type | Method and Description |
---|---|
java.util.Map<Vertex,DoubleTensor> |
dLogProb(TENSOR value,
java.util.Set<? extends Vertex> withRespectTo)
The partial derivatives of the natural log prob.
|
java.util.Map<CATEGORY,DoubleVertex> |
getSelectableValues() |
double |
logProb(TENSOR value)
This is the natural log of the probability at the supplied value.
|
static CategoricalVertex<java.lang.Integer,IntegerTensor> |
of(DirichletVertex vertex) |
static <CATEGORY,TENSOR extends Tensor<CATEGORY>> |
of(DirichletVertex vertex,
java.util.List<CATEGORY> categories) |
static <CATEGORY,TENSOR extends Tensor<CATEGORY>> |
of(java.util.Map<CATEGORY,java.lang.Double> selectableValues) |
TENSOR |
sample(KeanuRandom random) |
addChild, addParent, addParents, equals, eval, getChildren, getConnectedGraph, getDegree, getId, getIndentation, getLabel, getObservedValue, getParents, getRank, getReference, getShape, getState, getValue, hashCode, hasValue, isDifferentiable, isObserved, isProbabilistic, lazyEval, loadValue, observe, observeOwnValue, print, print, removeLabel, save, saveValue, setAndCascade, setLabel, setLabel, setParents, setParents, setState, setValue, toString, unobserve
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
dLogProb, dLogProbAtValue, dLogProbAtValue, getValue, keepOnlyProbabilisticVertices, logProbAtValue
getObservedValue, isObserved, observe, unobserve
public CategoricalVertex(long[] tensorShape, java.util.Map<CATEGORY,DoubleVertex> selectableValues)
public CategoricalVertex(java.util.Map<CATEGORY,DoubleVertex> selectableValues)
public static <CATEGORY,TENSOR extends Tensor<CATEGORY>> CategoricalVertex<CATEGORY,TENSOR> of(java.util.Map<CATEGORY,java.lang.Double> selectableValues)
public static <CATEGORY,TENSOR extends Tensor<CATEGORY>> CategoricalVertex<CATEGORY,TENSOR> of(DirichletVertex vertex, java.util.List<CATEGORY> categories)
public static CategoricalVertex<java.lang.Integer,IntegerTensor> of(DirichletVertex vertex)
public java.util.Map<CATEGORY,DoubleVertex> getSelectableValues()
public TENSOR sample(KeanuRandom random)
public double logProb(TENSOR value)
Probabilistic
logProb
in interface Probabilistic<TENSOR extends Tensor<CATEGORY>>
value
- The supplied value.public java.util.Map<Vertex,DoubleTensor> dLogProb(TENSOR value, java.util.Set<? extends Vertex> withRespectTo)
Probabilistic
dLogProb
in interface Probabilistic<TENSOR extends Tensor<CATEGORY>>
value
- at a given valuewithRespectTo
- list of parents to differentiate with respect to