Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Build
Start
Reference code
Tools
API reference
Public services
Agents
Bindings and crosswalks

obsp-model-run (draft OIP-0012, MODEL-OBSERVER)

REFERENCE Source reference/python/obsp_model_run/README.md

On this page
  1. What the recorder captures (recorder.py)
  2. Weakest-origin rule (origin.py)
  3. Skill (skill.py)
  4. ML-BOM (bom.py)
  5. Worked example
  6. Standards named
FieldValue
StatusReference code written against draft proposals (DRAFT); accepts no proposal; no conformance claim
Packageobsp_model_run
SourcePython reference tools

A recorder that wraps a model invocation and writes what the draft’s model-run object asks for, a CycloneDX ML-BOM, output observation-records labelled by origin, and skill scores. Synthetic data and toy models only: the reference “observations” are produced by the same kind of toy physics, so every skill score here is optimistic and says nothing about real skill.

What the recorder captures (recorder.py)

Item Draft How
Weights digest MOD-2 RFC 8785 digest of the artefact loaded; it equals the model-manifest’s artifactDigest
Inputs by digest MOD-3 add_input pins each input by UNI, version and digest with its role and origin; add_input_record and add_sensing_input take the origin from the record itself
Configuration digest MOD-2 digest of the run configuration
Run times MOD-3 invoke records runStart and runEnd from a clock, also when the model raises
Uncertainty method MOD-5 ENSEMBLE with members, or NONE; an output cannot carry an uncertainty the method does not give
Skill MOD-4 add_skill against a Reference (UNI, version, digest, period); refused against the run’s own outputs
ML-BOM MOD-2 bom.py, CycloneDX JSON, referenced from mlBomRef by URI and digest
Origin MOD-6 origin.py, the weakest-origin rule below

Weakest-origin rule (origin.py)

Strength, strongest first: MEASURED, NETWORK_DERIVED, MODEL_DERIVED and DECLARED (equal), SIMULATED. A run’s outputs are at best MODEL_DERIVED, whatever the inputs; a SIMULATED input or a SCENARIO run makes them SIMULATED; the label travels down a chain of runs because an input record contributes its own origin. The draft leaves the placing of DECLARED as an open question (OIP-0012, question 2); this code follows the draft’s table.

Skill (skill.py)

Categorical scores come from the contingency table of the forecast event against the reference event: POD = hits / (hits + misses), FAR = false alarms / (hits + false alarms), CSI = hits / (hits + misses + false alarms), F1; RMSE for continuous values. An undefined score (an empty denominator) raises instead of returning zero.

ML-BOM (bom.py)

CycloneDX specification version 1.6 (ECMA-424 is the Ecma edition of CycloneDX 1.6), checked: not checked. The BOM has a machine-learning-model component with the weights hash, a model card with the task, datasets and performance metrics, one data component per input and the dependencies between them. self_check is a local structural test; it is not validation against the official JSON schema, which was not available here.

Worked example

$ make model-run
...
Ran 40 tests in 1.0s
OK

dist/model-run/report.json (seed 7):

Run Inputs (origins) Output origin Uncertainty Skill (synthetic reference)
flood forecast, toy flood model rain forced by four network-derived sensing records, terrain declared MODEL_DERIVED ENSEMBLE, 10 members CSI 0.69, POD 0.71, FAR 0.05 (extent); RMSE 0.067 m (gauge depth)
design-storm scenario, same model declared storm and terrain SIMULATED NONE none claimed
water classifier (inference) imagery, measured MODEL_DERIVED NONE CSI 0.87, POD 0.97, FAR 0.11, F1 0.93

Every document is checked against the draft schemas (model-manifest, model-run, 4.0 observation-record), then the integrated tree’s draft cases run over dist/model-run/evidence: CT-MODEL-001, -002, -004 and -005 PASS; CT-MODEL-006 is manual; CT-MODEL-003 FAILS with “no attestation-result document in the evidence set”. The recorder accepts a compute attestation reference but this pipeline does not make one up, so that case stays failing here.

rec = ModelRunRecorder(model=ModelIdentity(uni, name, version, framework, task, weights), config=cfg,
                       run_kind="FORECAST", run_uni=..., operator_uni=..., uncertainty_method="ENSEMBLE",
                       ensemble_members=10, method_doc=(uri, text_bytes))
rec.add_sensing_input(rain_record, role="FORCING")                  # origin NETWORK_DERIVED, read from the record
rec.add_input("uni:coverage:terrain-24", "1", terrain, role="STATIC", origin="DECLARED")
out = rec.invoke(model.ensemble, rain_mm, terrain, members=10)
rec.add_output(uni=..., observed_property=..., result=..., artifact=out["depth"], ...)   # origin MODEL_DERIVED
rec.add_skill("CSI", 0.69, Reference(uni, version, reference_value, period_start, period_end))
bundle = rec.finish()    # manifest, run, observations, ml_bom, artifacts

Files: evidence/ (manifests, runs, observation records, in the layout the conformance runner reads), artifacts/ (ML-BOMs, output grids, reference data, the verification method and model card texts), report.json.

Standards named

CycloneDX 1.6 and ECMA-424, RFC 9334 (remote attestation, for the optional compute attestation reference), RFC 8785 (JSON canonicalisation). All checked: not checked. The draft’s remark on labelling generated content is not developed here: the pipeline records the marking (origin and run) and makes no statement about any legal duty. The draft is oips/drafts/OIP-0012/OIP-0012.md.