Module Mn
module Mn: sig .. end
The MN library reads, writes, and represents Markov networks with
factors represented as tables, trees, sets of features, or individual
features.
Auxilary modules
module Varstate: sig .. end
Set of functions for indexing and iterating over the states of
sets of variables.
module Factor: sig .. end
The Factor module is used for representing a factor in a factor graph.
Markov networks
type network = {
}
network data structure holds the Markov network factors.
val pll : network -> Factor.varvalue array -> float
pll mn x computes the pseudo-likelihood of sample x given
network mn.
val numvars : network -> int
Returns number of variables in the network.
val numweights : network -> int
Returns number of parameters in the network.
val get_range : network -> int -> int
get_range mn v returns the cardinality of variable v in
network mn.
val schema : network -> int array
Returns the schema of the given network.
val factors : network -> Factor.factor array
Returns an array of all factors of the given network.
val create : int array -> Factor.factor array -> network
create schema factors returns a
Mn.network for the given
schema and
factors.
val raw_logprob : network -> Factor.varvalue array -> float
raw_logprob mn state returns the unnormalized log probability of
the variable configuration state according to network mn.
val mb_logdist : network -> Factor.varvalue array -> int -> float array
mb_logdist mn x i returns the log probability distribution over
variable i in network mn, given the values of its Markov blanket
variables specified in instance x.
val simplify : network -> Factor.varvalue array -> network
simplify mn ev builds a new MN with simpler factors, conditioned
on evidence ev.
val to_features : network -> Factor.feature list
to_features mn converts the factors in network mn to a list of
features.
val set_weights : network -> float array -> unit
set_weights mn w updates weights using weight vector w.
Modifies mn in place.
Read/write Markov networks
val filename_is_mn : string -> bool
Returns true if filename ends with .mn.
val filename_is_uai : string -> bool
Returns true if filename ends with .uai.
val input_features_lex : Lexing.lexbuf -> Factor.feature list
Load features from an existing lexing buffer.
val input_features : Pervasives.in_channel -> Factor.feature list
Load features from an input channel.
val load : Pervasives.in_channel -> network
Loads a Markov network in .mn format from a channel.
val output : Pervasives.out_channel -> network -> unit
Writes a Markov network in .mn format to a channel.
val load_uai : Pervasives.in_channel -> network
Loads a Markov network written in the UAI file format.
val output_uai : Pervasives.out_channel -> network -> unit
Writes a Markov network in the UAI file format.
val load_auto : string -> network
load_auto filename loads an MN, inferring its filetype by its
filename.
val write_auto : string -> network -> unit
write_auto filename mn writes Markov network mn to the output
file filename, inferring its filetype by its filename.