Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions docs/notebooks/01_your_first_anonymization.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/notebooks/02_inspecting_detected_entities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@
"\n",
"Since finishing his training, <span style=\"border:1.5px solid #06b6d4;padding:1px 4px;border-radius:3px\">&lt;Bobby, first_name&gt;<span style=\"color:#06b6d4;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| first_name</span></span> has worked at <span style=\"border:1.5px solid #06b6d4;padding:1px 4px;border-radius:3px\">&lt;VCA Animal Hospital, organization_name&gt;<span style=\"color:#06b6d4;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| organization_name</span></span> and later at the <span style=\"border:1.5px solid #06b6d4;padding:1px 4px;border-radius:3px\">&lt;Colorado Veterinary Clinic, organization_name&gt;<span style=\"color:#06b6d4;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| organization_name</span></span>, where he now leads a busy mixed‑practice team. He identifies as a <span style=\"border:1.5px solid #3b82f6;padding:1px 4px;border-radius:3px\">&lt;Christian Democrat, political_view&gt;<span style=\"color:#3b82f6;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| political_view</span></span> and often volunteers at local shelters, a habit encouraged by his wife, <span style=\"border:1.5px solid #06b6d4;padding:1px 4px;border-radius:3px\">&lt;Maya, first_name&gt;<span style=\"color:#06b6d4;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| first_name</span></span>, and their two teenage children, <span style=\"border:1.5px solid #06b6d4;padding:1px 4px;border-radius:3px\">&lt;Aria, first_name&gt;<span style=\"color:#06b6d4;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| first_name</span></span> and <span style=\"border:1.5px solid #06b6d4;padding:1px 4px;border-radius:3px\">&lt;Leo, first_name&gt;<span style=\"color:#06b6d4;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| first_name</span></span>. Outside the clinic, <span style=\"border:1.5px solid #06b6d4;padding:1px 4px;border-radius:3px\">&lt;Bobby, first_name&gt;<span style=\"color:#06b6d4;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| first_name</span></span> enjoys hiking the <span style=\"border:1.5px solid #22c55e;padding:1px 4px;border-radius:3px\">&lt;Rockies, place_name&gt;<span style=\"color:#22c55e;font-size:0.75em;font-weight:600;margin-left:3px;opacity:0.85\">| place_name</span></span> with his family and mentoring veterinary students from his alma mater.</div>\n",
" </div>\n",
" <div style='margin-bottom:16px'><div style=\"font-size:0.8em;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:6px;opacity:0.5\">Detection Judge</div><div style='font-size:0.9em;line-height:1.8'><strong>Detection Validity:</strong> <span style='color:#22c55e;font-weight:600'>Satisfied</span> (LLM alignment score: 19/19)<div style='font-size:0.8em;opacity:0.7;font-style:italic;margin-top:2px'>LLM alignment score: The level of alignment between the detection and evaluation LLMs across entity classification, attributes, and relationships.</div></div></div>\n",
" <div style='margin-bottom:16px'><div style=\"font-size:0.8em;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:6px;opacity:0.5\">Detection Judge</div><div style='font-size:0.9em;line-height:1.8'><strong>Detection Validity:</strong> <span style='color:#22c55e;font-weight:600'>Satisfied</span> (Judge Agreement: 19/19)<div style='font-size:0.8em;opacity:0.7;font-style:italic;margin-top:2px'>Judge Agreement: The number of entity-label pairs accepted by the evaluation judge out of all pairs produced by the Anonymizer.</div></div></div>\n",
" \n",
" \n",
" \n",
Expand Down
8 changes: 4 additions & 4 deletions docs/notebooks/03_choosing_a_replacement_strategy.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/anonymizer/engine/replace/replace_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def run(
"""Apply the replacement strategy (no LLM judges).

Evaluation is a separate concern — call ``evaluate()`` on the resulting
dataframe when you want the LLM alignment scores.
dataframe when you want the Judge Agreement scores.
"""
strategy = type(replace_method).__name__
with stage_timer(
Expand Down
4 changes: 2 additions & 2 deletions src/anonymizer/interface/anonymizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def run(
"""Run the full anonymization pipeline (detection + replacement).

No LLM evaluation judges run here — call :meth:`evaluate` on the
result's ``trace_dataframe`` when you want the LLM alignment scores.
result's ``trace_dataframe`` when you want the Judge Agreement scores.

Args:
config: Workflow behavior — replace strategy, entity labels, thresholds.
Expand Down Expand Up @@ -345,7 +345,7 @@ def preview(
"""Run the pipeline on a subset of records for quick inspection.

No LLM evaluation judges run here — call :meth:`evaluate` on the
result's ``trace_dataframe`` when you want the LLM alignment scores.
result's ``trace_dataframe`` when you want the Judge Agreement scores.

Args:
config: Workflow behavior — replace strategy, entity labels, thresholds.
Expand Down
10 changes: 5 additions & 5 deletions src/anonymizer/interface/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def _verdict_badge(valid: object, correct: int, total: int) -> tuple[str, str]:
else:
verdict, color = "Partially Satisfied", "#f59e0b"
badge = f"<span style='color:{color};font-weight:600'>{verdict}</span>"
rate_html = f" (LLM alignment score: {correct}/{total})"
rate_html = f" (Judge Agreement: {correct}/{total})"
return badge, rate_html


Expand Down Expand Up @@ -668,8 +668,8 @@ def _render_detection_judge_section(row: pd.Series) -> str:
"<div style='font-size:0.9em;line-height:1.8'>"
f"<strong>Detection Validity:</strong> {badge}{html.escape(rate_html)}"
"<div style='font-size:0.8em;opacity:0.7;font-style:italic;margin-top:2px'>"
"LLM alignment score: The level of alignment between the detection and "
"evaluation LLMs across entity classification, attributes, and relationships."
"Judge Agreement: The number of entity-label pairs accepted by the evaluation "
"judge out of all pairs produced by the Anonymizer."
"</div>"
"</div>"
)
Expand Down Expand Up @@ -920,7 +920,7 @@ def _render_relational_consistency_section(row: pd.Series) -> str:
all_relations = _extract_all_relations(row)
invalid_count = sum(1 for r in all_relations if not bool(r.get("passes", False)))
# Fall back to the invalid-relations column when the raw output is missing,
# so the LLM alignment score still surfaces "at least this many failures".
# so Judge Agreement still surfaces "at least this many failures".
if not all_relations:
fallback_invalid = _normalize_relations(row.get(COL_RELATIONAL_CONSISTENCY_INVALID_RELATIONS))
invalid_count = len(fallback_invalid)
Expand Down Expand Up @@ -1051,7 +1051,7 @@ def _count_detected_entity_label_pairs(row: pd.Series) -> int:
"""Count (value, label) pairs the judge had a chance to evaluate.

The judge schema flags entities at the (value, label) granularity, so the
denominator for the LLM alignment score is the total number of such pairs in the
denominator for Judge Agreement is the total number of such pairs in the
deduped entity payload, not the number of unique values.
"""
raw = row.get(COL_ENTITIES_BY_VALUE) if COL_ENTITIES_BY_VALUE in row.index else None
Expand Down
2 changes: 1 addition & 1 deletion tests/interface/test_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_normalize_replacement_map_non_dict_returns_empty() -> None:
def test_verdict_badge_satisfied_when_all_correct_and_valid_true() -> None:
badge, rate = _verdict_badge(valid=True, correct=10, total=10)
assert "Satisfied" in badge and "Not" not in badge
assert "10/10" in rate
assert rate == " (Judge Agreement: 10/10)"


def test_verdict_badge_partial_for_mixed_count() -> None:
Expand Down
Loading