Skip to content

[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

Merged
merged 6 commits into from
Apr 2, 2020

Conversation

tveasey
Copy link
Contributor

@tveasey tveasey commented Apr 2, 2020

In particular, it more reliably stops non-finite inputs polluting the model.

@@ -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) ||
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants