Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs(249,338): fix claims the first two commits left wrong
- `_accumulate_field_metrics`: list-of-StructuredModel element fields
  arrive under `fields`, not `nested_fields`; compare_with no longer
  emits `nested_fields` (its emitter went in ad19ac8). Note that only a
  finite score is summed.
- bulk-evaluation.md and understanding-results.md said compare_with
  "only emits the score at the list parent". An object node inside a
  list element is scored too (`items.addr` gets a mean_score); only the
  leaves are not.
- CHANGELOG: move the #338 correction from `### Fixed` with a
  `**Documentation:**` prefix to a `### Documentation` section, the
  heading earlier releases use.

Refs #249, #338
  • Loading branch information
sromoam committed Oct 15, 2026
commit 12135c65215db6379806f70d93680d02b6df2e62
14 changes: 8 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@ Each release links to full notes on the
Keyed on the leaf name alone, the first model built in a process silenced every
later one carrying the same typo.

- **Documentation:** the 1.0.0 entry "The element gate judges a PAIR, not a
list" overstates its last row. Under the bare `Optional[List[Any]]` heading,
### Documentation

- Corrected the last row of the 1.0.0 table under "The element gate judges a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low, optional. RELEASING.md ("What belongs in the changelog") says entries are for changes a user can observe, and "When in doubt, ask whether a user reading the release notes could act on it." This entry corrects a table in the 1.0.0 notes, which is defensible. But the user-facing correction in this PR, the mean_score sentence in bulk-evaluation.md and understanding-results.md (leaves under a list get no score, object nodes inside an element do), has no entry. If one of the two gets an entry, the guide-page correction is the one a user can act on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the guide fix is the one a user can act on. I added an Unreleased Documentation entry for it (#249) and kept the #338 table correction next to it. Fixed in 18c241d.

PAIR, not a list". Under its bare `Optional[List[Any]]` heading,
`[Plain, NoteSM]` vs `[Plain, Note2SM]` scores `0.5`, not `1.0`, and scored
`0.0` (not `0.5`) under the list-wide gate. The published values (`1.0`,
`0.5`, `1.0`) hold only with a comparator declared on `f`. The bare `0.5` is
the refused `Plain` pair (`[Plain]` vs `[Plain]` scores `0.0` bare), not the
cross-class rule. Scoring is unchanged
`0.0`, not `0.5`, under the list-wide gate. The published `1.0`, `0.5`, `1.0`
hold only with a comparator declared on `f`. The bare `0.5` is the refused
`Plain` pair (`[Plain]` vs `[Plain]` scores `0.0` bare), not the cross-class
rule. Scoring is unchanged
([#338](https://github.com/awslabs/stickler/issues/338))

## [1.0.0] - 2026-09-11
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/Guides/Evaluation/bulk-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Because each document's `overall_score = Σ_f(score × weight) / Σ_f(weight)` a

The denominator is the count of documents whose `overall_score` was a finite number: error docs (`update()` raised) and successful docs carrying a non-finite or missing `overall_score` are both excluded. With zero eligible documents the score is `0.0` — disambiguate via `document_count` when that matters.

Per-field `mean_score` is reported at every nested path (leaf and object/list aggregate) where `threshold_applied_score` was observed in at least one document, averaging over just those documents. Paths with confusion-matrix counts but no score data (e.g., leaves inside `List[StructuredModel]`, where `compare_with()` only emits the score at the list parent) are surfaced without a `mean_score` key rather than reported as `0.0`.
Per-field `mean_score` is reported at every nested path (leaf and object/list aggregate) where `threshold_applied_score` was observed in at least one document, averaging over just those documents. Paths with confusion-matrix counts but no score data (e.g., leaves inside `List[StructuredModel]`, which `compare_with()` emits without a score) are surfaced without a `mean_score` key rather than reported as `0.0`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low (recall). The example "leaves inside List[StructuredModel]" is described as a path "with confusion-matrix counts but no score data". When an element pair falls below the match threshold, compare_with() does not emit the element fields at all. Measured on 12135c6 with one doc whose only element differs in addr.city: field_metrics has items, ship, ship.city, and no items.name or items.addr* key. So those leaves are absent, not only missing mean_score, and their CM counts cover matched pairs only. Same sentence in understanding-results.md:405. Optional: say so in one clause.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks. Confirmed on 12135c6: with a below-threshold element pair, no items.* key is emitted, and in a mixed doc the element paths count only the matched pair. Both guides now say so in one sentence and list items.name, items.addr.city and items.tags as the unscored paths. Fixed in 18c241d.


---

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/Guides/Evaluation/understanding-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ This is useful for comprehensive auditing of all comparisons, not just failures.
The per-document `overall_score` above is a weighted average of field scores. When you aggregate across many documents with `BulkStructuredModelEvaluator.compute()`, the weight information is preserved via two keys:

- **`metrics["weighted_overall_score"]`** (float) -- Arithmetic mean of each document's `overall_score`. Prefer this over `cm_f1` whenever your schema uses non-uniform `ComparableField(weight=...)` values: `cm_f1` treats every field-match equally, while `weighted_overall_score` preserves the declared per-field weights across the dataset.
- **`field_metrics[path]["mean_score"]`** (float, when present) -- Arithmetic mean of each document's `threshold_applied_score` at that path, reported at every nested node that was actually scored. Paths with confusion-matrix counts but no score data (e.g., leaves inside `List[StructuredModel]`, where `compare_with()` only emits the score at the list parent) are surfaced without a `mean_score` key rather than as `0.0`.
- **`field_metrics[path]["mean_score"]`** (float, when present) -- Arithmetic mean of each document's `threshold_applied_score` at that path, reported at every nested node that was actually scored. Paths with confusion-matrix counts but no score data (e.g., leaves inside `List[StructuredModel]`, which `compare_with()` emits without a score) are surfaced without a `mean_score` key rather than as `0.0`.

```python
from stickler.structured_object_evaluator.bulk_structured_model_evaluator import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,13 @@ def _accumulate_field_metrics(
) -> None:
"""Recursively accumulate field-level CM counts and threshold_applied_score.

Walks both ``fields`` (object subtrees) and ``nested_fields``
(list-of-StructuredModel) so CM counts are recorded at every node
compare_with emits. Score sums (for ``mean_score``) are recorded
only where a node carries ``threshold_applied_score``. Leaves under
a list parent carry CM counts only, so their paths get no
``mean_score`` (see #249).
Walks ``fields``, which holds both object subtrees and the element
fields of a list of StructuredModel, so CM counts are recorded at
every node compare_with emits. Score sums (for ``mean_score``) are
recorded only where a node carries a finite
``threshold_applied_score``. Leaves under a list parent carry CM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low (recall). "Leaves under a list parent carry CM counts only" does not match the measured output. With items: List[Line], Line.addr: Addr, Line.tags: List[str] on 12135c6: items.addr.city is unscored although its direct parent is the object addr, and items.tags (a primitive list, not a leaf) is unscored too, while items.addr is scored. Suggested wording: "Leaves anywhere inside a list element, and primitive lists inside a list element, carry CM counts only".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I reproduced your model: items.addr.city and items.tags are unscored while items.addr is scored. I used your wording and added that every path inside an element counts matched pairs only. Fixed in 18c241d.

counts only, so their paths get no ``mean_score`` (see #249).
``nested_fields`` is also walked, but compare_with no longer emits it.
"""
for field_name, field_data in fields_dict.items():
if not isinstance(field_data, dict):
Expand Down
Loading