Skip to content

Conversation

@nsiccha
Copy link

@nsiccha nsiccha commented Nov 19, 2025

WIP that partially addresses #311 and supersedes #312.

There's a demo in tmp/demo.jl, which certainly does something that finishes quicker than the current default.

There are currently no additional tests, and I'm sure a few things are currently broken due to my changes.

Gonna tag @sethaxen, @aseyboldt, @svilupp, and maybe @yebai.

@nsiccha nsiccha marked this pull request as draft November 19, 2025 12:05
@nsiccha
Copy link
Author

nsiccha commented Nov 19, 2025

Gonna ask some questions before I move on:

Currently, the way I change the used mass matrix adaptor feels a bit hacky, reproduced below:

adaptor = AdvancedHMC.StanHMCAdaptor(
    AdvancedHMC.Adaptation.NutpieVar(size(metric); var=copy(metric.M⁻¹)), 
    AdvancedHMC.StepSizeAdaptor(spl.δ, integrator)
)
h, t = AdvancedHMC.sample_init(rng, hamiltonian, initial_params)
# Using the below uses Nutpie (as in position and gradients)
initial_state = AdvancedHMC.HMCState(0, t, metric, κ, adaptor)
# Using the below uses Stan (as in only positions)
# initial_state = nothing
@time samples = AdvancedHMC.sample(
    rng,
    model,
    spl,
    n_adapts + n_samples;
    n_adapts=n_adapts, initial_state,
    progress=true, 
)

Is there currently no easier way to specify what kind of adaptation to use, ideally just via some (keyword) argument to the sample function? Gonna also tag @penelopeysm and @mhauru who might know or have opinions on how to change the public API :)

@nsiccha
Copy link
Author

nsiccha commented Nov 20, 2025

After chatting with or at @penelopeysm I've opened #475 and think that this PR should only implement what it's currently doing.

I don't know whether we even want to export the defined struct currently - maybe.
In any case, I think I'll be adding new tests, docstrings, and make sure that the current tests don't fail anymore.

The main thing where I might need help is to figure out whether the needed changes to the adapt! function break things outside of this repo - which they might very well do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant