stan-dev / stan-dev/rstan

Can't print from transformed data

Open
#828 17 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary:

print() statements executed from the transformed data block are not displayed back to the user.

Description:

print() statements executed in transformed data should be shown to the user. This was the old behavior (not sure when it changed, but I think around 2.19). See the 'print frequency' section here: https://mc-stan.org/docs/2_24/reference-manual/print-statements-section.html for confirmation that these print statements should show up.

This is particularly useful from rstan to, e.g., keep track of making sure the correct version of the source code is running.

Reproducible Steps:

See source code in the attached file:
stanprint.txt

Current Output:

samples <- sampling(test_model, data = list(n = 3), chains = 1, iter = 2, open_progress = T, show_messages = T)

SAMPLING FOR MODEL '67e266178e2a1aef57a3b6ce7f76543e' NOW (CHAIN 1).
Chain 1: alpha= 1.54289 beta = -0.313112

Chain 1: alpha= 1.54289 beta = -0.313112

Expected Output:

samples <- sampling(test_model, data = list(n = 3), chains = 1, iter = 2, open_progress = T, show_messages = T)
Chain 1: n= 3
SAMPLING FOR MODEL '67e266178e2a1aef57a3b6ce7f76543e' NOW (CHAIN 1).
Chain 1: alpha= 1.54289 beta = -0.313112

Chain 1: alpha= 1.54289 beta = -0.313112

RStan Version:

2.21.2

R Version:

R version 3.6.2 (2019-12-12)

Operating System:

OS X 10.15.5

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

Start with the attached stanprint.txt reproduction and the referenced Stan print-frequency documentation, then reproduce the missing transformed-data output with RStan 2.21.2. Trace how sampling output is captured and displayed; done means print() output from transformed data appears before the sampling message as shown in the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.