metrumresearchgroup / bbr.bayes

Bayesian modeling with BBR
https://metrumresearchgroup.github.io/bbr.bayes/
Other
5 stars 1 forks source link

nmbayes: add custom methods for tailored errors #126

Closed kyleam closed 9 months ago

kyleam commented 9 months ago

On nmbayes models, cov_cor() and nm_file() fail with messages about not being able to find the expected files in the top-level directory. Neither of these map simply onto the nmbayes submodel structure. Define custom methods to get slightly more informative errors (at least until we have a clearer vision of something that either of these should do).

Re: #36

kyleam commented 9 months ago

Example output:

> tail_output(m2)

── Chain 1 ───────────────────────────────────────────────────────────────────────────────────────────────────────
License Registered to: Metrum Research Group
Expiration Date:    14 JUL 2024
Current Date:       14 FEB 2024
...

 #TBLN:      1
 #METH: MCMC Bayesian Analysis

 ESTIMATION STEP OMITTED:                 NO

── Chain 2 ───────────────────────────────────────────────────────────────────────────────────────────────────────
License Registered to: Metrum Research Group
Expiration Date:    14 JUL 2024
Current Date:       14 FEB 2024
...

 #TBLN:      1
 #METH: MCMC Bayesian Analysis

 ESTIMATION STEP OMITTED:                 NO
> tail_lst(m2)

── Chain 1 ───────────────────────────────────────────────────────────────────────────────────────────────────────
Wed Feb 14 07:57:16 EST 2024
$PROBLEM From bbr: see 1101.yaml for details

...
 Elapsed postprocess time in seconds:     5.28
 Elapsed finaloutput time in seconds:     0.14
 #CPUT: Total CPU Time in Seconds,       14.601
Stop Time:
Wed Feb 14 07:57:53 EST 2024

── Chain 2 ───────────────────────────────────────────────────────────────────────────────────────────────────────
Wed Feb 14 07:57:16 EST 2024
$PROBLEM From bbr: see 1101.yaml for details

...
 Elapsed postprocess time in seconds:     5.21
 Elapsed finaloutput time in seconds:     0.24
 #CPUT: Total CPU Time in Seconds,       14.630
Stop Time:
Wed Feb 14 07:57:53 EST 2024
seth127 commented 9 months ago

@kyleam what do you think about creating a build_path_from_model.bbi_nmbayes_model method that acts as it does now, but messages something like "build_path_from_model() does not build paths to files in chain directories. Consider using chain_paths() instead."?

Given the all of the nuance captured in https://github.com/metrumresearchgroup/bbr/issues/618, I don't think we're ready to implement a real method for that, but users might find a message like that helpful. Or do you think it's more likely to just be noisy and annoy people?

kyleam commented 9 months ago

I said:

Example output:

Bah, I meant to post that in gh-127

kyleam commented 9 months ago

@kyleam what do you think about creating a build_path_from_model.bbi_nmbayes_model method that acts as it does now, but messages something like "build_path_from_model() does not build paths to files in chain directories. Consider using chain_paths() instead."?

On reading your suggestion, my initial worry was that there would be some legit internal calls in the bbr.bayes or bbr code bases that would lead to confusing messages, but, quickly grepping, I don't spot any uses that I think would trigger that. So, I think it's more likely to help than annoy. (I can't see a case where an end user would want to use build_path_from_model on a nmbayes model.) I'll plan to add that. Thanks.

kyleam commented 9 months ago

build_path_from_model method with message pointing to chain_paths added with faa3859.

kyleam commented 9 months ago

build_path_from_model method with message pointing to chain_paths added with faa3859.

Will merge now, but @seth127 if you take a look at the new method and have any comments, please let me know.