Browse documentation
Data structures

EvidenceTensor

Declared unknown, exact and source aware affine uncertainty with preserved calibration correlations, explicit projections and bounded CPU execution.

EvidenceTensor is an opt in native scientific value with an explicit uncertainty model and retained source identity. Import aner.science. The initial implementation supports unknown uncertainty, explicitly exact values and a bounded source aware affine model. Unknown uncertainty is not zero uncertainty.

Shared calibration sensor fusion is the complete runnable introduction. Two sensor readings share a calibration term. Averaging them preserves that common term; subtracting them cancels it. Copying or gathering an observation does not create a new independent measurement.

Declared calibration model

science.calibrated(values, unit, noise_stddev, calibration_stddev) declares independent reading noise for each observation and one shared calibration source. Standard deviations must be finite and nonnegative, in the corresponding difference unit. This independence and shared calibration model is an explicit constructor assumption, not a conclusion inferred from the data.

For readings 20 and 22 degC, reading standard deviation 0.2 and calibration standard deviation 0.3:

  • Each variance is 0.2² + 0.3² = 0.13.
  • Shared covariance is 0.3² = 0.09.
  • Their mean is 21, with variance (0.13 + 0.13 + 2*0.09)/4 = 0.11.
  • Their difference is −2, with variance 0.13 + 0.13 − 2*0.09 = 0.08.

Source identity survives gather, copying and registered affine operations. The difference of an observation from itself has zero variance. The mean of the same observation twice retains variance 0.13; it does not gain independent information merely by being duplicated.

Supported propagation and units

Supported source aware addition, subtraction, mean and unit conversion use the joint affine source model. When values carry fitted scientific context, the same bounded 64 record registered operation history applies, including merged branches; exceeding it fails with E_RESOURCE_BUDGET without changing earlier values. This history does not replace a general replayable provenance graph. Absolute temperature arithmetic follows the SemanticTensor rules. Converting the fused mean to Kelvin gives 294.15 K and retains variance 0.11 K²: an offset does not change uncertainty, and a scale multiplies variance by its square.

A declared affine relationship can propagate measurement uncertainty exactly under this model. The tutorial's frozen y = 2*x + 1 relationship uses a length input in meters, slope in N/m and output in N. Input mean 20 and variance 0.13 yield output mean 41 and variance 0.52. This result describes propagated input measurement noise, not uncertainty in trained model parameters.

Advanced source declarations and coefficient maps require explicit independence assumptions and compatible source definitions. Distinct unresolved source registries remain correlation unknown. The implementation must refuse operations whose correlations it cannot represent; it does not silently diagonalize a covariance or choose a probability distribution.

Model and numerical boundaries

A normal numerical Tensor or ordinary NN objective does not consume uncertainty automatically. A values only projection requires an explicit reason and records that evidence was not consumed. Existing autodifferentiation computes optimization derivatives; it is separate from the evidence model.

A variance does not specify a Gaussian distribution, confidence interval, quality score or predictive probability. Quality flags, sampling weights and observation precision require separate contracts. No unsupported nonlinear model uncertainty or universal NN uncertainty propagation is claimed.

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
science.summary(self: EvidenceTensor)String
science.explain(self: EvidenceTensor)String
science.calibrated(values: Tensor, unit: String, noise_stddev: Float64, calibration_stddev: Float64)EvidenceTensor
science.measurements(values: SemanticTensor, source_names: List, stddevs: List, coefficients: Tensor, error_unit: String, independence: String)EvidenceTensor
science.exact(values: SemanticTensor)EvidenceTensor
science.unknown(values: SemanticTensor)EvidenceTensor
science.item(self: EvidenceTensor)Float64
science.variance(self: EvidenceTensor)Float64
science.variance(self: EvidenceTensor, row: Int64, column: Int64)Float64
science.standard_uncertainty(self: EvidenceTensor)Float64
science.standard_uncertainty(self: EvidenceTensor, row: Int64, column: Int64)Float64
science.unit(self: EvidenceTensor)String
science.gather_rows(self: EvidenceTensor, indices: List)EvidenceTensor
science.add(self: EvidenceTensor, other: EvidenceTensor)EvidenceTensor
science.subtract(self: EvidenceTensor, other: EvidenceTensor)EvidenceTensor
science.mean(self: EvidenceTensor, other: EvidenceTensor)EvidenceTensor
science.convert(self: EvidenceTensor, unit: String)EvidenceTensor
science.affine(self: EvidenceTensor, slope: Float64, intercept: Float64, slope_unit: String, output_unit: String)EvidenceTensor
science.export_values(self: EvidenceTensor, reason: String)ContextExport
science.source_entries(self: EvidenceTensor)Int64
science.source_bytes(self: EvidenceTensor)Int64
science.covariance(self: EvidenceTensor, row: Int64, column: Int64, other: EvidenceTensor, other_row: Int64, other_column: Int64)Float64

Time and space complexity

Let n be scalar values, s declared base sources and a active sparse source coefficients. A full covariance matrix is not constructed by default.

OperationTimeAdditional space
Declare calibrated readingsO(n)O(n) values/source coefficients and source descriptors
Affine add/subtract/meanO(n + a) plus source compatibility checksO(n + a) output and retained source coefficients
Gather or duplicate selected rowsO(n + a) for selected outputO(n + a) selected values and coefficients
Unit conversion or frozen affine mapO(n + a)O(n + a) output values and scaled coefficients
Scalar varianceO(aᵢ) for that scalar's active sourcesO(1) reduction state
Covariance of two scalarsO(aᵢ + aⱼ) with sorted source mapsO(1) reduction state

The initial affine representation admits at most 65,536 cells and 262,144 active source coefficients. The general explicit source constructor admits at most 4,096 base sources. Nonzero uncertainty must not silently become exact through Float64 range loss. Unrepresentable source variances, overflowing variance arithmetic or underflowing nonzero scaled source coefficients fail rather than rounding a declared nonzero error model to certainty.

Source map memory is inspectable and bounded: source_bytes() reports allocated vector buffers including capacities, excluding source registry data, Strings, allocator bookkeeping and process RSS. A hypothetical dense covariance costs O(n²), but that is not a promise that arbitrary covariance matrices are supported by this release.

Dependencies, backends and limitations

Use the compatible native development engine and VS Code helper 0.1.38 or newer. The current evidence kernels use CPU Float64; they require no external uncertainty service, GPU or stochastic sampler. The complete sensor fixture lives in its source program.

Native evidence/source map persistence, GPU evidence kernels, general covariance operators, joint Monte Carlo, nonlinear uncertainty propagation and uncertainty aware neural training are future functionality. Ordinary compatible Tensor accelerator support does not imply support for these evidence operations. Unsupported propagation returns a clear diagnostic rather than discarding uncertainty.

Aner documentation · Reference and guides