Skip to content

Commit 8f29a5e

Browse files
committed
rel 0.0.1 - Visibility updates
1 parent b412d47 commit 8f29a5e

8 files changed

Lines changed: 15 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PSIS
1+
# PSIS.jl: Pareto smoothed importance sampling.
22

33
| **Project Status** | **Build Status** |
44
|:-------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|

notebooks/cars.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### A Pluto.jl notebook ###
2-
# v0.12.18
2+
# v0.12.19
33

44
using Markdown
55
using InteractiveUtils
@@ -80,7 +80,7 @@ end
8080

8181
# ╔═╡ 20ed768a-6008-11eb-13f4-458ca1a29592
8282
begin
83-
lppd = [log_sum_exp(log_lik[:, i] .- log(ns)) for i in 1:n]
83+
lppd = [PSIS.logsumexp(log_lik[:, i] .- log(ns)) for i in 1:n]
8484
pwaic = [var(log_lik[:, i]) for i in 1:n]
8585
-2(sum(lppd) - sum(pwaic))
8686
end

src/PSIS.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ include("waic.jl")
4343
include("pk_utilities.jl")
4444

4545
export
46-
psis_path,
47-
psislw,
48-
psisloo,
49-
logsumexp
46+
psis_path
5047

5148
end

src/logsumexp.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ function logsumexp(x::AbstractArray, d::Int64=1)
1212
end
1313
result
1414
end
15+
16+
export
17+
logsumexp

src/pk_utilities.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function pk_qualify(pk::Vector{Float64})
77
(good=pk_good, ok=pk_ok, bad=pk_bad, very_bad=sum(pk .> 1))
88
end
99

10-
function pk_plot(pk::Vector{Float64}, title="PSIS diagnostic plot.",
11-
leg=:topleft; kwargs...)
10+
function pk_plot(pk::Vector{Float64}; title="PSIS diagnostic plot.",
11+
leg=:topleft, kwargs...)
1212
scatter(pk, xlab="Datapoint", ylab="Pareto shape k",
1313
marker=2.5, lab="Pk points", leg=leg)
1414
hline!([0.5], lab="pk = 0.5");hline!([0.7], lab="pk = 0.7")

src/psisloo.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ function psisloo(log_lik::AbstractArray, wcpp::Int64=20, wtrunc::Float64=3/4)
4343

4444
return loo, loos, ks
4545
end
46+
47+
export
48+
psisloo

src/psislw.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,6 @@ function _psislw(lw_out::Array{Float64}, wcpp::Int64, wtrunc::Float64)
8181
end
8282
return lw_out, kss
8383
end
84+
85+
export
86+
psislw

src/waic.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11

22
var2(x) = mean(x.^2) .- mean(x)^2
33

4-
function log_sum_exp(x)
5-
xmax = maximum(x)
6-
xsum = sum(exp.(x .- xmax))
7-
xmax + log(xsum)
8-
end
9-
104
function waic( ll::AbstractArray; pointwise=false , log_lik="log_lik" , kwargs... )
115

126
n_samples, n_obs = size(ll)
@@ -40,5 +34,4 @@ end
4034

4135
export
4236
var2,
43-
log_sum_exp,
4437
waic

0 commit comments

Comments
 (0)