Skip to content

Commit b2639c3

Browse files
committed
use genstudio v2024.11.006
1 parent e81d7b0 commit b2639c3

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

genjax-localization-tutorial/probcomp-localization-tutorial.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def animate_path_with_confidence(path: Pose, motion_settings: dict):
797797
+ Plot.color_map({"some pose": "green", "with heading modified": "red"})
798798
+ Plot.title("Modifying a heading")
799799
)
800-
| html("span.tc", f"score ratio: {rotated_trace_weight_diff}")
800+
| html(["span.tc", f"score ratio: {rotated_trace_weight_diff}"])
801801
)
802802

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

829829
# %% [markdown]
830830
# ### Ideal sensors
@@ -1161,13 +1161,13 @@ def plt(readings):
11611161
sample, log_weight = model_importance(
11621162
sub_key, constraints_low_deviation, (motion_settings_low_deviation,)
11631163
)
1164-
animate_full_trace(sample) | html("span.tc", f"log_weight: {log_weight}")
1164+
animate_full_trace(sample) | html(["span.tc", f"log_weight: {log_weight}"])
11651165
# %%
11661166
key, sub_key = jax.random.split(key)
11671167
sample, log_weight = model_importance(
11681168
sub_key, constraints_high_deviation, (motion_settings_high_deviation,)
11691169
)
1170-
animate_full_trace(sample) | html("span.tc", f"log_weight: {log_weight}")
1170+
animate_full_trace(sample) | html(["span.tc", f"log_weight: {log_weight}"])
11711171
# %% [markdown]
11721172
# 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.
11731173
#
@@ -1248,9 +1248,9 @@ def constraint_from_path(path):
12481248
Plot.Row(
12491249
*[
12501250
(
1251-
html("div.f3.b.tc", title)
1251+
html(["div.f3.b.tc", title])
12521252
| animate_full_trace(trace, frame_key="frame")
1253-
| html("span.tc", f"score: {score:,.2f}")
1253+
| html(["span.tc", f"score: {score:,.2f}"])
12541254
)
12551255
for (title, trace, motion_settings, score) in [
12561256
[
@@ -1267,7 +1267,7 @@ def constraint_from_path(path):
12671267
],
12681268
]
12691269
]
1270-
) | Plot.Slider("frame", 0, T, fps=2)
1270+
) | Plot.Slider("frame", 0, T-1, fps=2)
12711271

12721272
# %% [markdown]
12731273
# ...more closely resembles the density of these data back-fitted onto any other typical (random) paths of the model...
@@ -1748,7 +1748,7 @@ def path_comparison_plot(*plots):
17481748
motion_settings_high_deviation,
17491749
frame_key="frame",
17501750
),
1751-
) | Plot.Slider("frame", 0, T - 1, fps=2)
1751+
) | Plot.Slider("frame", 0, T, fps=2)
17521752

17531753

17541754
# %%

poetry.lock

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package-mode = false
1111
python = ">=3.11,<3.13"
1212
jupytext = "^1.16.1"
1313
genjax = {version = "0.7.0.post4.dev0+eacb241e" , source = "gcp" }
14-
genstudio = {version = "2024.10.1", source = "gcp"}
14+
genstudio = {version = "2024.11.006", source = "gcp"}
1515
ipykernel = "^6.29.3"
1616
matplotlib = "^3.8.3"
1717
anywidget = "^0.9.7"

0 commit comments

Comments
 (0)