Skip to content

Commit

Permalink
expanded plot reproducability
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingWorkshop committed Jan 6, 2025
1 parent d6bd765 commit bfaac2d
Show file tree
Hide file tree
Showing 12 changed files with 3,467 additions and 1,113 deletions.
Binary file removed scripts/.DS_Store
Binary file not shown.
2,393 changes: 2,393 additions & 0 deletions scripts/Manifest.toml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions scripts/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[deps]
CompressedBeliefMDPs = "0a809e47-b8eb-4578-b4e8-4c2c5f9f833c"
ExpFamilyPCA = "9c724b78-6801-4402-8a63-53f028696012"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
POMDPTools = "7588e00f-9cae-40de-98dc-e0c70c48cdd7"
POMDPs = "a93abf59-7444-517b-a68a-c42f96afdd7d"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2,164 changes: 1,059 additions & 1,105 deletions scripts/belief.ipynb

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions scripts/belief_compression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ using ExpFamilyPCA
using CompressedBeliefMDPs
using POMDPs, POMDPTools

using StableRNGs
using JSON
using Random
using Plots
using Statistics

Random.seed!(1)

function kl_div(p, q; ϵ=eps())
return sum(@. p * log((p + ϵ) / (q + ϵ)))
Expand All @@ -23,7 +22,6 @@ function calc_kl(
epca::EPCA,
X::AbstractMatrix{T}
) where T<:Real
V = epca.V
A = ExpFamilyPCA.fit!(epca, X; maxiter=100, verbose=true, steps_per_print=10)
X_recon = decompress(epca, A)
Q = to_probability(X_recon)
Expand All @@ -41,16 +39,16 @@ n_corridors = 2
corridor_length = 20
maze = CircularMaze(n_corridors, corridor_length)

rng = MersenneTwister(100)
rng = StableRNG(100)
policy = RandomPolicy(maze; rng=rng)
sampler = PolicySampler(maze; policy=policy, rng=rng, n=100)
sampler = PolicySampler(maze; policy=policy, rng=rng, n=200)

raw_beliefs = sampler(maze)
beliefs = make_numerical(raw_beliefs, maze)

n, indim = size(beliefs)

outdims = 1:7
outdims = 1:6

kl_divs_poisson_epca = []
kl_divs_gaussian_epca = []
Expand Down
Binary file modified scripts/combo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion scripts/epca_data.json

This file was deleted.

Loading

0 comments on commit bfaac2d

Please sign in to comment.