Browse documentation
Data structures

FeatureLedger

Automatically retained fitted preprocessing, exact training influences, ordered input schemas, trusted artifact restoration and native regression.

FeatureLedger is the native fitted preprocessing artifact returned by ml.fit_standardizer for an AdaptiveFrame. It retains the ordered input feature schema, population statistics and exact training dependencies automatically. Import aner.ml; users do not need to construct a separate history container before fitting a model.

Building energy regression supplies a complete checked program. Training temperatures [10, 20] produce center 15 and population scale 5, so the held out temperature 100 transforms to 17. Fitting that statistic on held out rows must fail with a located R3501 diagnostic containing E_FIT_SCOPE.

Fitting and transformation

ml.fit_standardizer(training) requires an authorized training frame. It learns population standard deviation (ddof = 0) from numerical feature columns; identity, group and target columns are excluded. A constant feature uses scale 1. Missing or nonfinite required input values fail rather than being imputed.

ml.transform(preprocessing, observations) returns a new frame. Its numerical features are standardized and its original feature units remain described in the fitted input schema. The target remains in its declared original unit. Training, validation and test roles are preserved; processing a held out frame does not authorize fitting on it.

Learned dependencies survive registered selection, rename, numerical packing and model operations. Fitting a new artifact checks both the current rows and the fitted influences of its inputs. Exploratory full data preprocessing cannot acquire strict training authorization by partitioning its output afterward. An artifact from another experiment or fold cannot be silently reused in an incompatible scope.

Applied preprocessing contract

The ordered preprocessing applied to values is a separate contract from the observations that influenced fitting. Matching field IDs, dimensionless units or valid training scope alone does not prove that a numeric batch has been prepared correctly. The runtime retains at most 64 applied stages, each identified by a stable fingerprint of its fitted inputs, ordered feature meaning and parameters.

A standardizer records its exact expected input chain. Transformation must match that chain before appending the fitted stage; applying the same artifact to its own output fails with a located R3501 diagnostic containing E_FEATURE_SCHEMA. A second standardizer fitted after the first requires the first stage at inference as well. Prediction validates the exact chain used during training and rejects raw, extra or differently ordered preprocessing before producing output.

Persistence fingerprints use semantic field descriptors rather than serialized native IDs. Restoration recomputes against the live trusted anchor and rebinds the verified stages to its local scope. Equivalent legitimately reconstructed anchored pipelines match; file contents do not authorize themselves. This bounded ordered processing contract is not a general replayable feature DAG.

Model boundary and prediction identity

The first complete estimator is native CPU Float64 linear regression with an intercept and checked least squares QR. It rejects deficient rank; no hidden regularization or fallback is selected. Its input schema comes from the contextual batch. Prediction validates the ordered schema and preserves observation IDs and target unit. Evaluation also checks the prediction/target observation domain, rather than accepting equal shapes alone.

Numeric scalar readout is useful for inspection but is not a tracked model input constructor. Source declarations, unrelated manually reconstructed values and operations outside the registered runtime cannot prove experimental validity automatically. This system validates explicit supported contracts; it does not infer concealed target proxies or control choices made after examining results elsewhere.

Persistence and trust

Supported fitted artifacts use bounded versioned native files with integrity verification. Saving creates a new file and refuses to overwrite an existing artifact. Loading requires a live trusted training anchor; file names, hashes, text IDs and serialized process pointers cannot independently grant a fit scope. Learned parameters and exact dependencies are checked against that anchor.

A checksum verifies the serialized payload's integrity, not that a scientific measurement or declared split is correct. Unsupported foreign restoration must not create a trusted training history from detached numerical values.

Native API signatures

Qualified functions and the corresponding recognized receiver methods use the same native contracts. self denotes the receiver in the qualified signature. Lists of names or units contain Strings; index lists contain Int64 values. Wrong List element types fail instead of coercing values.

Native signatureResult
ml.row_ids(self: ContextPrediction)List
ml.row_id(self: ContextPrediction, index: Int64)Int64
ml.summary(self: FeatureLedger)String
ml.explain(self: FeatureLedger)String
ml.summary(self: ContextLinearModel)String
ml.explain(self: ContextLinearModel)String
ml.summary(self: ContextPrediction)String
ml.explain(self: ContextPrediction)String
ml.fit_standardizer(training: AdaptiveFrame)FeatureLedger
ml.fit_exploratory_standardizer(data: AdaptiveFrame)FeatureLedger
ml.transform(self: FeatureLedger, data: AdaptiveFrame)AdaptiveFrame
ml.center(self: FeatureLedger)Tensor
ml.scale(self: FeatureLedger)Tensor
ml.fit_linear(training: ContextBatch)ContextLinearModel
ml.predict(self: ContextLinearModel, samples: ContextBatch)ContextPrediction
ml.rmse(self: ContextPrediction, targets: ContextBatch)Float64
ml.values(self: ContextPrediction)SemanticTensor
ml.unit(self: ContextPrediction)String
ml.load_standardizer(path: String, training_anchor: AdaptiveFrame)FeatureLedger
ml.load_linear(path: String, training_anchor: ContextBatch)ContextLinearModel
ml.save(self: FeatureLedger, path: String)Unit
ml.save(self: ContextLinearModel, path: String)Unit

Time and space complexity

Let n be training rows, p numerical features, h retained dependency descriptors and H the exact influence membership examined during fit validation. Up to 64 learned influences are retained.

OperationTimeAdditional space
Fit population standardizationO(np + n log n + H)Retained O(p + h); peak additional O(np + n + p + h) including packed fit values and exact membership checks
Transform a frameExpected O(np + h)O(np + Np + h) standardized output and root row lookup buffers, where N is source rows
Inspect center/scaleO(p)O(p) numerical readout
Fit intercept least squaresO(np² + n log n + H)O(np + p² + n + h) checked solver workspace and retained artifact
Predict n observationsO(np + h)O(n + h) prediction and identity outputs
Aligned RMSEO(n + h)O(1) reduction state after retained context validation

Schema, population and transitive dependency validation add their actual descriptor traversal cost; the ledger is not traversed for each numeric multiply. Artifact IO and payload integrity verification are linear in serialized bytes, capped at 1 MiB. Loading also recomputes the standardizer or QR fit against the trusted anchor and therefore adds its fit time and peak workspace. Source rows are bounded to 1,000,000, fields to 64, numerical matrices to 1,000,000 cells and checked managed numerical buffers to 64 MiB.

Dependencies, backends and limitations

Use the compatible native development engine with aner.data, aner.ml, and VS Code helper 0.1.38 or newer. The reference workflow is CPU Float64 and needs no network, GPU or external database. The initial contextual batch requires a selected nonmissing target even when it is used for prediction. This estimator currently accepts held out observations from the same declared data root, feature identity and experiment scope used by its fitted workflow. Independent external observations and unlabeled inference require explicit alignment adapters that are not implemented yet. The building energy tutorial is a held out subset of one declared root, rather than a general deployment endpoint.

The new linear estimator resolves the current CLI or nn.configure execution profile at fit, predict and model restoration. Only effective CPU Float64 is supported. A conflicting Float32 or GPU profile fails with a located R3501 diagnostic containing E_BACKEND_UNSUPPORTED; it does not silently run a different backend. The normal preserve policy can resolve a requested Metal/MPS Float64 execution to a reported CPU Float64 fallback. CSV/statistics preparation retains its documented CPU behavior.

The supported standardizer and linear estimator are a narrow complete path, not a general feature store or experiment registry implementation.

General feature DAGs, supervised target encoders, historical feature availability, arbitrary estimators, streaming partial fitting and contextual distributed training remain future work. Existing independent training and parallel modules retain their own documented contracts.

Aner documentation · Reference and guides