Class VertexAbstractFactor
- java.lang.Object
-
- ch.idsia.crema.factor.credal.vertex.separate.VertexAbstractFactor
-
- All Implemented Interfaces:
SeparatelySpecified<VertexFactor>
,VertexFactor
,FilterableFactor<VertexFactor>
,GenericFactor
,OperableFactor<VertexFactor>
- Direct Known Subclasses:
VertexDefaultFactor
,VertexFunctionFactor
public abstract class VertexAbstractFactor extends Object implements VertexFactor
A Separately specified Vertex based credal factor.- Author:
- david
-
-
Field Summary
Fields Modifier and Type Field Description static ConvexHull
CONVEX_HULL_MARG
protected Strides
separatedDomain
protected Strides
vertexDomain
-
Constructor Summary
Constructors Constructor Description VertexAbstractFactor(Strides vertexDomain, Strides separatedDomain)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
applyConvexHull(ConvexHull m)
protected <F extends VertexAbstractFactor>
Fcombine(VertexFactor other, ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder, ToDoubleBiFunction<Double,Double> multiply)
VertexAbstractFactor
divide(VertexFactor other)
protected <F extends VertexAbstractFactor>
Ffilter(int variable, int state, ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder)
static ConvexHull
getConvexHullMarg()
Strides
getDataDomain()
The domain of the rest of the domain.Strides
getDomain()
Strides
getSeparatingDomain()
The domain of the separated part.<F extends VertexAbstractFactor>
FgetSingleVertexFactor(ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder, int... idx)
SeparateIndexIterator
iterate()
Iterator over the two domains data and conditioningVertexAbstractFactor
marginalize(int variable)
Sum out a variable from the factor.protected <F extends VertexAbstractFactor>
Fmarginalize(ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder, int... vars)
sum/marginalize some variables out of the credal set.protected <F extends VertexAbstractFactor>
Fnormalize(ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder, int... given)
protected <F extends VertexAbstractFactor>
Freseparate(Strides target, ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder)
BayesianFactor
sample()
static void
setConvexHullMarg(ConvexHull convexHullMarg)
Set the convexhull method applied after marginalization.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ch.idsia.crema.factor.FilterableFactor
filter
-
Methods inherited from interface ch.idsia.crema.factor.GenericFactor
isLog
-
Methods inherited from interface ch.idsia.crema.factor.OperableFactor
combine, combine, marginalize
-
Methods inherited from interface ch.idsia.crema.factor.credal.vertex.separate.VertexFactor
combine, convexHull, copy, filter, getData, getSingleVertexFactor, getVertices, getVerticesAt, merge, merge, normalize, reseparate, size
-
-
-
-
Field Detail
-
separatedDomain
protected final Strides separatedDomain
-
vertexDomain
protected final Strides vertexDomain
-
CONVEX_HULL_MARG
public static ConvexHull CONVEX_HULL_MARG
-
-
Method Detail
-
setConvexHullMarg
public static void setConvexHullMarg(ConvexHull convexHullMarg)
Set the convexhull method applied after marginalization. None by default.- Parameters:
convexHullMarg
-
-
getConvexHullMarg
public static ConvexHull getConvexHullMarg()
-
getDomain
public Strides getDomain()
- Specified by:
getDomain
in interfaceGenericFactor
- Specified by:
getDomain
in interfaceVertexFactor
- Returns:
- The domain of the factor. This includes variables, sizes and strides.
-
getDataDomain
public Strides getDataDomain()
Description copied from interface:SeparatelySpecified
The domain of the rest of the domain. Together withSeparatelySpecified.getSeparatingDomain()
it will form the complete domain of the object.- Specified by:
getDataDomain
in interfaceSeparatelySpecified<VertexFactor>
- Specified by:
getDataDomain
in interfaceVertexFactor
- Returns:
-
getSeparatingDomain
public Strides getSeparatingDomain()
Description copied from interface:SeparatelySpecified
The domain of the separated part. This is usually the conditioning of the Factor. This side must not overlap with the data domain returned bySeparatelySpecified.getDataDomain()
.- Specified by:
getSeparatingDomain
in interfaceSeparatelySpecified<VertexFactor>
- Specified by:
getSeparatingDomain
in interfaceVertexFactor
- Returns:
-
iterate
public SeparateIndexIterator iterate()
Iterator over the two domains data and conditioning- Returns:
-
filter
protected <F extends VertexAbstractFactor> F filter(int variable, int state, ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder)
-
marginalize
protected <F extends VertexAbstractFactor> F marginalize(ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder, int... vars)
sum/marginalize some variables out of the credal set.- Parameters:
builder
-vars
-- Returns:
-
reseparate
protected <F extends VertexAbstractFactor> F reseparate(Strides target, ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder)
- Parameters:
target
- the new grouping/separation domain- Returns:
-
combine
protected <F extends VertexAbstractFactor> F combine(VertexFactor other, ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder, ToDoubleBiFunction<Double,Double> multiply)
-
applyConvexHull
protected abstract void applyConvexHull(ConvexHull m)
-
divide
public VertexAbstractFactor divide(VertexFactor other)
- Specified by:
divide
in interfaceOperableFactor<VertexFactor>
- Specified by:
divide
in interfaceVertexFactor
- Parameters:
other
- given factor to divide by- Returns:
- a new factor resulting in the division of this factor by the given one
-
marginalize
public VertexAbstractFactor marginalize(int variable)
Description copied from interface:OperableFactor
Sum out a variable from the factor.- Specified by:
marginalize
in interfaceOperableFactor<VertexFactor>
- Specified by:
marginalize
in interfaceVertexFactor
- Parameters:
variable
- variable to be marginalize out from this factor- Returns:
- a new factor without the given variable
-
normalize
protected <F extends VertexAbstractFactor> F normalize(ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder, int... given)
-
getSingleVertexFactor
public <F extends VertexAbstractFactor> F getSingleVertexFactor(ch.idsia.crema.factor.credal.vertex.separate.VertexFactorBuilder<F> builder, int... idx)
-
sample
public BayesianFactor sample()
- Specified by:
sample
in interfaceVertexFactor
-
-