-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Bug]: Parsing error in modifiers/inference parameter (checking in bounds?) #380
Comments
@saraloo , just confirming that your ideal solution to this problem involves making it such that |
Thanks emily - yeah that would be ideal! I think all the other value parsing accepts this notation. Thanks :) |
Not sure if this is common knowledge or not, but I'm just going to delineate my diagnosis of the issue here: YAML files will correctly parse values input with E/scientific notation as
Therefore, the problematic line in the config you provided is the So, is it wrong to suggest that we should just stick to writing our modifiers with conventions that YAML parses correctly? Or is it important to you that we be able to write in E notation in whatever format? |
That is, all you would have to change to make this config work is add
|
At the very least, the parsing needs to clearly state the problem for users - just saying "know how to do it" is a bit harsh, as is the above error spam (I'm guessing The fix here could be either:
Feels like second solution is likely same amount of work as first, and is nicer? Also, does it handle E vs e? |
Ah interesting, thanks this is useful information. The yaml files were automatically generated using my config writer in R so this is just how R writes them. I managed to get around it by forcing R to print the full decimal by setting the option But i think a translation if possible would be helpful to avoid this, thanks Carl for the input. |
Okay, I can work at implementing a translation feature (my knee-jerk inclination is to insert an And yes, E is an equivalent (and therefore parse-able) substitution for e. |
@saraloo , I have another clarification question about how you would like the solution to this problem to look. I have written code for two different forms of solutions:
Let me know what you think! |
Thanks emily. I think it's fine for it to edit the config - as long as it seems to be able to cover all the cases and you've checked that the parsing is right. Either of these work, would be good to implement both i think. So 2 would check things are right in a check or something similar, and then in case anything gets through or if a check isn't done, then 1 should cover other cases. |
Okay lovely. I will implement both solutions more explicitly and then we can take a closer look. I think perhaps it would be not useful/would be redundant to implement both solutions (because they would be checking for the same type of specific error, not just general parsing errors in config values), but I'm not averse to doing so! |
FWIW I'm not a big fan of this solution. I think there could be unexpected consequences to doing this. A third solution I'll offer, that I don't like either per se but works well here, is adding a flepiMoP/flepimop/gempyor_pkg/src/gempyor/utils.py Lines 332 to 365 in f680be3
We would have to reimplement this scientific number parsing with GH-254 though if we went with this approach. |
@TimothyWillard What do you mean by reimplement this scientific number parsing? |
We would have to reimplement said scientific number parsing extension in |
A thing that might just work without doing anything is to force the cast as a float from confuse instead of the generic .get() in interence_parameters.py (see below). I think that might do the trick because it's not the first time we used scientific notation and it's the first time we have this error, so possibly it's just this code is not casting enough these things. self.add_single_parameter(
ptype=ptype,
pname=pname,
subpop=sp,
pdist=parameter_config["value"].as_random_distribution(),
lb=parameter_config["value"]["a"].get(),
ub=parameter_config["value"]["b"].get(),
) |
Label
bug, gempyor, inference, quick issue
Priority Label
low priority
Describe the bug/issue
There is a parsing error in calibrate/inference_parameter when modifiers (not sure if it's just in the
check_in_bound
function or also in parsing the whole parameter) are in E-notation. Config works by removing this notation so it's just a parsing error.To Reproduce
Config: https://github.com/HopkinsIDD/RSV_USA/blob/fb7883eae7e52cb581cfc279a0978cc4b9152c7d/config_rsvnet_2024_1_emcee.yml
With notation where modifier is defined as
I get the error:
Environment, if relevant
No response
The text was updated successfully, but these errors were encountered: