Skip to content

use genstudio v2024.11.006 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: colin/grid-search
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions genjax-localization-tutorial/probcomp-localization-tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def animate_path_with_confidence(path: Pose, motion_settings: dict):
+ Plot.color_map({"some pose": "green", "with heading modified": "red"})
+ Plot.title("Modifying a heading")
)
| html("span.tc", f"score ratio: {rotated_trace_weight_diff}")
| html(["span.tc", f"score ratio: {rotated_trace_weight_diff}"])
)

# %% [markdown]
Expand All @@ -809,7 +809,7 @@ def animate_path_with_confidence(path: Pose, motion_settings: dict):
key, sub_key = jax.random.split(key)

rotated_first_step, rotated_first_step_weight_diff, _, _ = trace.update(
sub_key, C[0, "steps", "pose", "hd"].set(jnp.pi / 2.0)
sub_key, C[0, "hd"].set(jnp.pi / 2.0)
)

# %%
Expand All @@ -824,7 +824,7 @@ def animate_path_with_confidence(path: Pose, motion_settings: dict):
for pose in path_from_trace(trace)
]
+ Plot.color_map({"some path": "green", "with heading modified": "red"})
) | html("span.tc", f"score ratio: {rotated_first_step_weight_diff}")
) | html(["span.tc", f"score ratio: {rotated_first_step_weight_diff}"])

# %% [markdown]
# ### Ideal sensors
Expand Down Expand Up @@ -1161,13 +1161,13 @@ def plt(readings):
sample, log_weight = model_importance(
sub_key, constraints_low_deviation, (motion_settings_low_deviation,)
)
animate_full_trace(sample) | html("span.tc", f"log_weight: {log_weight}")
animate_full_trace(sample) | html(["span.tc", f"log_weight: {log_weight}"])
# %%
key, sub_key = jax.random.split(key)
sample, log_weight = model_importance(
sub_key, constraints_high_deviation, (motion_settings_high_deviation,)
)
animate_full_trace(sample) | html("span.tc", f"log_weight: {log_weight}")
animate_full_trace(sample) | html(["span.tc", f"log_weight: {log_weight}"])
# %% [markdown]
# A trace resulting from a call to `importance` is structurally indistinguishable from one drawn from `simulate`. But there is a key situational difference: while `get_score` always returns the frequency with which `simulate` stochastically produces the trace, this value is **no longer equal to** the frequency with which the trace is stochastically produced by `importance`. This is both true in an obvious and less relevant sense, as well as true in a more subtle and extremely germane sense.
#
Expand Down Expand Up @@ -1248,9 +1248,9 @@ def constraint_from_path(path):
Plot.Row(
*[
(
html("div.f3.b.tc", title)
html(["div.f3.b.tc", title])
| animate_full_trace(trace, frame_key="frame")
| html("span.tc", f"score: {score:,.2f}")
| html(["span.tc", f"score: {score:,.2f}"])
)
for (title, trace, motion_settings, score) in [
[
Expand Down Expand Up @@ -1748,7 +1748,7 @@ def path_comparison_plot(*plots):
motion_settings_high_deviation,
frame_key="frame",
),
) | Plot.Slider("frame", 0, T - 1, fps=2)
) | Plot.Slider("frame", 0, T, fps=2)


# %%
Expand Down
17 changes: 11 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package-mode = false
python = ">=3.11,<3.13"
jupytext = "^1.16.1"
genjax = {version = "0.7.0.post4.dev0+eacb241e" , source = "gcp" }
genstudio = {version = "2024.10.1", source = "gcp"}
genstudio = {version = "2024.11.013", source = "gcp"}
ipykernel = "^6.29.3"
matplotlib = "^3.8.3"
anywidget = "^0.9.7"
Expand Down
Loading