Skip to content

KULeuven-MAI/UAI.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UAI.jl

This is a Julia library accompanying the KUL course Uncertainty in Artificial Intelligence.

Features

  • Generating pseudo random, normalized tensors.
  • Testing normalization of a tensor.
  • Normalizing tensors overall.
  • Normalizing tensors with a condition set.
  • Plotting (factor) graphs, (Hidden) Markov Models, (di)graphical models, Bayesian Networks
  • Mermaid-JS like easy, human-and-machine readable graphical model construction. e.g.:
    • c is a collider of a and b a>c<b
    • a-b-c is a linear (Markov) chain
  • Get factorisation from graphical model.
   getFactorization("a<f>b")
   P(a,f,b) =
   (P(a|f)P(f)P(b|f), DiscreteVar[a, f, b])
  • Mixed model (Chain Graph) representations e.g. a-b-c; e<b>d is a mixed model with a fork extending from b.
  • Testing for graphical independence in Bayesian networks (D-seperation)
julia> @gidp "a<c>b" a b|c
a  b | c
true
julia> @gidp "a>c<b" a b|c
a ⃥ b | c
false

Installation

You can get Julia 1.4 here.

You can install this library in two different ways either by forking or using the Julia build-in Pkg package manager.

git clone project, activate, instantiate, using

git clone https://github.com/KULeuven-MAI/UAI.jl
cd UAI.jl
julia
# enter the package manager with ]
] activate .
instantiate
# back to regular Julia REPL 
<backspace>
using UAI 
# precompiled and all set for e.g. this:
plotFromStr("a>c<b", "plots/collider.png")

Using Julia REPL/jupyter notebook

import Pkg
Pkg.add(Pkg.PackageSpec(url="https://github.com/KULeuven-MAI/UAI.jl"))
using UAI
drawFromStr("a>c<b", "plots/collider.png")

If you're using Jupyter notebooks with the IJulia kernel you can include display the generated png simply by using the following markdown syntax:

![](plots/collider.png)

Contributing

I warmly welcome contributions. Julia is a pleasure to work with imho, increasing in popluarity, ready for high performance computing and used more and more in the Data Science community. An ideal choice to try it with this project. :)

I'm trying to write extensive tests you can run those as follows:

git clone https://github.com/KULeuven-MAI/UAI.jl
cd UAI.jl
] test

If you create a PR, please make sure the test are succeeding, fix them if necessary. (But I still have some catching up to do with writing tests. See #3)

Plots

Bayesian Network - Collider

plotFromStr("a>c<b", "plots/collider.png")

Bayesian Network - Fork

plotFromStr("a<f>b", "plots/fork.png")

Bayesian Network - Chain

plotFromStr("a>b>c", "plots/chain.png")

Markov Network - A grid with a loop

plotFromStr("a-b-c-d-a", "plots/grid.png")

Chain Graph - combining directed and undirected graphs.

drawFromStr("e<a-b-c-d>e;d-a", "plots/chainGraph.png")

In progress Features

  • Displaying chain graphs is possible with my GraphPlot fork (until this PR)
  • Cleaner APIs and better documentation.
  • Inference with bucket elimination.

Wanted Features

  • Inference with various algorithms: naive sum-prodcut, bucket elimination, sum-product algorithm on factor graphs, alpha/beta inference for HMMs
  • Benchmark comparison of the implemented inference algorithms.
  • (Full Information) Maximum Likelihood implementation for Missing At Random data.
  • Tools for step-by-step probabilistic reasoning: application of definitions, Bayes rule, pushing sums down, ...
  • Soft logic gates tool
  • Implement Plots.jl and GraphRecipes as visual backend instead of GraphPlot.jl.
  • (Interactive?) Visualization of the simplified sum-product algorithm for non-branching graphs
  • (Interactive?) Visualization of the (Sum|Max)-Product algorithm
  • Interactive and visualized probabilistic problem solving challenges.
  • SVG support for drawFromStr() (see #1)
  • Make documentation cheatsheet corresponding to this one here
  • < Your suggestion here >

Nice to have features

  • Multi-node support like A,B>C (see #2)
  • Plate notation
  • Integration of this paper and other math-visual tools
  • Integration with Probabilistic Programming Language Turing.jl?
  • Accessibility (for ease of education with dyslexia, colorblindness, dyspraxia, ...)
  • Displaying matrices & vectors beautifully (useful for visualizing algorithms)
  • < Your suggestion here >

About

Julia library for the UAI course.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published