Package ch.idsia.crema.factor.bayesian
Class BayesianOrFactor
- java.lang.Object
 - 
- ch.idsia.crema.factor.bayesian.BayesianAbstractFactor
 - 
- ch.idsia.crema.factor.bayesian.BayesianFunctionFactor
 - 
- ch.idsia.crema.factor.bayesian.BayesianLogicFactor
 - 
- ch.idsia.crema.factor.bayesian.BayesianOrFactor
 
 
 
 
 
- 
- All Implemented Interfaces:
 BayesianFactor,SeparatelySpecified<BayesianFactor>,FilterableFactor<BayesianFactor>,GenericFactor,OperableFactor<BayesianFactor>
public class BayesianOrFactor extends BayesianLogicFactor
Author: Claudio "Dna" Bonesana Project: crema Date: 16.08.2021 15:33 
- 
- 
Field Summary
- 
Fields inherited from class ch.idsia.crema.factor.bayesian.BayesianLogicFactor
isObserved, observedState, observedStates, observedVariables, parents, trueStates, variable 
- 
Fields inherited from class ch.idsia.crema.factor.bayesian.BayesianFunctionFactor
f 
- 
Fields inherited from class ch.idsia.crema.factor.bayesian.BayesianAbstractFactor
domain 
 - 
 
- 
Constructor Summary
Constructors Modifier Constructor Description BayesianOrFactor(Strides domain, int... parents)An OR factor where the true state for each parent is the higher state available.BayesianOrFactor(Strides domain, int[] parents, int[] trueStates)An OR factor where the true states for each parent are defined externally.protectedBayesianOrFactor(BayesianOrFactor factor, int variable, int state) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BayesianFactorcopy()protected doublef(int offset)BayesianAbstractFactorfilter(int variable, int state)Reduces the domain by removing a variable and selecting the specified state.StringtoString()- 
Methods inherited from class ch.idsia.crema.factor.bayesian.BayesianLogicFactor
getParents, getTrueStates, getVariable 
- 
Methods inherited from class ch.idsia.crema.factor.bayesian.BayesianFunctionFactor
getData, getLogValue, getLogValueAt, getValue, getValueAt, logProb, setF 
- 
Methods inherited from class ch.idsia.crema.factor.bayesian.BayesianAbstractFactor
collect, combine, combine, divide, divide, equals, getDataDomain, getDomain, getSeparatingDomain, hashCode, marginalize, sample 
- 
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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, normalize 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
BayesianOrFactor
public BayesianOrFactor(Strides domain, int[] parents, int[] trueStates)
An OR factor where the true states for each parent are defined externally.- Parameters:
 domain- working domain of this factorparents- variables that are parents of this factortrueStates- index of the state to be considered as TRUE for each given parent
 
- 
BayesianOrFactor
public BayesianOrFactor(Strides domain, int... parents)
An OR factor where the true state for each parent is the higher state available.- Parameters:
 domain- working domain of this factorparents- variables that are parents of this factor
 
- 
BayesianOrFactor
protected BayesianOrFactor(BayesianOrFactor factor, int variable, int state)
 
 - 
 
- 
Method Detail
- 
f
protected double f(int offset)
- Parameters:
 offset- offset to get the value for- Returns:
 - 1.0 when at least one of the parents is in the TRUE state, otherwise 0.0
 
 
- 
copy
public BayesianFactor copy()
- Returns:
 - a copy of the factor
 
 
- 
filter
public BayesianAbstractFactor filter(int variable, int state)
Description copied from class:BayesianAbstractFactorReduces the domain by removing a variable and selecting the specified state.
This default implementation uses a
SimpleBayesianFilterasBayesianCollectorand checks if this factorGenericFactor.isLog(): if true builds aBayesianDefaultFactorelse aBayesianDefaultFactor.- Specified by:
 filterin interfaceBayesianFactor- Specified by:
 filterin interfaceFilterableFactor<BayesianFactor>- Specified by:
 filterin interfaceOperableFactor<BayesianFactor>- Overrides:
 filterin classBayesianAbstractFactor- Parameters:
 variable- the variable to be filtered outstate- the state to be selected- Returns:
 - if we are in log-space, a 
BayesianLogFactorelse aBayesianDefaultFactor 
 
- 
toString
public String toString()
- Overrides:
 toStringin classBayesianFunctionFactor
 
 - 
 
 -