numra-fit 0.1.0

Curve fitting for Numra: nonlinear least squares (Levenberg-Marquardt), weighted fits, polynomial fit and evaluation.
Documentation

numra-fit

Curve fitting for the Numra workspace — nonlinear least squares (Levenberg-Marquardt), weighted fits, polynomial fit and evaluation.

Crates.io docs.rs

Fit arbitrary y = f(x, params) models against data using numra-optim's Levenberg-Marquardt under the hood, with optional analytical Jacobians (paired naturally with numra-autodiff) and weighted residuals. Polynomial fits use numra-linalg's SVD for stability on ill-conditioned Vandermonde matrices.

Example

use numra_fit::curve_fit;

// Fit y = a · exp(-b · x) to noisy decay data
let x = vec![0.0, 1.0, 2.0, 3.0, 4.0, 5.0];
let y = vec![5.0, 3.03, 1.84, 1.11, 0.67, 0.41];

let r = curve_fit(
    |x: f64, p: &[f64]| p[0] * (-p[1] * x).exp(),
    &x, &y,
    &[4.0, 0.3],
    None,
).unwrap();

assert!((r.params[0] - 5.0).abs() < 0.1);
assert!((r.params[1] - 0.5).abs() < 0.1);

What's in this crate

  • curve_fit — nonlinear least squares for y = f(x, params)
  • curve_fit_weighted — weighted residuals for heteroscedastic data
  • curve_fit_with_jacobian — supply an analytical Jacobian for faster, more accurate fits
  • polyfit — degree-n polynomial regression
  • polyval — evaluate a polynomial at given points
  • FitOptions / FitResult — configuration and post-fit diagnostics (parameters, R², residuals)
  • FitError — fit-failure reporting

Composes with

  • numra-optim — Levenberg-Marquardt backend
  • numra-autodiff — analytical Jacobians for residual functions
  • numra-linalg — SVD-based polynomial regression
  • numra-stats — post-fit residual statistics and goodness-of-fit checks
  • numra-ocp — alternative path for fitting ODE-model parameters when the residual involves an ODE integration

See interop workflows for the verified autodiff → optim → curve-fit workflow.

Install

[dependencies]
numra-fit = "0.1"

Or via the umbrella crate:

[dependencies]
numra = "0.1"

Documentation

License

Numra Academic & Research License (Non-Commercial). Academic and research use is free; commercial use requires a separate license — contact contact@spectralautomata.com. See LICENSE.