Skip to content

[6.4][ML] Trap zero variance in forecast confidence interval calculation causing error to be logged #120

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 1 commit into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ new processes being created and macOS uses the sandbox functionality ({pull}98[#

Age seasonal components in proportion to the fraction of values with which they're updated ({pull}88[#88])
Persist and restore was missing some of the trend model state ({pull}#99[#99])
Stop zero variance data generating a log error in the forecast confidence interval calculation ({pull}#107[#107])

=== Regressions

Expand Down
3 changes: 3 additions & 0 deletions lib/maths/CTrendComponent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ double scaleTime(core_t::TTime time, core_t::TTime origin) {

//! Get the \p confidence interval for \p prediction and \p variance.
TOptionalDoubleDoublePr confidenceInterval(double prediction, double variance, double confidence) {
if (variance == 0.0) {
return std::make_pair(prediction, prediction);
}
try {
boost::math::normal normal{prediction, std::sqrt(variance)};
double ql{boost::math::quantile(normal, (100.0 - confidence) / 200.0)};
Expand Down