phjphj676/moon-online-models is a native MoonBit toolkit for applications
that learn from events continuously: CTR/risk scoring, device telemetry,
incremental forecasting, ranking, feature streams, and model monitoring. It
is the acceptance version of the August 2026 MoonBit Hackathon project.
Evaluation and safety: exact and histogram AUC, calibration, regression and
ranking metrics, conformal intervals, drift detectors, fairness gaps,
cost-sensitive thresholds, validation, gradient/prediction guards.
Operations: model snapshots and checksums, registry and deployment state
transitions, canary experiments, serving batchers, SLO/error budgets,
alerts, audit trails, data lineage, privacy budgets, and reproducibility
manifests.
The implementation is deliberately dependency-light: the root package only
uses moonbitlang/core/math and moonbitlang/core/json. Public state is
bounded where a stream can grow without limit; callers can inspect counters,
reset state, and reject malformed dimensions at the boundary.
Install
moon add phjphj676/moon-online-models
Minimal example
let model = @moon-online-models.AdagradLogisticRegression::new(
3,
learning_rate=0.1,
)
model.update([1.0, 0.0, 0.2], 1.0)
model.update([0.0, 1.0, -0.2], 0.0)
let probability = model.predict([1.0, 0.0, 0.2])
For sparse CTR-style features:
let hasher = @moon-online-models.FeatureHasher::new(1_000_000)
let features = hasher.encode(["country=CN", "device=mobile", "slot=home"])
let model = @moon-online-models.SparseAdagradClassifier::new(1_000_000)
model.update(features, 1.0)
let probability = model.predict(features)
Verification
Run the same checks locally that the repository CI runs:
moon version --all
moon update
moon check --target all
moon test --target all
moon fmt && git diff --exit-code
moon info && git diff --exit-code
The local wasm-gc test suite contains 16 boundary and behavior scenarios;
the native benchmark trains 20,000 deterministic events and records its
measured output in benchmarks/RESULTS.md. Re-run
it with benchmarks/run.ps1 on the acceptance machine.
moon-online-models
phjphj676/moon-online-modelsis a native MoonBit toolkit for applications that learn from events continuously: CTR/risk scoring, device telemetry, incremental forecasting, ranking, feature streams, and model monitoring. It is the acceptance version of the August 2026 MoonBit Hackathon project.What is included
The implementation is deliberately dependency-light: the root package only uses
moonbitlang/core/mathandmoonbitlang/core/json. Public state is bounded where a stream can grow without limit; callers can inspect counters, reset state, and reject malformed dimensions at the boundary.Install
Minimal example
For sparse CTR-style features:
Verification
Run the same checks locally that the repository CI runs:
The local wasm-gc test suite contains 16 boundary and behavior scenarios; the native benchmark trains 20,000 deterministic events and records its measured output in
benchmarks/RESULTS.md. Re-run it withbenchmarks/run.ps1on the acceptance machine.Package and repository
phjphj676/moon-online-models@0.2.0masterLICENSE.申报书.md.The code is original MoonBit implementation authored by the repository owner. No generated build directory or credentials are part of the package.