Skip to content

Nicer output for tp_run() - #31

Merged
elegios merged 10 commits into
treeppl:mainfrom
foersterst:tidy-output
Oct 7, 2026
Merged

elegios merged 10 commits into
treeppl:mainfrom
foersterst:tidy-output

Conversation

@foersterst

@foersterst foersterst commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

tp_run() used to return a list built directly from the output JSON via jsonlite. That list was long and hard to read, and it always needed a tp_parse…() call afterward to become usable. This PR changes that. Now, tp_run() returns a tidy data frame produced by tp_parse_smc() or tp_parse_mcmc(), called internally for any model those two functions support (models that return trees still need dedicated parsers, which we haven't built yet).

tp_run() picks the right parser automatically, based on the inference method and model passed to tp_compile(). It reads that information from the sampler and decides which parser to call. For models without a parser yet, it returns the path to the output JSON along with a message instead.

The PR also updates the documentation for all functions involved.


TreePPL Release Notes

Added

  • At the end of a run, tp_run() now prints a summary with runtime information and output directories/files.
  • New argument wide in tp_parse_smc() and tp_parse_mcmc() to choose between wide (standard in other software) and long (good for plotting) format. Default = TRUE.

Changed

  • tp_run() now returns a tidy data frame (in wide format by default) instead of a list. It automatically calls tp_parse_smc() or tp_parse_mcmc(), depending on the inference method and model passed to tp_compile(). For models without a parser yet (e.g., models that return trees), it returns the path to the output JSON file along with a message.
  • tp_parse_smc() and tp_parse_mcmc() now take a character vector with the path(s) to the JSON output file(s) instead of the list returned by tp_run().
  • tp_mcmc_convergence() and tp_smc_convergence() now accept data frames in either long or wide format.

Deprecated

Removed

Fixed

Security

@elegios
elegios merged commit a5f0156 into treeppl:main Oct 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants