Skip to content

Commit 741c08d

Browse files
authored
[6.4][ML] Trap zero variance in forecast confidence interval calculation causing error to be logged (#120)
1 parent d167f11 commit 741c08d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/CHANGELOG.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ new processes being created and macOS uses the sandbox functionality ({pull}98[#
3636

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

4041
=== Regressions
4142

lib/maths/CTrendComponent.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ double scaleTime(core_t::TTime time, core_t::TTime origin) {
5656

5757
//! Get the \p confidence interval for \p prediction and \p variance.
5858
TOptionalDoubleDoublePr confidenceInterval(double prediction, double variance, double confidence) {
59+
if (variance == 0.0) {
60+
return std::make_pair(prediction, prediction);
61+
}
5962
try {
6063
boost::math::normal normal{prediction, std::sqrt(variance)};
6164
double ql{boost::math::quantile(normal, (100.0 - confidence) / 200.0)};

0 commit comments

Comments
 (0)