GraphicalModelLearning.jl
GraphicalModelLearning.jl copied to clipboard
Proposal for Graphical Model Data Structure
For now we assume discrete models. (something) indicates that something is optional, everything else is required.
A Julia data-structure that can be serialized to JSON as follows,
{
"order":<int>,
"variable_count":<int>,
"alphabet":[<int>,<int>,...,<int>],
"symmetric":<bool>,
("variable_names":[<string>,<string>,...,<string>],)
"terms":[
{"weight":<float>, "variables":[<int>, <int>,...,<int>]},
...
]
}
All values in alphabet should be unique. For now we will require the alphabet to be [-1, 1].
The arrays variable_names must be the same length that is specified by variable_count. The length of variables should be less than or equal to the value of order.
if symmetric is true, then the values in variables should be increasing. All non-increasing orders can be added to the increasing one. Similarly, multiple references to the same variable can be collapsed into lower order terms.
Inside of Julia, it would be nice if the weights could be accessed using a multidimensional array syntax (gm[1,2,4,8]).
Should variables be numbered from 0..variable_count-1 or 1..variable_count?
Can we enumerate all useful alphabets, e.g. spin, boolean, integer, integer+, real, real+? If so, this is probably better than allowing the user to specify any arbitrary alphabet. integer+ and real+ include 0.
Called FactorGraph, are always symmetric
We can consider a type like this
type FactorGraph{T <: Real, N}
order::Int
varible_count::Int
alphabet::Symbol
terms::Vector{Dict{Tuple,T}}
variable_names::Nullable{Vector{String}}
FactorGraph(a,b,c) = new(N, a, b, [Dict{Tuple,T}() for n in 1:N], c)
end
If we want the order parameter to be part of the type signature.