Skip to content

example for continuing sampling from a periodically saved trace #109

Open
@unaschneck

Description

@unaschneck

Hi,

Thank you for making this! I am a little unclear from the readme documentation how I would go about reloading the saved trace to continue an interrupted sampling. Ideally, I'd like to determine the total number of sampling and burn steps ahead of time and then have an ongoing save after each sample in case of a power outage or the job being interrupted in the server and reload from previously saved trace.

I am trying to implement something like

ch_client = clickhouse_driver.Client("localhost")
backend = mcbackend.ClickHouseBackend(ch_client)
trace = mcbackend.pymc.TraceBackend(backend)

continue_run = 0 # here is where I would activate a flag if the last run was not completed because the job was interrupted

with my_model:
if continue_run:
trace_id = pm.sample(***restart sampling from saved trace***)
else:
trace_id = pm.sample(draws=number_samples, tune=number_burn_samples, chains=number_walkers, cores=number_processors, return_inferencedata=True, target_accept=0.95,trace=trace) # save ongoing trace to backend

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions