Open1
Jupyter lab + Plots.jlでの表示される画像サイズについて
環境
- Julia Version 1.5.3
- Chrome 87.0.4280.88
例題プログラム
using Random
using Turing
using MCMCChains
using Distributions
using StatsPlots
# 真のサイコロ
p_true = 0.5
Ns = 100
Random.seed!(12)
data = rand(Bernoulli(p_true), Ns);
# Turingのモデル
@model coinflip(y) = begin
# Our prior belief about the probability of heads in a coin.
p ~ Beta(1, 1)
# The number of observations.
N = length(y)
for n in 1:N
# Heads or tails of a coin are drawn from a Bernoulli distribution.
y[n] ~ Bernoulli(p)
end
end;
# HMC
iterations = 1000
ϵ = 0.05
τ = 10
chain = sample(coinflip(data), HMC(ϵ, τ), iterations, progress=false);
# 描画
p_summary = chain[:p]
plot(p_summary, seriestype = :histogram)
Plots.jlでJupyter labに表示されるグラフのサイズ
formatがSVGの場合
plot(p_summary, seriestype = :histogram)
formatがPNGの場合
plot(p_summary, seriestype = :histogram, format=:png)