stan-dev / stan-dev/rstan

rstan not using chain_id if `auto_write=TRUE`

Open
#294 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

Saved models appear to also save the chain_id

Description:

https://groups.google.com/forum/#!category-topic/stan-users/UR5oaPsfjjE

Reproducible Steps:
library(rstan)

rstan_options(auto_write=FALSE)
stan(model_code="parameters { real x; } model { x ~ normal(0, 1); }", chain_id=5:8)  # uses chain_id 5:8

rstan_options(auto_write=TRUE)
options(mc.cores = parallel::detectCores())
stan(model_code="parameters { real x; } model { x ~ normal(0, 1); }", chain_id=5:8)  # uses chain_id 1:4
Current Output:
> stan(model_code="parameters { real x; } model { x ~ normal(0, 1); }", chain_id=5:8)  # uses chain_id 1:4
starting worker pid=41923 on localhost:11822 at 09:10:36.374
starting worker pid=41931 on localhost:11822 at 09:10:36.567
starting worker pid=41939 on localhost:11822 at 09:10:36.732
starting worker pid=41947 on localhost:11822 at 09:10:36.881

SAMPLING FOR MODEL 'd4901852a59d5abb2b87f654d5e8d0a7' NOW (CHAIN 1).
Expected Output:
> stan(model_code="parameters { real x; } model { x ~ normal(0, 1); }", chain_id=5:8)  # uses chain_id 1:4
starting worker pid=41923 on localhost:11822 at 09:10:36.374
starting worker pid=41931 on localhost:11822 at 09:10:36.567
starting worker pid=41939 on localhost:11822 at 09:10:36.732
starting worker pid=41947 on localhost:11822 at 09:10:36.881

SAMPLING FOR MODEL 'd4901852a59d5abb2b87f654d5e8d0a7' NOW (CHAIN 5).
RStan Version:

2.9.0-3

R Version:

3.2.4

Operating System:

OS X 10.11.4 (El Capitan)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue through rstan_options(auto_write=TRUE) and the stan() entry point, comparing it with auto_write=FALSE. Trace how the chain_id argument is handled when a saved model is reused. Done means chain_id=5:8 produces sampling output beginning with CHAIN 5 under auto_write=TRUE, matching the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.