Invntr
Source

All instruments

fit

Nonlinear least-squares fit of a model to measured data (Levenberg-Marquardt and trust-region, SciPy, exact complex-step derivatives, tolerances at machine precision): parameters, standard errors from s^2 (J^T J)^-1, residual sum of squares, residual standard deviation, predictions at given x. Files: fit.csv (x, y, fitted, residual), fit.png (data, curve, residuals). `converged` is true only when the solution passes its checks (stop reason, gradient, conditioning, finite errors); otherwise `warnings` says why.

Field
Measurement and data
Version
0.2.0
Runs as
Compiled (Rust)
Typical run
2 s

Compiled from source: run sh packs/install.sh once before admitting it.

Known answers it must pass

Admission replayfit 0.2.0 · files b6522d3b8691…126f
  1. r0001exact data y = 3 exp(-0.5 x) + 1 from a poor start: parameters recovered to 1e-9, RSS 0passed

    params.a{"value": 3, "rel_tol": 1e-09}
    params.k{"value": 0.5, "rel_tol": 1e-09}
    params.c{"value": 1, "rel_tol": 1e-09}
    rss≤ 1e-203.9443e-31lockedinside the range
  2. r0002straight line against the ordinary-least-squares formulas: slope 1.99 (SE 0.0597216), intercept 0.05 (SE 0.198074), RSS 0.107, prediction 11.99 at x = 6passed

    params.b1{"value": 1.99, "rel_tol": 1e-09}
    params.b0{"value": 0.05, "rel_tol": 1e-07}
    std_errors.b1{"value": 0.0597215762, "rel_tol": 1e-06}
    std_errors.b0{"value": 0.1980740602, "rel_tol": 1e-06}
    rss0.107 ± 1.1e-100.107lockedunder 0.01 % of the tolerance used
    predictions.6{"value": 11.99, "rel_tol": 1e-09}
  3. r0003a saturated start is caught: a exp(-k x) from k = 60 with lm alone must not be reported convergedpassed

    converged= falsefalselockedexact match
3 of 3 cases passed · sandbox macos-seatbeltrecorded from the kernel in a fresh lab

Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.

Inputs

NameUnitDefaultMeaning
csvData with a header row.
dataInline CSV text, used when csv is not given.
xPredictor column. Default: the first column.
yResponse column. Default: the second column.
modelExpression in x and the parameters, e.g. "b1*(1-exp(-b2*x))". ^ is a power. Functions: exp, log, log10, sqrt, sin, cos, tan, tanh, arctan, abs, pi, e.
paramsParameter names and starting values, e.g. {"b1": 1, "b2": 1}.
methodautoauto: Levenberg-Marquardt and trust-region, keep the better trustworthy fit. lm, trf, dogbox: one method.
max_evaluations20000
predictx values at which to report the fitted model.
title

Readings

NameUnitMeaning
params
std_errors
rss
residual_sd
dof
converged
predictions
fit.csv
fit.png
warnings
condition
method

Try the call

Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.

Terminal
MCP call