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 BayesianAndFactor
and(int... parents)
Requires a pre-defined Domain.BayesianAndFactor
and(int[] parents, int[] trueStates)
Requires a pre-defined Domain.BayesianFactorFactory
data()
Set an empty data set with all the combinations of the given domain.BayesianFactorFactory
data(double[] data)
BayesianFactorFactory
data(int[] domain, double[] data)
BayesianFactorFactory
domain(int[] domain, int[] sizes)
BayesianFactorFactory
domain(Domain domain)
static BayesianFactorFactory
factory()
This is the entry point for the chained interface of this factory.BayesianDefaultFactor
get()
BayesianLogFactor
log()
BayesianFactorFactory
logData(double[] data)
BayesianNoisyOrFactor
noisyOr(int[] parents, double[] strengths)
Requires a pre-defined Domain.BayesianNoisyOrFactor
noisyOr(int[] parents, int[] trueStates, double[] strengths)
Requires a pre-defined Domain.BayesianNotFactor
not(int parent)
Requires a pre-defined Domain.BayesianAndFactor
not(int parent, int trueState)
Requires a pre-defined Domain.static BayesianDefaultFactor
one(int var)
BayesianOrFactor
or(int... parents)
Requires a pre-defined Domain.BayesianOrFactor
or(int[] parents, int[] trueStates)
Requires a pre-defined Domain.BayesianFactorFactory
set(double value, int... states)
BayesianFactorFactory
value(double value, int... states)
BayesianFactorFactory
valueAt(double d, int index)
BayesianFactorFactory
valuesAt(double[] d, int index)
static BayesianDefaultFactor
zero(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
BayesianDefaultFactor
where 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
BayesianDefaultFactor
where 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
BayesianFactorFactory
object that can be used to chain multiple commands.
-
domain
public BayesianFactorFactory domain(Domain domain)
- Parameters:
domain
- set the domain of the factor- Returns:
- a
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
BayesianFactorFactory
object 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
-
-