-
Notifications
You must be signed in to change notification settings - Fork 65
[ML] Improve bad input handling in distribution models #1114
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
@@ -577,10 +577,11 @@ class CLogSampleSquareDeviation : core::CNonCopyable { | |||
result = 0.0; | |||
for (std::size_t i = 0u; i < m_Samples.size(); ++i) { | |||
double residual = m_Samples[i]; | |||
if (residual <= 0.0) { | |||
double n = maths_t::countForUpdate(m_Weights[i]); | |||
if (residual <= x || !CMathsFuncs::isFinite(residual) || |
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.
Was it intentional to change <= 0.0
to <= x
?
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.
Yes. This is actually was actually a bug I spotted while working on this. It causes us to discard a small number of sample we shouldn't be.
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.
Although, related tests have failed, so let me double check this.
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 got the new condition wrong as well :(. Corrected.
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.
LGTM
In particular, it more reliably stops non-finite inputs polluting the model.