Audit finding
- ID:
AUD-025
- Status: Verified defect
- Severity: Medium
- Confidence: High
- Audited revision:
2f479320d805a1f9f35ebe4afaaeeded48913a94
Problem
On iteration exhaustion, ExpectationMaximization::Run() evaluates likelihood for currentParams, applies one final M-step, then returns the updated parameters with the old likelihood. A one-iteration call reports M(theta0) together with L(theta0).
Source:
|
EmParameters currentParams = initialParameters; |
|
float prevLogLikelihood = std::numeric_limits<float>::lowest(); |
|
float logLikelihood = std::numeric_limits<float>::lowest(); |
|
std::size_t iter = 0; |
|
bool converged = false; |
|
|
|
while (iter < maxIterations) |
|
{ |
|
const auto smootherOutput = smoother_.Smooth( |
|
{ currentParams.F, currentParams.H, currentParams.Q, currentParams.R }, |
|
observations, numSteps, |
|
currentParams.initialState, currentParams.initialCovariance); |
|
|
|
logLikelihood = smootherOutput.logLikelihood; |
|
++iter; |
|
|
|
if (math::Abs(logLikelihood - prevLogLikelihood) < convergenceTolerance) |
|
{ |
|
converged = true; |
|
break; |
|
} |
|
prevLogLikelihood = logLikelihood; |
|
|
|
currentParams = MStep(smootherOutput, observations, numSteps); |
|
} |
|
|
|
return EmResult{ currentParams, iter, logLikelihood, converged }; |
|
} |
|
|
Acceptance criteria
Audit finding
AUD-0252f479320d805a1f9f35ebe4afaaeeded48913a94Problem
On iteration exhaustion,
ExpectationMaximization::Run()evaluates likelihood forcurrentParams, applies one final M-step, then returns the updated parameters with the old likelihood. A one-iteration call reportsM(theta0)together withL(theta0).Source:
numerical-toolbox-cpp/numerical/estimators/offline/ExpectationMaximization.hpp
Lines 98 to 126 in 2f47932
Acceptance criteria