Skip to content

options.errorTolerance doesn't recognize function minimum #41

Open
@MontyThibault

Description

@MontyThibault

I ran into a problem and had to make a source modification for the convergence criteria. The currently-implemented convergence criterion operates in absolute terms of the squared residuals. Real data sets with noise may have a minimal curve with an arbitrarily-large error, and convergence in those cases will not be recognized.

https://github.com/mljs/levenberg-marquardt/blob/master/src/index.js#L106

I modified the convergence criteria to be the relative change based on the previous error, as described here: https://en.wikipedia.org/wiki/Non-linear_least_squares#Convergence_criteria.

...

error = errorCalculation(
      data,
      parameters,
      parameterizedFunction,
      weightSquare,
    );

converged = (previousError - error) / error <= errorTolerance;  // <<<

if (isNaN(error)) break;

...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions