-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix dtypes related to floating point precision #254
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Scienfitz, thanks for the PR. Here a few comments to discuss
7946692
to
b735ef2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last few comments, I hope 🙃
baybe/simulation/lookup.py
Outdated
# could also be implemented for approximate matches | ||
elif isinstance(lookup, pd.DataFrame): | ||
# Enforce correct float precision in the lookup dataframe | ||
float_cols = lookup.select_dtypes(include=["float"]).columns | ||
lookup[float_cols] = lookup[float_cols].astype(DTypeFloatNumpy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is problematic since you mutate the incoming object, i.e. this will also affect the object outside the scope of this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok changed it and also moved to simulate_experiment
where it creates a copy before modifying, this should also do the modifications fewer times which possibly affects speed
Since floating point precision can be controlled via env vars (#226) various problems have surfaced letting tests fail in single precision.
This PR fixes those. They were mostly related to the way
values
andcomp_df
were created for parameters,selection
was treated inSubSelectionCondition
and alookup
in a different float precision being used in a simulation.The only remaining issues with test in single precision are numerical instabilities (out of scope)