跳到正文
DEV Community· StagingBench Team·· 49 分鐘前AI 評分45

解讀每日中位數前,先核查測試日期覆蓋情況

Audit Test Date Coverage Before Interpreting Daily Medians

AI 導讀

分析每日中位數前,應先核查各日期涵蓋的工具及各工具涵蓋的日期,避免把不同批次誤當成固定測試配置。例子涵蓋 12 個虛擬佈景工具的 119 項觀測,八個日期中有三個日期只有一種工具;有八種工具跨越多個日期。

正文

A date aggregation can answer a precise question. What was the median architecture drift among the tests run that day? It takes a different experimental design to answer whether running the same test on a different day affects the result. Start by measuring coverage in both directions. Count the distinct tools on each date, then count the distinct dates for each tool. A large daily sample can still represent a narrow slice of the benchmark, and a tool appearing on several dates can be doing different work each time.

The example embeds all 119 observations from 12 virtual staging tools, using anonymous IDs assigned in order of appearance. Each row holds a tool ID, a test date, and a recorded drift score. Lower drift means better preservation of the source image's walls, windows, and doors. All 119 rows have scores. The medians include the 26 raw unaligned scores and the eight scores with unknown alignment status. See the StagingBench results for the benchmark context.

DictReader reads the header from the embedded string. A Counter tracks n, the number of rows with each date. Each date's list holds the numeric scores that go into median. Sets track coverage so another row for the same tool on the same date increases n while leaving the distinct counts alone. Blank scores stay out of the median, and a date with no scores prints NA. Rows with a blank date are skipped. Rows with a blank tool ID still contribute to the date summary, with that ID excluded from the coverage counts. ISO dates sort chronologically as strings.

import csv
from collections import Counter, defaultdict
from statistics import median

data = """tool,tested,architecture_drift
01,2026-10-19,16.2
01,2026-10-19,32.9
01,2026-10-21,9.2
01,2026-10-21,40.1
01,2026-10-21,13.7
01,2026-10-21,43.4
01,2026-10-21,41.0
01,2026-10-28,11.6
01,2026-10-28,13.1
01,2026-10-28,22.7
02,2026-10-19,11.0
02,2026-10-19,24.1
02,2026-10-19,21.7
02,2026-10-19,56.5
02,2026-10-19,21.4
02,2026-10-24,26.2
02,2026-10-24,35.1
02,2026-10-24,17.4
02,2026-10-24,9.2
02,2026-10-24,28.0
03,2026-10-19,28.2
03,2026-10-27,30.6
03,2026-10-28,29.7
03,2026-10-28,29.0
03,2026-11-06,15.5
03,2026-11-06,21.1
03,2026-11-06,18.0
03,2026-11-06,12.6
03,2026-11-06,14.9
03,2026-11-06,20.2
04,2026-10-19,27.1
04,2026-10-19,26.6
04,2026-10-19,33.5
04,2026-10-19,28.8
04,2026-10-19,22.5
04,2026-10-19,21.3
04,2026-10-27,24.4
04,2026-10-27,23.5
04,2026-10-27,26.9
04,2026-10-27,26.6
05,2026-11-10,29.4
05,2026-11-10,6.1
05,2026-11-10,23.6
05,2026-11-10,61.5
05,2026-11-10,36.2
05,2026-11-10,57.3
05,2026-11-10,30.4
05,2026-11-10,22.0
05,2026-11-10,11.4
05,2026-11-10,19.9
06,2026-10-19,18.1
06,2026-10-21,23.3
06,2026-10-21,21.0
06,2026-10-21,33.3
06,2026-10-21,14.8
06,2026-10-21,22.5
06,2026-10-21,35.2
06,2026-10-27,27.4
06,2026-10-27,10.2
06,2026-10-27,21.2
07,2026-10-27,25.4
07,2026-10-27,33.6
07,2026-10-27,22.9
07,2026-11-06,50.4
07,2026-11-06,38.0
07,2026-11-06,34.9
07,2026-11-06,46.3
07,2026-11-06,38.7
07,2026-11-06,20.4
07,2026-11-06,28.2
08,2026-10-21,11.4
08,2026-10-21,31.3
08,2026-10-21,26.3
08,2026-10-21,15.1
08,2026-10-21,34.9
08,2026-10-21,16.6
08,2026-10-21,23.5
08,2026-10-21,9.7
08,2026-10-21,5.7
08,2026-10-21,24.5
09,2026-10-27,13.3
09,2026-10-28,11.6
09,2026-10-28,26.4
09,2026-10-28,10.4
09,2026-10-28,19.8
09,2026-10-28,26.0
09,2026-10-28,18.9
09,2026-10-28,7.8
09,2026-10-28,23.3
09,2026-10-28,21.0
10,2026-10-27,10.6
10,2026-10-27,27.8
10,2026-10-27,7.5
10,2026-10-28,6.4
10,2026-10-28,7.8
10,2026-10-28,13.7
10,2026-10-28,9.7
10,2026-10-28,8.9
10,2026-10-28,3.1
10,2026-10-28,17.0
11,2026-10-28,52.8
11,2026-10-28,27.1
11,2026-10-28,61.3
11,2026-10-28,54.5
11,2026-10-28,7.2
11,2026-10-28,9.7
11,2026-10-28,9.2
11,2026-10-28,35.5
11,2026-10-28,7.7
11,2026-10-28,26.6
12,2026-11-09,18.9
12,2026-11-09,25.4
12,2026-11-09,19.1
12,2026-11-09,15.2
12,2026-11-09,8.0
12,2026-11-09,16.3
12,2026-11-09,42.1
12,2026-11-09,11.8
12,2026-11-09,15.7
"""

