Closed reubenharry closed 4 months ago
The other argument returned, average
, is the expectation. I'm not sure expectation(transform(x))
would work, because they are both functions of x
(the state).
The other argument returned, average, is the expectation. I'm not sure expectation(transform(x)) would work, because they are both functions of x (the state).
What i meant here is that:
transform(x)
, which is a function of x (the state). For examples with transform is lambda x: x.position
. If user wants to compute expectation eg $E[x^2]$, they need to do np.mean(mcmc_samples ** 2)
trasnform
being a function of the state, but function expectation
being a function of the output of transform
.Does this makes sense?
Yeah, that makes sense. Updated.
Improvement to
run_inference_algorithm
Description:
run_inference_algorithm
currently uses a try-except clause to allow the user to either provide an initial position or an initial state. This has led to some problems, when theexcept
clause fails to trigger.run_inference_algorithm
also produces an array of[num_steps, n_dims]
, which for long chains on high-dim problems can be prohibitively large.Solution:
Make
run_inference_algorithm
takeinitial_state
orinitial_position
explicitly, so that the caller ofrun_inference_algorithm
is responsible for providinginitial_state
orinitial_position
, rather than deferring this task.Add a
streaming
mode forrun_inference_algorithm
.A few important guidelines and requirements before we can merge your PR:
main
commit;pre-commit
is installed and configured on your machine, and you ran it before opening the PR;