Package ch.idsia.crema.factor.bayesian
Class BayesianFactorFactory
- java.lang.Object
-
- ch.idsia.crema.factor.bayesian.BayesianFactorFactory
-
public class BayesianFactorFactory extends Object
Author: Claudio "Dna" Bonesana Project: crema Date: 16.04.2021 11:11
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BayesianAndFactorand(int... parents)Requires a pre-defined Domain.BayesianAndFactorand(int[] parents, int[] trueStates)Requires a pre-defined Domain.BayesianFactorFactorydata()Set an empty data set with all the combinations of the given domain.BayesianFactorFactorydata(double[] data)BayesianFactorFactorydata(int[] domain, double[] data)BayesianFactorFactorydomain(int[] domain, int[] sizes)BayesianFactorFactorydomain(Domain domain)static BayesianFactorFactoryfactory()This is the entry point for the chained interface of this factory.BayesianDefaultFactorget()BayesianLogFactorlog()BayesianFactorFactorylogData(double[] data)BayesianNoisyOrFactornoisyOr(int[] parents, double[] strengths)Requires a pre-defined Domain.BayesianNoisyOrFactornoisyOr(int[] parents, int[] trueStates, double[] strengths)Requires a pre-defined Domain.BayesianNotFactornot(int parent)Requires a pre-defined Domain.BayesianAndFactornot(int parent, int trueState)Requires a pre-defined Domain.static BayesianDefaultFactorone(int var)BayesianOrFactoror(int... parents)Requires a pre-defined Domain.BayesianOrFactoror(int[] parents, int[] trueStates)Requires a pre-defined Domain.BayesianFactorFactoryset(double value, int... states)BayesianFactorFactoryvalue(double value, int... states)BayesianFactorFactoryvalueAt(double d, int index)BayesianFactorFactoryvaluesAt(double[] d, int index)static BayesianDefaultFactorzero(int var)
-
-
-
Method Detail
-
one
public static BayesianDefaultFactor one(int var)
- Parameters:
var- the variable associated with this factor. This variable will be considered binary- Returns:
- a
BayesianDefaultFactorwhere state 1 has probability 1.0.
-
zero
public static BayesianDefaultFactor zero(int var)
- Parameters:
var- the variable associated with this factor. This variable will be considered binary- Returns:
- a
BayesianDefaultFactorwhere state 0 has probability 1.0.
-
factory
public static BayesianFactorFactory factory()
This is the entry point for the chained interface of this factory.- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
domain
public BayesianFactorFactory domain(Domain domain)
- Parameters:
domain- set the domain of the factor- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
domain
public BayesianFactorFactory domain(int[] domain, int[] sizes)
- Parameters:
domain- the variables that defines the domainsizes- the sizes of each variable- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
data
public BayesianFactorFactory data()
Set an empty data set with all the combinations of the given domain.- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
data
public BayesianFactorFactory data(double[] data)
- Parameters:
data- an array of values that will be directly used- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
logData
public BayesianFactorFactory logData(double[] data)
- Parameters:
data- an array of values in log-space that will be directly used- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
data
public BayesianFactorFactory data(int[] domain, double[] data)
- Parameters:
domain- the order of the variables that defines the valuesdata- the values to use specified with the given domain order- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
value
public BayesianFactorFactory value(double value, int... states)
- Parameters:
value- a single value to setstates- the states that defines this value- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
valueAt
public BayesianFactorFactory valueAt(double d, int index)
- Parameters:
d- a single value to setindex- the index (or offset) of the value to set- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
valuesAt
public BayesianFactorFactory valuesAt(double[] d, int index)
- Parameters:
d- a single value to setindex- the index (or offset) of the value to set- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
set
public BayesianFactorFactory set(double value, int... states)
- Parameters:
value- a single value to setstates- the states that defines this value- Returns:
- a
BayesianFactorFactoryobject that can be used to chain multiple commands.
-
log
public BayesianLogFactor log()
- Returns:
- a
BayesianLogFactor, where the given data are converted to log-space
-
get
public BayesianDefaultFactor get()
- Returns:
- a
BayesianDefaultFactor, where the given data are converted to non-log-space.
-
not
public BayesianNotFactor not(int parent)
Requires a pre-defined Domain.- Parameters:
parent- variable that is the parent of this factor- Returns:
- a logic
BayesianNotFactor
-
not
public BayesianAndFactor not(int parent, int trueState)
Requires a pre-defined Domain.- Parameters:
parent- variable that is the parent of this factortrueState- index of the state to be considered as TRUE for the given parent- Returns:
- a logic
BayesianAndFactor
-
and
public BayesianAndFactor and(int... parents)
Requires a pre-defined Domain.- Parameters:
parents- variables that are parents of this factor- Returns:
- a logic
BayesianAndFactor
-
and
public BayesianAndFactor and(int[] parents, int[] trueStates)
Requires a pre-defined Domain.- Parameters:
trueStates- index of the state to be considered as TRUE for each given parentparents- variables that are parents of this factor- Returns:
- a logic
BayesianAndFactor
-
or
public BayesianOrFactor or(int... parents)
Requires a pre-defined Domain.- Parameters:
parents- variables that are parents of this factor- Returns:
- a logic
BayesianOrFactor
-
or
public BayesianOrFactor or(int[] parents, int[] trueStates)
Requires a pre-defined Domain.- Parameters:
trueStates- index of the state to be considered as TRUE for each given parentparents- variables that are parents of this factor- Returns:
- a logic
BayesianOrFactor
-
noisyOr
public BayesianNoisyOrFactor noisyOr(int[] parents, double[] strengths)
Requires a pre-defined Domain.- Parameters:
parents- variables that are parents of this factorstrengths- values for the inhibition strength for each given parent- Returns:
- a logic
BayesianNoisyOrFactor
-
noisyOr
public BayesianNoisyOrFactor noisyOr(int[] parents, int[] trueStates, double[] strengths)
Requires a pre-defined Domain.- Parameters:
parents- variables that are parents of this factortrueStates- index of the state to be considered as TRUE for each given parentstrengths- values for the inhibition strength for each given parent- Returns:
- a logic
BayesianNoisyOrFactor
-
-