View Source BrowserForge.BayesianNetwork (BrowserForge v0.1.0)

Implementation of a bayesian network capable of randomly sampling from its distribution.

Summary

Functions

Randomly samples values from the distribution represented by the bayesian network, making sure the sample is consistent with the provided restrictions on value possibilities. Returns nil if no such sample can be generated.

Randomly samples from the distribution represented by the bayesian network.

Given a network instance and a set of user constraints, returns an extended set of constraints induced by the original constraints and network structure.

Types

t()

@type t() :: %BrowserForge.BayesianNetwork{
  nodes_by_name: %{required(String.t()) => BrowserForge.BayesianNode.t()},
  nodes_in_sampling_order: [BrowserForge.BayesianNode.t()]
}

Functions

generate_consistent_sample_when_possible(network, value_possibilities)

Randomly samples values from the distribution represented by the bayesian network, making sure the sample is consistent with the provided restrictions on value possibilities. Returns nil if no such sample can be generated.

generate_sample(network, input_values \\ %{})

Randomly samples from the distribution represented by the bayesian network.

get_possible_values(network, possible_values)

Given a network instance and a set of user constraints, returns an extended set of constraints induced by the original constraints and network structure.

new(path)