stan-dev / stan-dev/rstan

MCMC sampling messages not displayed in JupyterLab

Open
#559 1 comment 4 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:

MCMC sampling progress messages are not displayed in JupyterLab or Jupyter Notebook.
Although the issue is actually caused by Jupyter, redirecting the stdout messages of Stan to the R streams could be a workaround solution.

Description:

Currently Jupyter does not capture OS-level output, this problem is not fixed for 2 years (see IRkernel/IRkernel#416 and jupyter/enhancement-proposals#14). As a consequence, the MCMC sampling messages of Stan are not shown in JupyterLab or Jupyter Notebook.

It is suggested that redirecting the stdout messages to the R streams could solve the problem (see IRkernel/IRkernel#584).

Update:

Sampling messages are displayed when mc.cores = 1 .

Reproducible Steps:

Run any model

Current Output:

No output

Expected Output:

Something like this:

SAMPLING FOR MODEL 'x' NOW (CHAIN 1).

Iteration:     1 / 50500 [  0%]  (Warmup)
Iteration:   501 / 50500 [  0%]  (Sampling)
Iteration:  5550 / 50500 [ 10%]  (Sampling)
Iteration: 10600 / 50500 [ 20%]  (Sampling)
Iteration: 15650 / 50500 [ 30%]  (Sampling)
Iteration: 20700 / 50500 [ 40%]  (Sampling)
Iteration: 25750 / 50500 [ 50%]  (Sampling)
Iteration: 30800 / 50500 [ 60%]  (Sampling)
Iteration: 35850 / 50500 [ 70%]  (Sampling)
Iteration: 40900 / 50500 [ 80%]  (Sampling)
Iteration: 45950 / 50500 [ 90%]  (Sampling)
Iteration: 50500 / 50500 [100%]  (Sampling)

 Elapsed Time: 0.00354 seconds (Warm-up)
               0.273752 seconds (Sampling)
               0.277292 seconds (Total)
RStan Version:

2.17.3

R Version:

R version 3.5.1 (2018-07-02)

Operating System:

Ubuntu 18.04.1

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 by reproducing any model in JupyterLab or Jupyter Notebook with the default parallel sampling, then compare it with mc.cores = 1, where messages are displayed. Review the referenced IRkernel#416, IRkernel#584, and Jupyter enhancement proposal to understand the stdout and R-stream handling; done means sampling progress and elapsed-time messages appear in the notebook.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, jupyter-notebook, r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.