You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d77fb56
Browse filesBrowse the repository at this point in the historyBrowse files
docs(thresholds): scope the numpy, runtime, class match_threshold and list-warning claims
- CHANGELOG: a numpy float16 or float32 threshold compares as a Python
float, so a score within its rounding below it moves from TP to FD; the
runtime match_threshold keeps its own check, now on every call; a class
match_threshold of 85 made every list pair an FD (an identical pair did
not score 0.0); every list refusal is headed `Unused threshold`.
- thresholds-and-metrics: the list-of-models comparator warning is not
emitted on the Python path under `from __future__ import annotations`;
an Annotated field whose type is defined further down is checked too,
and say which message gives which fix.
Copy file name to clipboardExpand all lines: docs/docs/Getting-Started/thresholds-and-metrics.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,9 +167,9 @@ Anything else, such as `85`, `1.5`, `-1`, `"0.9"`, `true`, NaN or infinity, rais
167
167
ValueError: Invalid threshold for field 'vendor' of model 'Invoice': ComparableField sets no threshold, so the field adopts its comparator's: LevenshteinComparator(threshold=85). A threshold is the minimum similarity score for a match, from 0.0 to 1.0. 85 is above 1.0, so even identical values would not match. If 85 is a percentage, write LevenshteinComparator(threshold=0.85), or ComparableField(threshold=0.85), which wins over the comparator's. (Set at invoice_models.py:6.)
168
168
```
169
169
170
-
A comparator threshold the field does not adopt is not checked: when the field sets its own, the comparator's is not read, and on a `List[StructuredModel]` field (an array of objects in a schema) it is never used, since its items are matched up using `match_threshold`, so it warns instead. A field threshold on a list of models that breaks the rule raises, and the message says to remove it and use `match_threshold`. A comparator's constructor never checks its threshold, since a custom comparator may use `threshold` for something else, and the comparator keeps the value you passed. The runtime `match_threshold` of `evaluate()` and `eval_for()` is outside this rule; see [Runtime Match Threshold](#4-runtime-match-threshold).
170
+
A comparator threshold the field does not adopt is not checked: when the field sets its own, the comparator's is not read, and on a `List[StructuredModel]` field (an array of objects in a schema) it is never used, since its items are matched up using `match_threshold`, so it warns instead (on the Python path, only without `from __future__ import annotations`). A field threshold on a list of models that breaks the rule raises, and the message says to remove it and use `match_threshold`. A comparator's constructor never checks its threshold, since a custom comparator may use `threshold` for something else, and the comparator keeps the value you passed. The runtime `match_threshold` of `evaluate()` and `eval_for()` is outside this rule; see [Runtime Match Threshold](#4-runtime-match-threshold).
171
171
172
-
A field whose type is defined further down the moduleis checked when the class is defined, before that type exists, so stickler reads the field as adopting its comparator's threshold. Only a list of models does not, so there, and on a bare name for a list of models (`items: "ItemList"`, with `ItemList = List[Item]` below), an invalid comparator threshold raises, though the field would ignore it once resolved. The message says to remove the comparator in that case.
172
+
A field whose type is defined further down the module, `Annotated` fields included, is checked when the class is defined, before that type exists, so stickler reads the field as adopting its comparator's threshold. Only a list of models does not, so there, and on a bare name for a list of models (`items: "ItemList"`, with `ItemList = List[Item]` below), an invalid comparator threshold raises, though the field would ignore it once resolved. When the annotation is visibly a list (`List["Item"]`), the message says to remove the comparator if the element is a model. An invalid field threshold on such a field, or on a bare name, gets a fix for each case: a list of models, and anything else.
0 commit comments