reproducing figures in "Introduction to Machine Learning by Bayesian Inference" written by Suyama, Atsushi using JuliaLang.
(ISBN 9784061538320)
-
Julia: 1.3.1
- "LaTeXStrings" => v"1.0.3"
- "Combinatorics" => v"1.0.0"
- "Makie" => v"0.9.5"
- "IJulia" => v"1.20.2"
- "AbstractPlotting" => v"0.9.17"
- "Plots" => v"0.28.4"
- "Colors" => v"0.9.6"
layout of divided figures
l = @layout [a; b c]
a = bar(...)
b = bar(...)
c = bar(...)
plot(a,b,c, layout=l)
- 3D barplot
Makie.jl provides 3d scatter function as meshscatter. 3d barplot can be obtained from meshscatter like below.
using Makie
using AbstractPlotting
markersize = Vec3f0.(1,1, -vec(mplot))
Here, 1x1 tile on scatterring point is extended down to (x,y) plane by typing -1 * z_value (in this case; vec(mplot)). Then, we get "bars"!
- layout
Makie layout is used for displaying three bargraph. Both an entire region in the figure or a sub-region containing each barplot are called "scene" We can define the size of resion (see script).
Once scenes are defined. We can overwrite each one by calling plot function like this.
meshgrid!(scene1, ...)
where
If you want to omit the color bar in a plot. Use legend=:none option in plot function.
legend=:none
where
Consider Bernouli destribution on a binary variablble x.
Here, we want to learn the parameter µ. Thus we set Beta distribution as a prior distribution over µ.
According to sampling (observation of N data points), posterior distribution about the parameter (µ) can be expressed as a beta distribution with new hyperparameters.
where
Precision (lambda) is unknown.
where
Logarithmic form of predictive distribution is expressed below,
and alike to (logarithmic form of) Student's t distribution
Fig.3.6 sampling of 3rd order function from pre-trained model
Fig 3.7 sampling of synthesized data (y_n) from the function.
where
where
A single Gaussian distribution cannot represent sample distributions with multi classes (culsters).
Similary, a polynominal linear regression curve cannot fit to two trends. When M (polynominal dimension) is 4, the fitted curve shows average values between two trends. When M is 30, the curve goes back and forth between two trends. We should assume multiple (two) regresion functions in such data trends.