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

Update owrandomdata.py #164

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Update owrandomdata.py #164

merged 2 commits into from
Jan 17, 2024

Conversation

jcmhk
Copy link
Contributor

@jcmhk jcmhk commented Dec 4, 2023

I forgot to change ParameterDef("High bound", "scale", 1, any_float) to ParameterDef("Range", "scale", 1, any_float) in my last pull request

Issue
Description of changes
Includes
  • Code changes
  • Tests
  • Documentation

I forgot to change ParameterDef("High bound", "scale", 1, any_float)
to  ParameterDef("Range", "scale", 1, any_float) in my last pull request
@jcmhk
Copy link
Contributor Author

jcmhk commented Dec 4, 2023

I forgot to change ParameterDef("High bound", "scale", 1, any_float) to ParameterDef("Range", "scale", 1, any_float) in my last pull request

@janezd
Copy link
Collaborator

janezd commented Dec 8, 2023

Thank you for this! Apparently nobody ever noticed that the interval is wrong.

I would suggest a change, though. For me, it seems more intuitive (from the user perspective) to specify the interval boundaries rather than the lower bound and the range. So I would keep the interface, but fix the code behind.

On the first glance, it should suffice to just replace rvs = stats.uniform.rvs with

    @staticmethod
    def rvs(loc, scale, size):
        return stats.uniform.rvs(loc, scale - loc, size=size)

and leave everything else as it was before. But please check that this is indeed the case -- I haven't tried it.

We should, in principle, also rename loc and scale to, say, lower and upper, but then any saved workflows with old names would stop working unless we add the migration code ... and I don't think its worth the effort, so we could just keep the existing (though wrong names).

So, I would just ask you to try the above code snippet instead of your fix -- and, of course, change it if necessary.

Once again thanks for spotting this and suggesting a fix.

@jcmhk
Copy link
Contributor Author

jcmhk commented Dec 8, 2023

Hello,
I am going to try

@jcmhk
Copy link
Contributor Author

jcmhk commented Dec 12, 2023

I just tested your solution, it solves the problem. Thank you so much

@janezd janezd merged commit 8379be3 into biolab:master Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants