Skip to content

Bug when running flowMC/docs/tutorials/custom_strategy.ipynb #241

@mangixlzh

Description

@mangixlzh

Describe the bug
When I am running the custom_strategy.ipynb, there is a Type error:TakeSteps.init() missing 1 required positional argument: 'state_name'. I think this is due to api change and could be easily fixed when adding the state name

To Reproduce
Steps to reproduce the behavior:

  1. Go to custom_strategy.ipynb
  2. Click on run
  3. See error

Screenshots

Image

Possible Solution
from flowMC.resource.states import State
state = State(
data={
"positions": "positions",
"log_prob": "log_prob",
"acceptance": "acceptance",
}
)
resource = {
"state": state, # adding this
"positions": positions,
"log_prob": log_prob,
"acceptance": acceptance,
"RWMCMC": RWMCMC_sampler,
"logpdf": LogPDF(target_log_prob, n_dims=n_dims),
}
strategy = {
"take_serial_step": TakeSerialSteps(
logpdf_name="logpdf",
kernel_name="RWMCMC",
state_name="state", #adding this
buffer_names=["positions", "log_prob", "acceptance"],
n_steps=n_steps,
)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions