This notebook lets you test out your installation of Jupyter and Julia. It will also automatically download all the packages you need for the course, precompile them and check if they run correctly.
# Check correct Julia version (will throw error if false)
@assert VERSION == v"1.5.2"
# Set up workspace (downloads and installs necessary packages)
using Pkg
Pkg.activate("./workspace/")
Pkg.instantiate();
# Test ForneyLab (will throw errors if inference failed)
using ForneyLab
graph = FactorGraph()
@RV μ ~ GaussianMeanVariance(0.0, 1.0)
@RV x ~ GaussianMeanVariance(μ, 1.0)
placeholder(x, :x)
algorithm = messagePassingAlgorithm(μ, id=:μ)
source_code = algorithmSourceCode(algorithm)
eval(Meta.parse(source_code))
data = Dict(:x => 3.0)
marginals = Dict()
stepμ!(data, marginals)
@assert typeof(marginals) == Dict{Any,Any}
@assert marginals[:μ] == ProbabilityDistribution(Univariate,GaussianWeightedMeanPrecision, xi=3.0, w=2.0)
# Test plotting
using Plots
pyplot()
x = range(0, stop=10, length=50)
y = x.^3
plot(x, y, label="", xlabel="x", ylabel="y")
# Test Unicode characters in plots and LaTeXString
using LaTeXStrings
θ = range(0, stop=1, length=50)
pθ = θ.^3 .* (1 .- θ).^7
plot(θ, pθ, xlabel="θ", ylabel="p(θ)", label=L"p(θ) = \prod_{i=1}^{N} θ^{X_i} \cdot (1-\theta)^{1 - X_i}")
# Testing data loading and management
using CSV
using DataFrames
df = CSV.read("../datasets/old_faithful.csv")