You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/gen/overview.md
+9-31Lines changed: 9 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,11 @@
1
1
# Gen.jl and CompetingClocks.jl
2
2
3
-
This is my new package to sample discrete event samplers. I want to use it with the Julia Gen.jl package. I know there are ways to do statistical methods that use likelihood calculations, and I want to do those calculations using the CompetingClocks.jl package. Please give me a first overview of the ways my package can interact with Gen.jl.
4
-
5
-
From Gen’s point of view, there are two main “hooks” your package can plug into:
3
+
From [Gen's](https://www.gen.dev/) point of view, there are two main “hooks” CompetingClocks.jl can plug into:
6
4
7
5
1. probability distributions (`Distribution{T}` with `random`/`logpdf`), and
8
6
2. generative functions (things that implement the Generative Function Interface and produce traces with scores). ([Gen][1])
9
7
10
-
CompetingClocks already provides exactly the operations those need: forward simulation of event paths, and step‑ or path‑wise log‑likelihoods.
8
+
CompetingClocks already the operations Gen needs: forward simulation of event paths, and step‑ or path‑wise log‑likelihoods.
11
9
12
10
Below is an overview of the main integration modes.
13
11
@@ -63,7 +61,6 @@ If you want finer control over the trace (addressable choices per event, increme
63
61
64
62
### Core idea
65
63
66
-
Your integration guide already frames CompetingClocks as “event timing and scheduling” inside a larger simulation loop.
67
64
Gen’s generative function should:
68
65
69
66
* take simulation parameters and possibly a time horizon as arguments,
@@ -121,7 +118,7 @@ The clean way to plug this into Gen is still via a custom distribution or genera
121
118
122
119
### b) Importance sampling and mixture proposals
123
120
124
-
Your importance‑sampling chapter already treats path log‑likelihoods under multiple distributions, using `likelihood_cnt` and `PathLikelihoods` to compute weights (and mixture proposals via `logsumexp`).
121
+
We have already seen [importance sampling](../gene_expression.md) with CompetingClocks.
125
122
126
123
Within Gen:
127
124
@@ -136,8 +133,6 @@ This lets you reuse your variance‑reduction machinery (common random numbers,
136
133
137
134
### c) HMC/gradient‑based parameter inference
138
135
139
-
Your HMC chapter shows using an event list and `pathloglikelihood` as the log‑density for HMC over event times.
140
-
141
136
Two ways this interacts with Gen:
142
137
143
138
1.**External HMC over latent event times**, Gen for everything else
@@ -152,25 +147,6 @@ Two ways this interacts with Gen:
152
147
153
148
---
154
149
155
-
## 4. Addressing and key types
156
-
157
-
Your integration guide already calls out that clock keys can be
158
-
159
-
* tuples like `(:infect, infectious, susceptible)`,
160
-
* integers, or
161
-
*`:i => 37`, “a Pair for use with Gen.jl.”
162
-
163
-
That last choice is a natural way to share an addressing scheme:
164
-
165
-
* use the same `Pair` or tuple as both
166
-
167
-
* the CompetingClocks clock key, and
168
-
* the Gen address for the corresponding random choice.
169
-
170
-
Then trace choice maps from Gen and your own logs of event keys line up one‑for‑one.
171
-
172
-
---
173
-
174
150
## Summary
175
151
176
152
At a high level, the main interaction patterns are:
@@ -181,7 +157,9 @@ At a high level, the main interaction patterns are:
181
157
182
158
All three rely on the same core feature set you already built: configurable samplers/contexts, step‑ and path‑wise log‑likelihoods, watchers, and importance‑sampling tools.
0 commit comments