inferlo.GenericGraphModel
- class inferlo.GenericGraphModel[source]
Graphical model in the most general form.
Explicitly specified by list of factors.
- __init__(num_variables: int, domain=None)[source]
- Parameters:
num_variables – Number of variables in the model.
domain – Default domain of each variable.
Methods
__init__
(num_variables[, domain])add_factor
(factor)Adds factor.
copy
()Makes a copy of itself.
draw_factor_graph
(ax)Draws the factor graph.
evaluate
(x)Returns value of non-normalized pdf in point.
from_model
(model)Creates copy of a given model.
get_factor_graph
()Builds factor graph for the model.
Returns all factors.
get_max_domain_size
()Returns the biggest domain size over all variables.
get_symbolic_variables
()Prepares variables for usage in expressions.
get_variable
(idx)Returns variable by its index.
get_variables
()Returns all variables.
infer
([algorithm])Performs inference.
max_likelihood
([algorithm])Finds most probable state.
max_likelihood_bruteforce
()Evaluates most likely state in a very inefficient way.
part_func_bruteforce
()Evaluates partition function in very inefficient way.
sample
(num_samples[, algorithm])Generates samples.
- static from_model(model: GraphModel)[source]
Creates copy of a given model.