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

Repeated warning for increasing max_s #23

Open
Tracked by #34
fredjaya opened this issue Nov 27, 2023 · 2 comments
Open
Tracked by #34

Repeated warning for increasing max_s #23

fredjaya opened this issue Nov 27, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@fredjaya
Copy link
Collaborator

When intentionally running:

optimise_sN_prevalence(
    prevalence = 0.01, 
    cost_unit = 5, 
    cost_pool = 10,
    cost_cluster = 20,
    correlation = 0.05,
    max_s = 5
)

The following message is returned:

$s
[1] 5

$cost
[1] 0.1495472

$catch
[1] 10

$N
[1] 2

Warning messages:
1: In optimise_s_prevalence(pool_number = Nopt + 1, prevalence, cost_unit,  :
  Maximum cost effectivness is achieved at or above the maximum size of pools allowed. Consider increasing max_s
2: In optimise_sN_prevalence(prevalence = 0.01, cost_unit = 5, cost_pool = 10,  :
  Maximum cost effectivness is achieved at or above the maximum size of pools allowed. Consider increasing max_s

The same warning is defined twice separately, once in optimise_sN_prevalence() and once in optimise_s_prevalence(). I have tried different parameters and if max_s is reached, the optimise_s_prevalence() warning is thrown at least once, and the sN warning only occasionally.

Options are to:

  1. Find parameters that only throw the optimise_sN_prevalence warning
  2. Change the optimise_sN_prevalence message to make catching the warning easier (i.e. tell apart from the optimise_s_prevalence warning
  3. Remove the sN warning completely

Thoughts, Angus?

@fredjaya fredjaya assigned fredjaya and AngusMcLure and unassigned fredjaya Nov 27, 2023
@fredjaya
Copy link
Collaborator Author

Possibly useful resources for testing:

https://testthat.r-lib.org/reference/expect_snapshot.html

@AngusMcLure
Copy link
Owner

AngusMcLure commented Dec 4, 2023

Easiest might be to remove the optimise_sN_prevalence() warning entirely. However as optimise_sN_prevalence() calls optimise_s_prevalence() repeatedly, the latter might issue the warning multiple times. This is not ideal --- it would be nicer to just have one warning from optimise_sN_prevalence(). If it's possible to catch the warnings from optimise_s_prevalence() and then use this warning to trigger a single warning for optimise_sN_prevalence that would be kind of neat, but if it's not easy, it's not worth it for now.

So in summary, I suggest taking the easy option (remove the warning from optimise_sN_prevalence()) for now, but leave this issue open as a low-priority enhancement for later.

@AngusMcLure AngusMcLure assigned fredjaya and unassigned AngusMcLure Dec 4, 2023
@fredjaya fredjaya added the tests label Dec 5, 2023
@fredjaya fredjaya added this to the v0.1.2 milestone Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants