Pure MoonBit dense nonlinear least-squares with robust losses and convergence diagnostics
Dependencies
moon update
moon check --target all --deny-warn
moon build --target all --deny-warn
moon test --target all --deny-warn
moon run examples/demo --target native
moon run examples/demo --target js
moon run examples/demo --target wasm-gc
moon run examples/benchmark --target nativelet data = [
@fit.observation(0.0, 1.0),
@fit.observation(1.0, 3.0),
@fit.observation(2.0, 5.0),
]
let result = @fit.fit_curve(@fit.linear_model(), data, [
@fit.parameter("intercept", 0.0),
@fit.parameter("slope", 0.0),
]).unwrap()
assert_true(result.fit.termination.converged())moon run cmd/curvefit --target native -- models
moon run cmd/curvefit --target native -- fit-json examples/data/calibration.json markdown
moon run cmd/curvefit --target native -- fit-json examples/data/bounded.json json
moon run cmd/curvefit --target native -- fit-csv linear examples/data/calibration.csv auto svgpython -m venv .venv
# Activate the environment using your shell's normal activation command.
python -m pip install numpy==2.4.6 scipy==1.17.1
python tools/differential.pyInstall
Download zipPure MoonBit dense nonlinear least-squares with robust losses and convergence diagnostics
Dependencies