Skip to content
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

[ML] Fix potential use of unintialised value when minimising lowess regression function #2268

Merged
merged 2 commits into from
May 16, 2022
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
2 changes: 2 additions & 0 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
classification and regression models. (See {ml-pull}2259[#2259].)
* Fix edge case which could cause the model bounds to blow up after detecting seasonality.
(See {ml-pull}2261[#2261].)
* Fix cause of "Must provide points at which to evaluate function" log error training
classification and regression models. (See {ml-pull}2268[#2268].)

== {es} version 8.2.0

Expand Down
8 changes: 6 additions & 2 deletions include/maths/common/CLowessDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,17 @@ typename CLowess<N>::TDoubleDoublePr CLowess<N>::minimum() const {
double range{(xb - xa) / static_cast<double>(X.size())};
xa = std::max(xa, xmin - 0.5 * range);
xb = std::min(xb, xmin + 0.5 * range);
if (xa == xb) {
return {xmin, fmin};
}

double dx{2.0 * (xb - xa) / static_cast<double>(X.size())};
X.clear();
for (double x = xa; x < xb; x += dx) {
X.push_back(x);
}
double xcand;
double fcand;
double xcand{xmin};
double fcand{fmin};
CSolvers::globalMinimize(
X, [this](double x) -> double { return this->predict(x); }, xcand, fcand, fsd);

Expand Down