- changed status to open
Defining CPT by a function instead of dictionary
Currently, the lea.switch
method requires the full CPT in the form of a dictionary. This CPT may be difficult to define if there are many entries or simply too large to fit in memory. As alternative, Lea provides the lea.cpt
method that may factorize entries my means of boolean conditions on the influencing variables. However, lea.cpt
only enables some kinds of factorization; also, the inference is usually slower than with lea.switch
.
We propose a new approach to lea.switch
. Instead of passing an explicit CPT dictionary, we could pass a function that mimics the CPT lookup: such function receives a value from the influencing variable (possibly a tuple from a joint of several variables), it has then to return a probability distribution depending of its argument. The inference algorithm should be able to use this function without expanding the full CPT.
The name of the new method could be switch_func
. So, the construct
my_cpt_dict = {...}
my_lea_variable.switch(my_cpt_dict)
could be replaced by
def my_cpt_func(v):
...
my_lea_variable.switch_func(my_cpt_func)
The switch_func
could then be useful to define noisy-or / noisy-max models.
Comments (6)
-
reporter -
reporter Add Slea class and lea.switch_func method (refs
#47)→ <<cset 3dc8bd46a50b>>
-
reporter This new feature is documented here on the wiki. I've just released Lea 3.1.0.beta.1, which includes this new feature. If something is wrong or improvable, it's still time to react.
-
reporter - changed status to resolved
-
reporter - changed status to closed
-
reporter Add Slea class and lea.switch_func method (refs
#47)→ <<cset d48c6250696c>>
- Log in to comment