A correlation starts with paired observations. For these results, each pair consists of an editor realism mean and an architecture drift value from the same room record. Before calculating anything, decide which pairs qualify and how missing cells will be represented.
StagingBench has 36 rated records in this selection. Every record contains both numerical values. Some alignment and framing fields are empty, however, and some drift values are explicitly unaligned fallbacks. Those status fields matter when defining an aligned selection.
Read and select the pairs
The following snippet uses the standard library and requires Python 3.10 or later. Run it from the directory containing realism_drift.csv, a flat export of the rated room records from results.json with the columns tool, room, realism_mean, architecture_drift, drift_aligned, framing_pass and alignment_ok. It converts empty cells to None, converts present measurement values to floats, and explicitly excludes any row missing either measurement.
The optional aligned selection requires alignment_ok == 'True' and drift_aligned != 'False'. Text flags remain strings, so the comparisons match their recorded values.
import csv
from statistics import correlation
with open("realism_drift.csv", newline="") as source:
rows = [
{key: None if value == "" else value
for key, value in row.items()}
for row in csv.DictReader(source)
]
for row in rows:
for key in ("realism_mean", "architecture_drift"):
if row[key] is not None:
row[key] = float(row[key])
def report(aligned_only=False):
selected = [
row for row in rows
if row["realism_mean"] is not None
and row["architecture_drift"] is not None
and (
not aligned_only
or (
row["alignment_ok"] == "True"
and row["drift_aligned"] != "False"
)
)
]
x = [row["realism_mean"] for row in selected]
y = [row["architecture_drift"] for row in selected]
print(len(selected), f"{correlation(x, y):.2f}")
report()
report(aligned_only=True)
The recomputed output is:
36 -0.10
24 -0.01
Keep missingness explicit
None represents an absent value, not a numerical observation. Passing it into a numerical calculation does not express a missing-data policy. Substituting a numerical value would express a different policy and alter the observations.
The selection checks both measurement fields in the same row. That preserves the pairing between realism and drift. Removing missing realism values and missing drift values independently could leave the lists describing different records. A correlation requires corresponding observations, not merely lists of the same length.
Use is not None rather than a general truth test. A truth test would also reject a legitimate numerical zero. Missingness and numerical magnitude are different properties, even when the current measurements happen not to expose that distinction.
Report the selection size
Printing n makes the calculation's coverage visible. Here, the measurement completeness check retains all 36 records. The alignment condition narrows the selection to 24.
The aligned filter requires an explicit success flag. A missing alignment flag does not qualify. Its second condition excludes an explicit unaligned drift flag. It does not require that the drift flag itself be explicitly true, which preserves the stated filtering rule.
The full selection includes unaligned fallback drift values. According to the published method, those comparisons mix framing and architecture. The aligned selection has a narrower interpretation. Its correlation answers a question about the qualifying records, rather than replacing the full result.
Read correlation within its scope
The negative sign describes the direction of linear association. Higher realism ratings accompany lower measured drift slightly in the full selection; the aligned result is closer to zero. Neither result establishes a causal relationship.
Correlation is also not agreement. Realism uses an editor rating scale from 1 to 5, while drift uses an automatic scale from 0 to 100. They assess different properties. A correlation does not say that either measurement confirms the other.
These are small selections drawn from 6 tools with uneven rated coverage. The ratings come from one editor and are not blind. The coefficients describe the observed pairs; they do not establish how the relationship would look with broader coverage or independent ratings.
Handle undefined results honestly
statistics.correlation raises statistics.StatisticsError when either input is constant. Pearson correlation divides by quantities representing variation, so a constant input leaves the coefficient undefined. That error does not mean the correlation is zero.
If a later selection produces that error, report that the coefficient is undefined and retain the selection count. The measurement definitions and fallback rules remain available in StagingBench's methodology.
Top comments (0)