-
Notifications
You must be signed in to change notification settings - Fork 89
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
support for truncated normal distribution #188
Conversation
Hello @mfeurer , what do you think about this PR? We found it extremely useful to have hyper-parameters with normal distribution and boundary constraints. |
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 @pbalapra, @Deathn0t
These changes look good and don't intrude on any current functionality. However I think tests are much required for this to ensure it works correctly in all cases. Some interesting test cases which should be tested against:
- How do both of these act when
upper == lower
, are they both inclusive bounds or exclusive? - I assume from your usage, the quantization and transforming to uniform works but we would needs tests to confirm that this functionality will always work as intended.
I think the main doc string for both classes could do with a simple line describing that bounds can be set. You can see how the docstrings are rendered here.
…d border case, correcting representation
Hello @eddiebergman, I think I took into consideration all your comments. I added the test in the |
Codecov Report
@@ Coverage Diff @@
## master #188 +/- ##
==========================================
- Coverage 68.22% 66.33% -1.89%
==========================================
Files 18 17 -1
Lines 1775 1613 -162
==========================================
- Hits 1211 1070 -141
+ Misses 564 543 -21
Continue to review full report at Codecov.
|
Hi @Deathn0t, All looks good to me, thanks for adding the tests! The only last small change required is that one of the tests You can either manually fix this and push, I'll rerun the tests and you can see if anything else needs to be fixed. Alternatively, to run this check locally.
You can also just use a @mfeurer if you want to have a final look, please do, otherwise I'm happy with the changes. |
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.
Hey, thanks a lot for the PR. I just also had a look and think there are a few things missing:
- test for sampling from the truncated normal distribution
- you need to adapt the get_neighbors functions to take the bounds into account as well
- please also see my inline comments
self.assertEqual( | ||
"param, Type: NormalFloat, Mu: 5.0 Sigma: 10.0, Range: [0.1, 10.0], Default: 5.0, on log-scale, Q: 0.1", str(f6)) | ||
|
||
self.assertNotEqual(f1, f2) |
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 is new duplicated.
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 am sorry, I don't see the duplicated? I followed the previous test cases with f4, f4_
which was already there.
Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>
I added this test for the sampling:
|
Hello @mfeurer and @eddiebergman, I think I answered all the comments. While editing the I was not able to find a documentation of the expected behaviour for this function. |
Hello, any update on this @eddiebergman @mfeurer? |
Hi @Deathn0t, Sorry for the delay and thanks for pinging us again on it. I reviewed the PR and I am happy with the changes. @mfeurer will be available later this week or next and I don't want to merge without a final look over by him. Apologies again for this delay. In the meantime I dug a little deeper and there are some discussion points if you'd like to have a future say in how we handle some inconsistencies you brought to our attention.
|
Hello @eddiebergman @mfeurer sorry to ping you again about this PR but do you know when it could be integrated? I am wondering if I should fork and build a different wheel or wait for the integration. @eddiebergman I did not have time to think very deeply about the neighbour generation but for truncated normal we could also directly sample from the truncated distribution instead of applying the |
Adding support for truncated normal distribution for NormalIntegerHyperparameter and NormalFloatHyperparameter with lower and upper bound.