Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warnings from the engine -- new feature #189

Open
stevencarlislewalker opened this issue Mar 29, 2024 · 2 comments
Open

warnings from the engine -- new feature #189

stevencarlislewalker opened this issue Mar 29, 2024 · 2 comments
Assignees

Comments

@stevencarlislewalker
Copy link
Member

stevencarlislewalker commented Mar 29, 2024

A discussion at a macpan tech meeting about when to round variables that should be integers (e.g. state variables in some models with process error) led to the idea that we should have a warning system for the engine. The standard Rf_warning mechanism is annoying in TMB because it will get called at each of the (5?) steps of the MakeADFun machinery and for each time step. Here is a design that addresses this issue and makes it straightforward to provide information about what time-step and expression was involved in the warning.

  1. Define an enum of distinct warning messages.
  2. When a warning is triggered it pushes back one int into each of the following vectors:
    • warn_msg_int : value of the enum for the triggered warning
    • warn_row : parse table row
    • warn_time : time step
  3. These vectors are placed in the report.
  4. On the r-side we can interpret every element of these vectors:
    • warn_msg_int -> character vector of warning messages
    • warn_row -> vector of expressions as characters (e.g. "x ~ round(0.5)")
    • warn_time -> unaltered vector of time-steps
  5. Summarise this 'warning table' so that the time column is a string representing time-step ranges (e.g. "1, 5-10"), which would keep the table from being too long in models with many time-steps.
  6. When this interpreted and summarised warning table has more than zero rows, throw a warning that prints the table.
@stevencarlislewalker stevencarlislewalker self-assigned this Mar 29, 2024
@bbolker
Copy link
Collaborator

bbolker commented Mar 29, 2024

This seems like a good idea. It's too bad that we're working within C++ instead of R here; in R we could more easily write functions that modify their environments to warn only once in a session (as discussed by you in a recent lab meeting I think?)

I'm trying to think of alternative ways to achieve this goal without writing our own warning system ...

@stevencarlislewalker
Copy link
Member Author

This is a great point. Can we get any inspiration from glmmTMB here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔖 Ready
Development

No branches or pull requests

2 participants