Skip to content

[ML] Impose an absolute cutoff on the minimum variance #8

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 2 commits into from
Mar 8, 2018
Merged

[ML] Impose an absolute cutoff on the minimum variance #8

merged 2 commits into from
Mar 8, 2018

Conversation

edsavage
Copy link
Contributor

@edsavage edsavage commented Mar 8, 2018

[ML] To avoid overflow when calculating lgamma values an absolute cutoff on the minimum variance, based on the offset, is imposed.

fixes #488

… to avoid overflow when calculating lgamma values
Copy link
Contributor

@tveasey tveasey left a comment

Choose a reason for hiding this comment

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

I'm going to approve subject to the requested change: I don't need to review this again. Thanks for debugging this Ed!

@@ -306,7 +306,8 @@ void BICGain(maths_t::EDataType dataType,
double a = square(m + offset) / v;
double b = (m + offset) / v;

double vmin = std::min(MIN_RELATIVE_VARIANCE * v, MIN_ABSOLUTE_VARIANCE);
double vmin = std::max(std::min(MIN_RELATIVE_VARIANCE * v, MIN_ABSOLUTE_VARIANCE),
square(MIN_RELATIVE_VARIANCE * offset));
Copy link
Contributor

@tveasey tveasey Mar 8, 2018

Choose a reason for hiding this comment

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

I think this is exactly the right idea to fix this issue. To be consistent we probably shouldn't square MIN_RELATIVE_VARIANCE, i.e. this should be MIN_RELATIVE_VARIANCE * square(offset) so we are saying a lower bound on the variance should be the offset^2 we apply. I think the clearest way to indicate this intention is std::min(MIN_RELATIVE_VARIANCE * std::max(v, square(offset)), MIN_ABSOLUTE_VARIANCE).

@edsavage edsavage merged commit 327cbc9 into elastic:master Mar 8, 2018
@edsavage edsavage deleted the memlimit_rm_attributes_job branch March 8, 2018 17:55
@sophiec20 sophiec20 changed the title Impose an absolute cutoff on the minimum variance [ML] Impose an absolute cutoff on the minimum variance Mar 28, 2018
@sophiec20 sophiec20 added the :ml label Apr 4, 2018
droberts195 pushed a commit that referenced this pull request Apr 23, 2018
Impose an absolute cutoff on the minimum variance based on the offset to avoid overflow when calculating lgamma values

fixes #488
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.

3 participants