models
The models collection scores fitted models and fits linear models on tables too large for memory. It is written in Rust and reads and writes one batch at a time, so its memory does not depend on the number of rows: 20 million rows score in about 66 MB and fit in about 50 MB.
A fitted model travels between blocks as a SpadeModel file: a small archive holding the model's description -- its inputs, how they become design columns, its coefficients -- and, for tree models, an ONNX graph. Nothing in it runs code when loaded.
models.predictscores a table with any SpadeModel: fromstats.lm/stats.glm, from thesaeblocks, from themlblocks, or from this collection. Predictions are on the response scale, with optional prediction or confidence intervals for linear and glm models; classifiers write a label and one probability per class. The table is checked against the model before any row is scored.models.linearandmodels.glmfit least squares and generalised linear models by streaming. They expand formulas and code categoricals exactly as R does and are tested to fit the modelsstats.lmandstats.glmfit, so a pipeline can move from the in-memory R blocks to these without its model changing. They do not offer cross-validation or formula nesting (/,%in%).
ONNX Runtime. Models from the ml collection carry an ONNX graph, and models.predict scores it with ONNX Runtime, loaded at run time from the path in ORT_DYLIB_PATH (libonnxruntime.so, version 1.30). The worker image provides it. For local runs, set the variable -- for example to the library bundled with the ml collection's Python environment -- or download the release from the ONNX Runtime project. Linear, glm and Fay-Herriot models need no runtime.
All blocks in this collection declare network: false.
Blocks🔗
| Block | Kind | Description |
|---|---|---|
models.predict | standard | Score a table with a SpadeModel, streaming, with optional intervals |
models.linear | standard | Least squares on a table of any size; fits the model stats.lm fits |
models.glm | standard | Gaussian, binomial, poisson or Gamma GLM on a table of any size; fits the model stats.glm fits |
Installation🔗
spade install file:///path/to/blocks/modelsmodels.predict
Score a table with any SpadeModel, streaming, with optional intervals.
Read →models.linear
Least squares on a table of any size, by streaming; fits the model stats.lm fits.
Read →models.glm
Gaussian, binomial, poisson or Gamma GLM on a table of any size; fits the model stats.glm fits.
Read →