Proposal document: docs/modules/skeep/pages/005-ground-truth-stateful-metrics.adoc — not yet written; writing it is this issue's Lane 0 task
Status: Draft (proposal to be filed)
Branch: feature/skeep-005-ground-truth-stateful-metrics
Trigger
Compiler, graph-export, or runtime integration — specifically the test-integration
pattern every future Metric inherits. skainet-test-groundtruth's OperationExecutor
(skainet-test/skainet-test-groundtruth/src/commonMain/kotlin/sk/ainet/test/groundtruth/OperationExecutor.kt)
maps a test case's operation name to one stateless TensorOps call and returns one
Tensor<FP32, Float>. A Metric (sk.ainet.lang.nn.metrics.Metric) is stateful —
update() across many batches, compute() returning a scalar Double, reset() — and
there is no MetricExecutor or equivalent anywhere in the harness. That shape mismatch
is why the Precision/Recall/F1Score feature (#1222) ships with unit tests only and
never earns the "✅ ground-truth validated" badge tensor ops get.
Summary
Add a parallel MetricExecutor and GroundTruthMetricCase (predictions tensor, targets
tensor, expected scalar, metric parameters such as averaging mode) so metrics can be
cross-checked against sklearn / torchmetrics references the same way matmul is
cross-checked against PyTorch today, in the same CI job. Additive: OperationExecutor
and the existing GGUF op-fixture format are unchanged.
Improvising this inside whichever metric PR gets there first — instead of deciding its
shape once, durably — is exactly the drift SKEEP exists to prevent; hence a proposal
rather than a sub-issue of #1222.
Questions the proposal must answer (don't leave them to the implementer):
- Python-side fixture format: a new
@ExecutableMetric decorator in skainet-ground-truth,
or reuse of @Executable with a scalar-tensor convention?
- Does a metric case carry one batch or a sequence of batches (to exercise
accumulation across update() calls)?
- Scalar tolerance semantics vs. tensor element-wise tolerance.
- Does this warrant its own GGUF metadata convention, or a lighter fixture format since
metrics don't need the op-parameter machinery conv2d/pooling need?
Related DARC features
Sub-issues
To be filed once the proposal is Accepted. Suggested phases: (0) spike the fixture
format against Accuracy, which already ships; (1) MetricExecutor +
GroundTruthMetricCase; (2) wire Precision/Recall/F1Score.
Status upkeep
Proposal document:
docs/modules/skeep/pages/005-ground-truth-stateful-metrics.adoc— not yet written; writing it is this issue's Lane 0 taskStatus: Draft (proposal to be filed)
Branch:
feature/skeep-005-ground-truth-stateful-metricsTrigger
Compiler, graph-export, or runtime integration — specifically the test-integration
pattern every future
Metricinherits.skainet-test-groundtruth'sOperationExecutor(
skainet-test/skainet-test-groundtruth/src/commonMain/kotlin/sk/ainet/test/groundtruth/OperationExecutor.kt)maps a test case's operation name to one stateless
TensorOpscall and returns oneTensor<FP32, Float>. AMetric(sk.ainet.lang.nn.metrics.Metric) is stateful —update()across many batches,compute()returning a scalarDouble,reset()— andthere is no
MetricExecutoror equivalent anywhere in the harness. That shape mismatchis why the Precision/Recall/F1Score feature (#1222) ships with unit tests only and
never earns the "✅ ground-truth validated" badge tensor ops get.
Summary
Add a parallel
MetricExecutorandGroundTruthMetricCase(predictions tensor, targetstensor, expected scalar, metric parameters such as averaging mode) so metrics can be
cross-checked against
sklearn/torchmetricsreferences the same waymatmuliscross-checked against PyTorch today, in the same CI job. Additive:
OperationExecutorand the existing GGUF op-fixture format are unchanged.
Improvising this inside whichever metric PR gets there first — instead of deciding its
shape once, durably — is exactly the drift SKEEP exists to prevent; hence a proposal
rather than a sub-issue of #1222.
Questions the proposal must answer (don't leave them to the implementer):
@ExecutableMetricdecorator inskainet-ground-truth,or reuse of
@Executablewith a scalar-tensor convention?accumulation across
update()calls)?metrics don't need the op-parameter machinery conv2d/pooling need?
Related DARC features
AUC,MeanSquaredError, …) inherits whatever this decidesSub-issues
To be filed once the proposal is
Accepted. Suggested phases: (0) spike the fixtureformat against
Accuracy, which already ships; (1)MetricExecutor+GroundTruthMetricCase; (2) wire Precision/Recall/F1Score.Status upkeep
docs/modules/skeep/nav.adocand the "Current Proposals" tableAcceptedStatus:toImplemented