-
Notifications
You must be signed in to change notification settings - Fork 2
fix x range when evaluating curves in sample function #11
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
Conversation
windisch
left a comment
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.
Good catch - looks good to me. Just a bit worried about complexity due to code duplicates. Added a suggestion - freel free to explore this further!
driftbench/data_generation/sample.py
Outdated
| # Apply some random noise on the base values | ||
| x0 = base_latent_information.x0 + rng.normal(size=len(base_latent_information.x0), scale=x_scale) | ||
| y0 = base_latent_information.y0 + rng.normal(size=len(base_latent_information.y0), scale=y_scale) | ||
| x0 = base_latent_information.x0 + rng.normal( |
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.
Any idea to remove the code duplicates? We already had them, but now it gets more nasty...
One idea may be to have a latent dict which keys y0, x1, like:
latent["x0"] = getattr(base_latent_information, 'x0') + rng.normal(
size=len(getattr(base_latent_information, 'x0')), scale=scale["x"]
)What do you think?
|
@windisch Followed your suggestion, looks cleaner now. May also think about changing |
| y2 = base_latent_information.y2 + rng.normal(size=len(base_latent_information.y2), scale=y_scale) | ||
| latent_information.append(LatentInformation(y0, x0, y1, x1, y2, x2)) | ||
| latent_dict = {} | ||
| for xi in xis: |
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.
this may could also be a single for loop :-)
for v in xis+yis:with x_scale and y_scale somehow accessed via v[0] and
scale = {'x': x_scale, 'y': y_scale}But fine for me for now!
Done in this PR
x_iinsample_curveswere considered for the evolution x range.