Skip to content

laplace_sample service console output has too many newlines #3151

Description

@mitzimorris

Summary:

The console output of the laplace_sample method contains hundreds of blank lines.

Description:

This arises from two things:

To fix the former, remove newlines.
To fix the latter, check the stringstream before calling the logger.

 model.write_array(rng, unc_draw, draw_vec, include_tp, include_gq, &write_array_msgs);
    if (refresh > 0) {
      if (write_array_msgs.peek() != std::char_traits<char>::eof())
        logger.info(write_array_msgs);

Reproducible Steps:

Use CmdStan branch https://github.com/stan-dev/cmdstan/tree/feature/1123-laplace-approx to invoke the laplace_sample method, model and input files are in the src/test/test-models/ directory.

>  src/test/test-models/multi_normal_model laplace mode=src/test/test-models/multi_normal_mode.csv

Current Output:

the beginning of the console ouput from call to laplace_sample - refresh is default 100, so lots of whitespace between iteration messages.

Calculating Hessian




Calculating inverse of Cholesky factor


Generating draws


iteration: 
0





Expected Output:

Calculating Hessian
Calculating inverse of Cholesky factor
Generating draws
iteration: 0
iteration: 100
iteration: 200
iteration: 300
iteration: 400
iteration: 500
iteration: 600
iteration: 700
iteration: 800
iteration: 900

Additional Information:

Provide any additional information here.

Current Version:

v2.30.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions