跳到正文
DEV Community· gresiuseo·· 36 分鐘前AI 評分48

只比較 CaptchaTheCat 配對案例的結果

Compare CaptchaTheCat Outcomes Only on Matched Cases

AI 導讀

比較 CaptchaTheCat 的兩種設定時,應按共同案例計算配對結果,並列明未配對項目。離線合成數據示例中,4 個共同案例的配對完成率均為 1/2;原始完成率則分別為 2/3 和 1/2,另有 2 個只出現在 A 的案例。配對分析有助描述共同案例的結果,但不能證明隨機分配,也不能排除環境等因素變化。

正文

Count paired wins, paired losses and unmatched rows before interpreting a difference.

When I review a saved CaptchaTheCat comparison, a higher raw completion rate is easy to report. It is harder to defend when the two configurations were observed on different cases. I would start with the paired outcomes and disclose what was unmatched. The example here uses invented data and evaluates a saved table entirely offline.

Prepared with AI assistance. I ran the Python example locally with fictional records. It tests the stated assumptions for a downstream workflow.

Read the raw-rate calculation once, then inspect its population

Four cases ran on both configurations. A and B completed a different subset of them. Two additional cases appear only on A and both completed. A chart of the two standalone completion rates therefore seems to favor A. The four shared case identifiers contain balanced disagreement and tell a narrower story. A report should be able to show both observations and explain why each has a different scope.

There is a practical management question behind this. Can a reader attribute the observed difference to a configuration on a shared set of cases? A paired analysis helps describe the available shared evidence. It still does not prove random assignment or eliminate changes in setting, collection order or environment. The sample explicitly works with synthetic boolean outcomes rather than sending tasks anywhere.

Validate the identity and the outcome grain

Use a key that represents exactly one observed trial per configuration. If the same underlying case repeats in a new observation block, give trials separate references or aggregate under a declared rule before joining. This example has one unique case key on each side. Duplicate keys raise an error instead of replacing the earlier observation or causing a many-to-many join.

The fixture defines outcome as a boolean from a reviewed binary classification. If your saved data contains timeout, missing, skipped and pending, decide which belong in a binary comparison first. A recorded terminal timeout may count as false under one policy. An absent observation is unmatched; it has no terminal outcome under this sample's definition. Keep a count of each kind and the rule revision.

Put the date window and case-selection policy beside the comparison. A match on identifier is inadequate if the identifier was reused across versions or if the conditions differ. A future reader should be able to retrieve the concrete artifact that assigned the identifiers and verify they represented the same intended case grain.

Print the full contingency table

The small table has four cells for both completed, A only, B only and neither. I show both completed and neither so a reviewer understands denominator and concordance. The two one-sided counts give the direction among disagreements. Printing raw rate and matched rate separately exposes the selection effect in the example.

from fractions import Fraction

def keyed(rows):
    result = {}
    for key, success in rows:
        if key in result or not key or type(success) is not bool:
            raise ValueError("case identity or binary outcome invalid")
        result[key] = success
    return result

a_rows = [("red", True), ("blue", True), ("green", False), ("gold", False),
          ("extra-1", True), ("extra-2", True)]
b_rows = [("red", True), ("blue", False), ("green", True), ("gold", False)]
a, b = keyed(a_rows), keyed(b_rows)
shared = sorted(a.keys() & b.keys())
table = {(x, y): 0 for x in (True, False) for y in (True, False)}
for key in shared:
    table[(a[key], b[key])] += 1
a_rate, b_rate = Fraction(sum(a.values()), len(a)), Fraction(sum(b.values()), len(b))
matched_a = Fraction(sum(a[key] for key in shared), len(shared))
matched_b = Fraction(sum(b[key] for key in shared), len(shared))
assert a_rate == Fraction(2, 3) and b_rate == Fraction(1, 2)
assert matched_a == matched_b == Fraction(1, 2)
assert set(table.values()) == {1}
assert sorted(a.keys() - b.keys()) == ["extra-1", "extra-2"]
try:
    keyed(a_rows + [("red", False)])
except ValueError:
    pass
else:
    raise AssertionError("duplicate case key accepted")
print(f"Raw A {a_rate}, B {b_rate}; paired A {matched_a}, B {matched_b}; 2 unmatched A cases")

A local execution printed the following result.

Raw A 2/3, B 1/2; paired A 1/2, B 1/2; 2 unmatched A cases

The fixture finds one A-only completion and one B-only completion among the four shared cases. Each configuration completes half of that matched set. A looks better by standalone completion rate because it includes two additional successes. The correct observation is tied to the available evidence, and the matching calculation keeps the two unmatched entries visible.

The replay verifies a rejected duplicate key. If a later export adds multiple trials per configuration and case, the author needs to pick a meaningful pairing dimension or summarize the replicates. That decision changes which data a test considers independent. Do not hide it inside a pivot or in the order of file lines.

Flag an empty intersection as a coverage problem

