Skip to content

Commit 17cb3f4

Browse files
committed
the Jupytext pairing disappeared somehow?
1 parent 08e3ff6 commit 17cb3f4

18 files changed

+67
-38
lines changed

tutorials/A Bottom-Up Introduction to Gen.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,9 @@
11481148
}
11491149
],
11501150
"metadata": {
1151+
"jupytext": {
1152+
"formats": "ipynb,jl:light"
1153+
},
11511154
"kernelspec": {
11521155
"display_name": "Julia 1.4.0",
11531156
"language": "julia",

tutorials/A Bottom-Up Introduction to Gen.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# ---
22
# jupyter:
33
# jupytext:
4+
# formats: ipynb,jl:light
45
# text_representation:
56
# extension: .jl
67
# format_name: light
78
# format_version: '1.5'
89
# jupytext_version: 1.3.3
910
# kernelspec:
10-
# display_name: Julia 1.1.1
11+
# display_name: Julia 1.4.0
1112
# language: julia
12-
# name: julia-1.1
13+
# name: julia-1.4
1314
# ---
1415

1516
# # A Bottom-Up Introduction to Gen
@@ -265,7 +266,7 @@ trace[:initial_n]
265266
# +
266267
using Gen: get_choices
267268

268-
display(get_choices(trace))
269+
get_choices(trace)
269270
# -
270271

271272
# Gen also stores the arguments on which the function was called:
@@ -360,7 +361,7 @@ end
360361

361362
using Gen: get_score
362363
trace = simulate(foo, (0.3,))
363-
display(get_choices(trace))
364+
get_choices(trace)
364365
println("log probability: $(get_score(trace))")
365366

366367
# Check this value against the hand-computed value in our table above.
@@ -387,8 +388,6 @@ println("log probability: $(get_score(trace))")
387388
using Gen: choicemap
388389

389390
constraints = choicemap((:a, true), (:c, false))
390-
391-
display(constraints)
392391
# -
393392

394393
# The `choicemap` constructor above took two elements of the form `(address, value`). This is equivalent to constructing an empty choice map and then populating it:
@@ -411,7 +410,7 @@ using Gen: generate
411410
#
412411
# Let's check that the trace actually agrees with our constraints:
413412

414-
display(get_choices(trace))
413+
get_choices(trace)
415414

416415
# We can also check the return value:
417416

tutorials/Data-Driven Proposals in Gen.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,9 @@
14911491
}
14921492
],
14931493
"metadata": {
1494+
"jupytext": {
1495+
"formats": "ipynb,jl:light"
1496+
},
14941497
"kernelspec": {
14951498
"display_name": "Julia 1.4.0",
14961499
"language": "julia",

tutorials/Data-Driven Proposals in Gen.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# ---
22
# jupyter:
33
# jupytext:
4+
# formats: ipynb,jl:light
45
# text_representation:
56
# extension: .jl
67
# format_name: light
78
# format_version: '1.5'
89
# jupytext_version: 1.3.3
910
# kernelspec:
10-
# display_name: Julia 1.1.1
11+
# display_name: Julia 1.4.0
1112
# language: julia
12-
# name: julia-1.1
13+
# name: julia-1.4
1314
# ---
1415

1516
# # Tutorial: Data-Driven Proposals in Gen
@@ -280,7 +281,7 @@ end;
280281
# We can propose values of random choices from the proposal function using [`Gen.propose`](https://probcomp.github.io/Gen/dev/ref/gfi/#Gen.propose). This method returns the choices, as well as some other information, which we won't need for our purposes. For now, you can think of `Gen.propose` as similar to `Gen.initialize` except that it does not produce a full execution trace (only the choices), and it does not accept constraints. We can see the random choices for one run of the proposal on our data set:
281282

282283
(proposed_choices, _, _) = Gen.propose(custom_dest_proposal, (measurements, scene))
283-
display(proposed_choices)
284+
proposed_choices
284285

285286
# The function below runs the proposal 1000 times. For each run, it generates a trace of the model where the `:dest_x` and `:dest_y` choices are constrained to the proposed values, and then visualizes the resulting traces. We make the proposal a parameter of the function because we will be visualizing the output distribution of various proposals later in the notebook.
286287

tutorials/Introduction to Modeling in Gen.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,9 @@
18271827
}
18281828
],
18291829
"metadata": {
1830+
"jupytext": {
1831+
"formats": "ipynb,jl:light"
1832+
},
18301833
"kernelspec": {
18311834
"display_name": "Julia 1.4.0",
18321835
"language": "julia",

tutorials/Introduction to Modeling in Gen.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# ---
22
# jupyter:
33
# jupytext:
4+
# formats: ipynb,jl:light
45
# text_representation:
56
# extension: .jl
67
# format_name: light
78
# format_version: '1.5'
89
# jupytext_version: 1.3.3
910
# kernelspec:
10-
# display_name: Julia 1.1.1
11+
# display_name: Julia 1.4.0
1112
# language: julia
12-
# name: julia-1.1
13+
# name: julia-1.4
1314
# ---
1415

1516
# # Tutorial: Introduction to Modeling in Gen
@@ -127,7 +128,7 @@ Gen.get_args(trace)
127128

128129
# The trace also contains the value of the random choices, stored in a map from address to value called a *choice map*. This map is available through the API method [`get_choices`]():
129130

130-
display(Gen.get_choices(trace))
131+
Gen.get_choices(trace)
131132

132133
# We can pull out individual values from this map using Julia's subscripting syntax `[...]`:
133134

@@ -539,12 +540,12 @@ end;
539540
# We first show the addresses sampled by `bar`:
540541

541542
trace = Gen.simulate(bar, ())
542-
display(Gen.get_choices(trace))
543+
Gen.get_choices(trace)
543544

544545
# And the addresses sampled by `bar_using_namespace`:
545546

546547
trace = Gen.simulate(bar_using_namespace, ())
547-
display(Gen.get_choices(trace))
548+
Gen.get_choices(trace)
548549

549550
# Using `@trace` with a namespace can help avoid address collisions for complex models.
550551

tutorials/Iterative inference in Gen.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,8 @@
11981198
],
11991199
"metadata": {
12001200
"jupytext": {
1201-
"encoding": "# -*- coding: utf-8 -*-"
1201+
"encoding": "# -*- coding: utf-8 -*-",
1202+
"formats": "ipynb,jl:light"
12021203
},
12031204
"kernelspec": {
12041205
"display_name": "Julia 1.4.0",

tutorials/Iterative inference in Gen.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
# ---
33
# jupyter:
44
# jupytext:
5+
# formats: ipynb,jl:light
56
# text_representation:
67
# extension: .jl
78
# format_name: light
89
# format_version: '1.5'
910
# jupytext_version: 1.3.3
1011
# kernelspec:
11-
# display_name: Julia 1.1.1
12+
# display_name: Julia 1.4.0
1213
# language: julia
13-
# name: julia-1.1
14+
# name: julia-1.4
1415
# ---
1516

1617
# # Tutorial: Basics of Iterative Inference Programming in Gen

tutorials/Modeling with Black-Box Julia Code.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,9 @@
678678
}
679679
],
680680
"metadata": {
681+
"jupytext": {
682+
"formats": "ipynb,jl:light"
683+
},
681684
"kernelspec": {
682685
"display_name": "Julia 1.4.0",
683686
"language": "julia",

tutorials/Modeling with Black-Box Julia Code.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# ---
22
# jupyter:
33
# jupytext:
4+
# formats: ipynb,jl:light
45
# text_representation:
56
# extension: .jl
67
# format_name: light
78
# format_version: '1.5'
89
# jupytext_version: 1.3.3
910
# kernelspec:
10-
# display_name: Cora Julia 1.1.1
11+
# display_name: Julia 1.4.0
1112
# language: julia
12-
# name: cora-julia-1.1
13+
# name: julia-1.4
1314
# ---
1415

1516
# # Modeling with black-box Julia code
@@ -166,7 +167,6 @@ end;
166167
planner_params = PlannerParams(300, 3.0, 2000, 1.)
167168
(trace, _) = Gen.generate(agent_model, (scene, dt, num_ticks, planner_params));
168169
choices = Gen.get_choices(trace)
169-
display(choices)
170170

171171
# Next we explore the assumptions of the model by sampling many traces from the generative function and visualizing them. We have created a visualization specialized for this generative function for use with the `GenViz` package, in the directory `../inverse-planning/grid-viz/dist`. We have also defined a `trace_to_dict` method to convert the trace into a value that can be automatically serialized into a JSON string for use by the visualization:
172172

0 commit comments

Comments
 (0)