stats
Interact with IVP solutions.
For example, this module contains functionality to compute off-grid marginals, or to evaluate marginal likelihoods of observations of the solutions.
MarkovSeq
¤
Bases: NamedTuple
Markov sequence.
Source code in probdiffeq/stats.py
16 17 18 19 20 |
|
calibrate(x, /, output_scale)
¤
Calibrated a posterior distribution of an IVP solution.
Source code in probdiffeq/stats.py
257 258 259 260 261 262 263 |
|
log_marginal_likelihood(u, /, *, standard_deviation, posterior)
¤
Compute the log-marginal-likelihood of observations of the IVP solution.
Note
Use log_marginal_likelihood_terminal_values
to compute the log-likelihood at the terminal values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
standard_deviation
|
Standard deviation of the observation. Expected to be have shape (n,). |
required | |
u
|
Observation. Expected to have shape (n, d) for an ODE with shape (d,). |
required | |
posterior
|
Posterior distribution. Expected to correspond to a solution of an ODE with shape (d,). |
required |
Source code in probdiffeq/stats.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
log_marginal_likelihood_terminal_values(u, /, *, standard_deviation, posterior)
¤
Compute the log-marginal-likelihood at the terminal value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u
|
Observation. Expected to have shape (d,) for an ODE with shape (d,). |
required | |
standard_deviation
|
Standard deviation of the observation. Expected to be a scalar. |
required | |
posterior
|
Posterior distribution. Expected to correspond to a solution of an ODE with shape (d,). |
required |
Source code in probdiffeq/stats.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
markov_marginals(markov_seq: MarkovSeq, *, reverse)
¤
Extract the (time-)marginals from a Markov sequence.
Source code in probdiffeq/stats.py
83 84 85 86 87 88 89 90 91 92 93 |
|
markov_sample(key, markov_seq: MarkovSeq, *, shape, reverse)
¤
Sample from a Markov sequence.
Source code in probdiffeq/stats.py
23 24 25 26 27 28 29 30 31 32 |
|
markov_select_terminal(markov_seq: MarkovSeq) -> MarkovSeq
¤
Discard all intermediate filtering solutions from a Markov sequence.
This function is useful to convert a smoothing-solution into a Markov sequence that is compatible with sampling or marginalisation.
Source code in probdiffeq/stats.py
73 74 75 76 77 78 79 80 |
|
offgrid_marginals_searchsorted(*, ts, solution, solver)
¤
Compute off-grid marginals on a dense grid via jax.numpy.searchsorted.
Warning
The elements in ts and the elements in the solution grid must be disjoint. Otherwise, anything can happen and the solution will be incorrect. At the moment, we do not check this.
Warning
The elements in ts must be strictly in (t0, t1). They must not lie outside the interval, and they must not coincide with the interval boundaries. At the moment, we do not check this.
Source code in probdiffeq/stats.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|