counts_by_date = Counter()
scores_by_date = defaultdict(list)
tools_by_date = defaultdict(set)
dates_by_tool = defaultdict(set)

for row in csv.DictReader(data.splitlines()):
    date = row["tested"].strip()
    tool = row["tool"].strip()
    score = row["architecture_drift"].strip()
    if not date:
        continue
    counts_by_date[date] += 1
    if score:
        scores_by_date[date].append(float(score))
    if tool:
        tools_by_date[date].add(tool)
        dates_by_tool[tool].add(date)

print("date n median tools")
for date in sorted(counts_by_date):
    scores = scores_by_date[date]
    middle = f"{median(scores):.1f}" if scores else "NA"
    print(date, counts_by_date[date], middle, len(tools_by_date[date]))

print("\ntool dates")
for tool, dates in sorted(dates_by_tool.items()):
    print(tool, len(dates))

print("\ndates with one tool")
for date, tool_ids in sorted(tools_by_date.items()):
    if len(tool_ids) == 1:
        print(date, next(iter(tool_ids)))

print("\nrows", sum(counts_by_date.values()))
print("tools spanning multiple dates",
      sum(len(dates) > 1 for dates in dates_by_tool.values()))
date n median tools
2026-10-19 15 24.1 5
2026-10-21 21 23.3 3
2026-10-24 5 26.2 1
2026-10-27 15 24.4 6
2026-10-28 31 17.0 5
2026-11-06 13 21.1 2
2026-11-09 9 16.3 1
2026-11-10 10 26.5 1

tool dates
01 3
02 2
03 4
04 2
05 1
06 3
07 2
08 1
09 2
10 2
11 1
12 1

dates with one tool
2026-10-24 02
2026-11-09 12
2026-11-10 05

rows 119
tools spanning multiple dates 8

Of the eight dates from 19 October through 10 November 2026, three have a single tool. Notice the last rows of the daily summary. The endpoints of the median range, 16.3 and 26.5, come from consecutive dates with different tools and different room coverage. Sorting the output makes it easy to read across the calendar. It can also make each successive row look like a new reading from a fixed test configuration, even though the rows represent changing batches.

Eight tools span multiple dates, so filtering to one tool gives you some overlap in tool identity. Checking whether the tests repeat requires the original room column, which the script leaves out because it only computes date and tool summaries. In the full benchmark, all 119 tool and room pairs are distinct. A controlled comparison would retain the room identifier and repeat the same tool on the same source image on different dates, holding settings and scoring consistent. That would let you compute differences within matched pairs before summarizing them across rooms. Here the daily medians describe the batches, and the effect of date remains unresolved.

來源:DEV Community · dev.to