Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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(matching): document required_match and add a changelog entry
- states that a veto takes priority over similarity
- states that a single nested object has no pairing step to veto
  • Loading branch information
digalaviz committed Nov 18, 2026
commit 966bcc04786dc2c88398dc2a47f0a38be79529bf
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ Each release links to full notes on the

## [Unreleased]

### Added

- `ComparableField(required_match=True)` makes a primitive field a veto when
objects are paired in a list: a pair whose required field is not at or above
its threshold is excluded before the assignment and counts as one false
negative and one false alarm, never a false discovery. Off by default; scores
and counts do not change unless a field sets it.

## [1.0.1] - 2026-11-02

### Changed
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/Guides/Evaluation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ When defining a `StructuredModel` subclass in Python, each field is declared wit
| `threshold` | `float` (0.0--1.0) | `0.5` | Minimum similarity score required for a field to be classified as a match. |
| `weight` | `float` (> 0.0) | `1.0` | Relative importance of this field when computing aggregate scores. |
| `clip_under_threshold` | `bool` | `True` | When `True`, scores below `threshold` are zeroed out before contributing to the weighted average. |
| `required_match` | `bool` | `False` | When `True`, a score not at or above `threshold` vetoes the object pair when objects are matched inside a list. |

### How Each Parameter Affects Scoring

Expand All @@ -76,6 +77,8 @@ Fields with higher weights pull the overall score toward their individual result

**`clip_under_threshold`** -- When enabled (the default), a field that scores below its threshold contributes 0.0 to the weighted average instead of its partial similarity. This prevents low-confidence matches from inflating the overall score.

**`required_match`** -- Without it, an object with one wrong field still matches when its overall score reaches the element class's `match_threshold`. A required field that is not at or above its resolved threshold (the field's `threshold`, else one named on the comparator, else `0.5`) vetoes the pair before the Hungarian assignment, so a better pairing is found if one exists. A veto takes priority over similarity: the assignment keeps as many allowed pairs as it can, even at lower scores. The two objects left unmatched count as one False Negative (ground truth) and one False Alarm (prediction), never as a False Discovery. A value that is null on one side fails; null on both sides passes. Only `str`, `int`, `float` and `bool` fields (optionally `Optional`) may be required; any other annotation raises `ValueError` when the class is defined. The veto applies where objects are paired in a `List[StructuredModel]`. A single nested object has no pairing step, so it is not vetoed. The setting is Python only: `to_json_schema()` and `to_stickler_config()` do not write it, and `model_from_json()` and `from_json_schema()` do not read it.

### Example Model

```python
Expand Down