If the shared set is empty, a matched rate is undefined. Show each configuration's raw scope and the two observed counts separately. A dashboard that turns absence into zero can make two disjoint test portfolios look equally poor. I would provide a short join diagnostic that lists a few safe unmatched identifiers and any common source revision. The person preparing the next comparison can then locate the broken or changed join key.

Put disagreements next to their common information

The two one-sided pairs invite the reviewer to inspect why the outcomes differ. Keep a neutral case label, the observation block and the binary classification rule alongside each row. A disagreement may arise because a retry was accidentally recorded as a distinct terminal result. A reviewer who can see those fields can send the correct record back through the classification rule without repeating unrelated measurements.

Describe cases seen only in the experimental group

Omission can be informative. A newer option may be able to report additional cases, or it may have been selected for a different sampling plan. Show whether the unmatched cases came from a known change to the input population. Preserve their outcomes as evidence for a separate observation. Keep them out of a result that claims both configurations saw the same cases.

A larger matched set can change what the headline means

Repeating the same case many times produces dependence even if it has distinct trial IDs. Decide whether the comparison represents repeat trials or unique case types. Report the case and trial counts independently and choose summaries accordingly. A stable group with fifty repeated observations of one item should not silently receive the influence of fifty independent case types if the decision is about coverage across types.

Publish case coverage next to a comparison

My preferred report shows the intersection size, separate unmatched counts and the paired table before any aggregate rate. If a team retains individual observations, attach a safe export of the paired data keyed by artifact revision. Include how the selection rule handles pending observations at the cutoff and any reconciliation rules for late, duplicated or conflicting observations.

Use a stable label for the input filters that were in effect. Daily outputs should state whether a missing pair came from a changed case set, a missing observation or an intentionally excluded state. If the same weekly report uses a different method later, keep a visible revision note so a reader can reproduce the earlier calculation. Recency alone does not make the new result comparable.

For a formal statistical conclusion, hand a paired dataset and its sampling context to someone who can justify the analysis assumptions. Balanced discordant pairs in this miniature example are a description of four cases. They supply neither an equivalence claim nor a guarantee about later cases. For operational review, the visible gap between raw and paired scope is already valuable evidence.

Check that a misleading raw headline would fail review

I would show the raw rates without names and ask someone to predict the winner. Then give them the paired table and ask whether the conclusion still follows. The change in their answer should trace to the two extra cases and visible denominators. If the reviewer can explain only the direction of the percent change, supply the underlying one-sided counts.

Re-run the fixture after moving extra cases from the first configuration to the second. The standalone impression changes direction, while the matched cells and rates stay fixed. This counterfactual is a compact test for the boundary between a new sample and a different outcome on a comparable sample. Record that distinction in the same place a chart's labels are defined.

Leave a review trail beside the paired counts

I would make the first review from two saved samples and their shared case identifiers. Have one person perform the review from an untouched export of the fixture and have another person run the example. Compare their explanations of matched completion rate and one-sided pair counts before comparing any rounded number or success badge. An agreement on the final display can hide a disagreement about which input rows belong in the reported population. If the two explanations differ, trace the first decision in the trial identity and unmatched-row rules that separates them. That makes a repeatable check out of an argument about which output looks familiar.

Save an example where the difference is small enough to escape casual review, then put its input next to two saved samples and their shared case identifiers. Separate the evidence the operator was able to obtain from an assumption made by the reporting code. The reviewer should be able to identify what a raw rate derived from a larger case set looks like in the input before learning how the program reports it. For the failed example, write down which output would be misleading and which evidence would allow a later review to resolve the case.

The release evidence I would ask the analyst responsible for the comparison to keep is the input reference, the effective rule and the observed matched completion rate and one-sided pair counts. A short explanation alongside those fields helps when a later change affects only one reader or time period. Append the evidence to the release note for the small change that produced it. That gives future operators a place to ask whether the output they see today was already possible in the previous release. Keep a stable label for the expected failure case even if the note, export layout or display title changes.

Finally, replay the same inputs in a clean workspace. Re-create the derived evidence before looking at a copy from the earlier run. If the second workspace cannot reproduce matched completion rate and one-sided pair counts, record which input, time boundary or method version was missing. A third reviewer should be able to distinguish a discrepancy in two saved samples and their shared case identifiers from a discrepancy in the trial identity and unmatched-row rules. That check is most valuable when the normal system continues running and presents a plausible value after one dependency changes.

Try the paired view in your next comparison

Open a saved comparison from CaptchaTheCat and find the smallest group with a common case identifier. Report the paired counts, the unmatched case counts and the raw rates separately. This turns a difference on a dashboard into an observation that another reader can check.

Further reading

Show Timeouts Beside Completed-Run Latency in a CaptchaTheCat Comparison Use that latency case before combining elapsed-time figures with the binary outcomes here.

Show Ties Honestly in a CaptchaTheCat Scorecard Use that scorecard guide when the paired result is too close to call.

Test a Benchmark Table Import With Reordered Columns Verify the imported case identifiers when source column order changes.

來源:DEV Community · dev.to