Upload conditional strength-focus diagnostics
Browse files- evaluation/query_family/conditional/strength_focus/README.md +19 -0
- evaluation/query_family/conditional/strength_focus/fig_strength_overall_model_bars.pdf +3 -0
- evaluation/query_family/conditional/strength_focus/fig_strength_overall_model_bars.png +3 -0
- evaluation/query_family/conditional/strength_focus/fig_strength_support_bucket_summary.pdf +3 -0
- evaluation/query_family/conditional/strength_focus/fig_strength_support_bucket_summary.png +3 -0
- evaluation/query_family/conditional/strength_focus/fig_strength_support_by_model.pdf +3 -0
- evaluation/query_family/conditional/strength_focus/fig_strength_support_by_model.png +3 -0
- evaluation/query_family/conditional/strength_focus/generate_strength_focus.py +330 -0
- evaluation/query_family/conditional/strength_focus/overall_strength_by_model.csv +12 -0
- evaluation/query_family/conditional/strength_focus/strength_focus_report.md +55 -0
- evaluation/query_family/conditional/strength_focus/strength_support_bucket_summary.csv +4 -0
- evaluation/query_family/conditional/strength_focus/strength_support_by_model.csv +12 -0
- evaluation/query_family/conditional/strength_focus/strength_support_by_model_long.csv +34 -0
evaluation/query_family/conditional/strength_focus/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Strength Focus
|
| 2 |
+
|
| 3 |
+
Strength-only conditional analysis artifacts.
|
| 4 |
+
|
| 5 |
+
Files:
|
| 6 |
+
|
| 7 |
+
- `overall_strength_by_model.csv`
|
| 8 |
+
- `strength_support_bucket_summary.csv`
|
| 9 |
+
- `strength_support_by_model.csv`
|
| 10 |
+
- `fig_strength_overall_model_bars.png`
|
| 11 |
+
- `fig_strength_support_bucket_summary.png`
|
| 12 |
+
- `fig_strength_support_by_model.png`
|
| 13 |
+
- `strength_focus_report.md`
|
| 14 |
+
|
| 15 |
+
Generate / refresh:
|
| 16 |
+
|
| 17 |
+
```bash
|
| 18 |
+
python Evaluation/query_fivepart_breakdown/conditional_breakdown/strength_focus/generate_strength_focus.py
|
| 19 |
+
```
|
evaluation/query_family/conditional/strength_focus/fig_strength_overall_model_bars.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:353cae0ea826b521ebb0b032ffd87aeec785038cac0636666038c838aeb55dd8
|
| 3 |
+
size 19019
|
evaluation/query_family/conditional/strength_focus/fig_strength_overall_model_bars.png
ADDED
|
Git LFS Details
|
evaluation/query_family/conditional/strength_focus/fig_strength_support_bucket_summary.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6badf98aee1e280362012d390f625a873818b52210711b66d9521c7261709dde
|
| 3 |
+
size 13309
|
evaluation/query_family/conditional/strength_focus/fig_strength_support_bucket_summary.png
ADDED
|
Git LFS Details
|
evaluation/query_family/conditional/strength_focus/fig_strength_support_by_model.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb2d4ab340222cffde36380057774d0488e36f323b50da7f3ba2e79f001039e2
|
| 3 |
+
size 17440
|
evaluation/query_family/conditional/strength_focus/fig_strength_support_by_model.png
ADDED
|
Git LFS Details
|
evaluation/query_family/conditional/strength_focus/generate_strength_focus.py
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
import matplotlib.pyplot as plt
|
| 6 |
+
import numpy as np
|
| 7 |
+
import pandas as pd
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
ROOT = Path(__file__).resolve().parents[4]
|
| 11 |
+
BASE = ROOT / "Evaluation" / "query_fivepart_breakdown" / "conditional_breakdown"
|
| 12 |
+
OUT_DIR = BASE / "strength_focus"
|
| 13 |
+
RUN_DIR = (
|
| 14 |
+
BASE
|
| 15 |
+
/ "locality_support_diagnostics"
|
| 16 |
+
/ "runs"
|
| 17 |
+
/ "20260502_064421_conditional_locality_support"
|
| 18 |
+
/ "data"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
MODEL_COLORS = {
|
| 22 |
+
"RealTabFormer": "#332288",
|
| 23 |
+
"TVAE": "#4477AA",
|
| 24 |
+
"ForestDiffusion": "#228833",
|
| 25 |
+
"TabDDPM": "#EE7733",
|
| 26 |
+
"TabSyn": "#66CCEE",
|
| 27 |
+
"TabDiff": "#AA3377",
|
| 28 |
+
"CTGAN": "#EE6677",
|
| 29 |
+
"ARF": "#777777",
|
| 30 |
+
"BayesNet": "#CCBB44",
|
| 31 |
+
"TabPFGen": "#009988",
|
| 32 |
+
"TabbyFlow": "#882255",
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
SUPPORT_BUCKET_ORDER = ["dense", "medium", "sparse"]
|
| 36 |
+
SUPPORT_BUCKET_LABELS = {"dense": "Dense", "medium": "Medium", "sparse": "Sparse"}
|
| 37 |
+
SUPPORT_BUCKET_COLORS = {"dense": "#1b9e77", "medium": "#7570b3", "sparse": "#d95f02"}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def _assign_primary_support_buckets(audit_df: pd.DataFrame) -> pd.DataFrame:
|
| 41 |
+
case_df = audit_df[
|
| 42 |
+
[
|
| 43 |
+
"dataset_id",
|
| 44 |
+
"query_id",
|
| 45 |
+
"real_support_value",
|
| 46 |
+
"support_main_eligible",
|
| 47 |
+
"support_recovery_mode",
|
| 48 |
+
"template_name",
|
| 49 |
+
]
|
| 50 |
+
].drop_duplicates()
|
| 51 |
+
eligible = case_df[
|
| 52 |
+
(case_df["support_main_eligible"] == True)
|
| 53 |
+
& (case_df["support_recovery_mode"].isin(["exact", "derived_exact"]))
|
| 54 |
+
& (case_df["real_support_value"].notna())
|
| 55 |
+
].copy()
|
| 56 |
+
|
| 57 |
+
rows: list[pd.DataFrame] = []
|
| 58 |
+
for dataset_id, group in eligible.groupby("dataset_id", sort=False):
|
| 59 |
+
values = pd.to_numeric(group["real_support_value"], errors="coerce")
|
| 60 |
+
if group.shape[0] < 3 or values.dropna().nunique() < 3:
|
| 61 |
+
continue
|
| 62 |
+
ranked = values.rank(method="first")
|
| 63 |
+
bins = pd.qcut(ranked, q=3, labels=["sparse", "medium", "dense"])
|
| 64 |
+
assigned = group[["dataset_id", "query_id"]].copy()
|
| 65 |
+
assigned["support_bucket"] = bins.astype(str)
|
| 66 |
+
rows.append(assigned)
|
| 67 |
+
return pd.concat(rows, ignore_index=True)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _build_strength_tables() -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]:
|
| 71 |
+
model_summary = pd.read_csv(BASE / "final" / "model_summary__v2.csv")
|
| 72 |
+
audit = pd.read_csv(RUN_DIR / "conditional_support_method_audit.csv")
|
| 73 |
+
bucket_map = _assign_primary_support_buckets(audit)
|
| 74 |
+
|
| 75 |
+
overall = model_summary[
|
| 76 |
+
[
|
| 77 |
+
"model_label",
|
| 78 |
+
"dataset_count",
|
| 79 |
+
"dependency_strength_similarity__mean",
|
| 80 |
+
"dependency_strength_similarity__ci95_low",
|
| 81 |
+
"dependency_strength_similarity__ci95_high",
|
| 82 |
+
"dependency_strength_similarity__ci95_radius",
|
| 83 |
+
]
|
| 84 |
+
].rename(
|
| 85 |
+
columns={
|
| 86 |
+
"dependency_strength_similarity__mean": "strength_mean",
|
| 87 |
+
"dependency_strength_similarity__ci95_low": "strength_ci95_low",
|
| 88 |
+
"dependency_strength_similarity__ci95_high": "strength_ci95_high",
|
| 89 |
+
"dependency_strength_similarity__ci95_radius": "strength_ci95_radius",
|
| 90 |
+
}
|
| 91 |
+
)
|
| 92 |
+
overall = overall.sort_values("strength_mean", ascending=False).reset_index(drop=True)
|
| 93 |
+
|
| 94 |
+
strength_rows = audit[audit["subitem_label"] == "Dependency strength similarity"].copy()
|
| 95 |
+
strength_rows = strength_rows.merge(bucket_map, on=["dataset_id", "query_id"], how="inner")
|
| 96 |
+
|
| 97 |
+
panel_strength = (
|
| 98 |
+
strength_rows.groupby(
|
| 99 |
+
["dataset_id", "dataset_prefix", "model_label", "support_bucket"],
|
| 100 |
+
as_index=False,
|
| 101 |
+
)["query_score"]
|
| 102 |
+
.mean()
|
| 103 |
+
.rename(columns={"query_score": "panel_strength"})
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
bucket_summary = (
|
| 107 |
+
panel_strength.groupby("support_bucket", as_index=False)
|
| 108 |
+
.agg(
|
| 109 |
+
strength_mean=("panel_strength", "mean"),
|
| 110 |
+
strength_std=("panel_strength", "std"),
|
| 111 |
+
panel_count=("panel_strength", "count"),
|
| 112 |
+
)
|
| 113 |
+
.reset_index(drop=True)
|
| 114 |
+
)
|
| 115 |
+
bucket_summary["strength_se"] = bucket_summary["strength_std"] / np.sqrt(bucket_summary["panel_count"])
|
| 116 |
+
bucket_summary["strength_ci95_radius"] = 1.96 * bucket_summary["strength_se"]
|
| 117 |
+
bucket_summary["bucket_label"] = bucket_summary["support_bucket"].map(SUPPORT_BUCKET_LABELS)
|
| 118 |
+
bucket_summary["support_bucket"] = pd.Categorical(
|
| 119 |
+
bucket_summary["support_bucket"], SUPPORT_BUCKET_ORDER, ordered=True
|
| 120 |
+
)
|
| 121 |
+
bucket_summary = bucket_summary.sort_values("support_bucket").reset_index(drop=True)
|
| 122 |
+
|
| 123 |
+
model_bucket = (
|
| 124 |
+
panel_strength.groupby(["model_label", "support_bucket"], as_index=False)["panel_strength"]
|
| 125 |
+
.mean()
|
| 126 |
+
.rename(columns={"panel_strength": "strength_mean"})
|
| 127 |
+
)
|
| 128 |
+
model_bucket["bucket_label"] = model_bucket["support_bucket"].map(SUPPORT_BUCKET_LABELS)
|
| 129 |
+
pivot = model_bucket.pivot(index="model_label", columns="support_bucket", values="strength_mean").reset_index()
|
| 130 |
+
for bucket in SUPPORT_BUCKET_ORDER:
|
| 131 |
+
if bucket not in pivot.columns:
|
| 132 |
+
pivot[bucket] = np.nan
|
| 133 |
+
pivot["range"] = pivot[SUPPORT_BUCKET_ORDER].max(axis=1) - pivot[SUPPORT_BUCKET_ORDER].min(axis=1)
|
| 134 |
+
pivot = pivot.sort_values("dense", ascending=False).reset_index(drop=True)
|
| 135 |
+
|
| 136 |
+
return overall, bucket_summary, model_bucket, pivot
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def _plot_overall_strength(overall: pd.DataFrame) -> None:
|
| 140 |
+
fig, ax = plt.subplots(figsize=(11, 6))
|
| 141 |
+
x = np.arange(len(overall))
|
| 142 |
+
colors = [MODEL_COLORS.get(model, "#999999") for model in overall["model_label"]]
|
| 143 |
+
ax.bar(x, overall["strength_mean"], color=colors, edgecolor="black", linewidth=0.5)
|
| 144 |
+
ax.errorbar(
|
| 145 |
+
x,
|
| 146 |
+
overall["strength_mean"],
|
| 147 |
+
yerr=overall["strength_ci95_radius"],
|
| 148 |
+
fmt="none",
|
| 149 |
+
ecolor="black",
|
| 150 |
+
elinewidth=1,
|
| 151 |
+
capsize=3,
|
| 152 |
+
)
|
| 153 |
+
ax.set_xticks(x)
|
| 154 |
+
ax.set_xticklabels(overall["model_label"], rotation=45, ha="right")
|
| 155 |
+
ax.set_ylabel("Dependency strength similarity")
|
| 156 |
+
ax.set_title("Overall conditional strength by model")
|
| 157 |
+
ax.set_ylim(0, 0.8)
|
| 158 |
+
ax.grid(axis="y", alpha=0.25)
|
| 159 |
+
fig.tight_layout()
|
| 160 |
+
fig.savefig(OUT_DIR / "fig_strength_overall_model_bars.png", dpi=220)
|
| 161 |
+
fig.savefig(OUT_DIR / "fig_strength_overall_model_bars.pdf")
|
| 162 |
+
plt.close(fig)
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
def _plot_strength_bucket_summary(bucket_summary: pd.DataFrame) -> None:
|
| 166 |
+
fig, ax = plt.subplots(figsize=(7, 5))
|
| 167 |
+
x = np.arange(len(bucket_summary))
|
| 168 |
+
colors = [SUPPORT_BUCKET_COLORS[b] for b in bucket_summary["support_bucket"].astype(str)]
|
| 169 |
+
ax.bar(x, bucket_summary["strength_mean"], color=colors, edgecolor="black", linewidth=0.6)
|
| 170 |
+
ax.errorbar(
|
| 171 |
+
x,
|
| 172 |
+
bucket_summary["strength_mean"],
|
| 173 |
+
yerr=bucket_summary["strength_ci95_radius"],
|
| 174 |
+
fmt="none",
|
| 175 |
+
ecolor="black",
|
| 176 |
+
elinewidth=1,
|
| 177 |
+
capsize=4,
|
| 178 |
+
)
|
| 179 |
+
ax.set_xticks(x)
|
| 180 |
+
ax.set_xticklabels(bucket_summary["bucket_label"])
|
| 181 |
+
ax.set_ylabel("Dependency strength similarity")
|
| 182 |
+
ax.set_title("Conditional strength by support bucket")
|
| 183 |
+
ax.set_ylim(0, 0.45)
|
| 184 |
+
ax.grid(axis="y", alpha=0.25)
|
| 185 |
+
fig.tight_layout()
|
| 186 |
+
fig.savefig(OUT_DIR / "fig_strength_support_bucket_summary.png", dpi=220)
|
| 187 |
+
fig.savefig(OUT_DIR / "fig_strength_support_bucket_summary.pdf")
|
| 188 |
+
plt.close(fig)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def _plot_strength_by_model_bucket(model_bucket_pivot: pd.DataFrame) -> None:
|
| 192 |
+
models = model_bucket_pivot["model_label"].tolist()
|
| 193 |
+
x = np.arange(len(models))
|
| 194 |
+
width = 0.23
|
| 195 |
+
|
| 196 |
+
fig, ax = plt.subplots(figsize=(12, 6))
|
| 197 |
+
for idx, bucket in enumerate(SUPPORT_BUCKET_ORDER):
|
| 198 |
+
offset = (idx - 1) * width
|
| 199 |
+
ax.bar(
|
| 200 |
+
x + offset,
|
| 201 |
+
model_bucket_pivot[bucket],
|
| 202 |
+
width=width,
|
| 203 |
+
label=SUPPORT_BUCKET_LABELS[bucket],
|
| 204 |
+
color=SUPPORT_BUCKET_COLORS[bucket],
|
| 205 |
+
edgecolor="black",
|
| 206 |
+
linewidth=0.4,
|
| 207 |
+
)
|
| 208 |
+
|
| 209 |
+
ax.set_xticks(x)
|
| 210 |
+
ax.set_xticklabels(models, rotation=45, ha="right")
|
| 211 |
+
ax.set_ylabel("Dependency strength similarity")
|
| 212 |
+
ax.set_title("Conditional strength by model and support bucket")
|
| 213 |
+
ax.set_ylim(0, 0.45)
|
| 214 |
+
ax.grid(axis="y", alpha=0.25)
|
| 215 |
+
ax.legend(frameon=False, ncol=3, loc="upper center")
|
| 216 |
+
fig.tight_layout()
|
| 217 |
+
fig.savefig(OUT_DIR / "fig_strength_support_by_model.png", dpi=220)
|
| 218 |
+
fig.savefig(OUT_DIR / "fig_strength_support_by_model.pdf")
|
| 219 |
+
plt.close(fig)
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
def _write_report(
|
| 223 |
+
overall: pd.DataFrame,
|
| 224 |
+
bucket_summary: pd.DataFrame,
|
| 225 |
+
model_bucket_pivot: pd.DataFrame,
|
| 226 |
+
) -> None:
|
| 227 |
+
top = overall.iloc[0]
|
| 228 |
+
bottom = overall.iloc[-1]
|
| 229 |
+
dense = bucket_summary.loc[bucket_summary["support_bucket"].astype(str) == "dense", "strength_mean"].iloc[0]
|
| 230 |
+
medium = bucket_summary.loc[bucket_summary["support_bucket"].astype(str) == "medium", "strength_mean"].iloc[0]
|
| 231 |
+
sparse = bucket_summary.loc[bucket_summary["support_bucket"].astype(str) == "sparse", "strength_mean"].iloc[0]
|
| 232 |
+
flat = model_bucket_pivot.sort_values("range").head(3)
|
| 233 |
+
volatile = model_bucket_pivot.sort_values("range", ascending=False).head(3)
|
| 234 |
+
|
| 235 |
+
report = f"""# Strength-Only Conditional Analysis
|
| 236 |
+
|
| 237 |
+
## Scope
|
| 238 |
+
|
| 239 |
+
- Focus metric: `dependency_strength_similarity`
|
| 240 |
+
- Overall source: `final/model_summary__v2.csv`
|
| 241 |
+
- Support-bucket source: `locality_support_diagnostics/runs/20260502_064421_conditional_locality_support`
|
| 242 |
+
- Primary support variant: `scalar_filtered_local`
|
| 243 |
+
|
| 244 |
+
## What this isolates
|
| 245 |
+
|
| 246 |
+
This bundle ignores `direction_consistency` and `slice_level_consistency` and asks only one question:
|
| 247 |
+
|
| 248 |
+
> When the real data contains a conditional relationship, does the synthetic data preserve how *strong* that relationship is?
|
| 249 |
+
|
| 250 |
+
In downstream terms, this matters for tasks such as:
|
| 251 |
+
|
| 252 |
+
- deciding which conditional signals look strongest and therefore most actionable
|
| 253 |
+
- ranking features, slices, or segments by how tightly they track an outcome
|
| 254 |
+
- screening for candidate interactions before deeper local analysis
|
| 255 |
+
|
| 256 |
+
If strength is distorted, a downstream analyst may still see the right columns and the right report shape, but mis-rank which relationships deserve attention.
|
| 257 |
+
|
| 258 |
+
## Main findings
|
| 259 |
+
|
| 260 |
+
1. Overall model spread is real but not huge: the top model is `{top['model_label']}` at `{top['strength_mean']:.3f}`, while the weakest is `{bottom['model_label']}` at `{bottom['strength_mean']:.3f}`.
|
| 261 |
+
2. In the primary scalar filtered-local subset, support buckets are close: dense=`{dense:.3f}`, medium=`{medium:.3f}`, sparse=`{sparse:.3f}`.
|
| 262 |
+
3. This means strength does **not** show a clean sparse-support penalty in the current main support diagnostic.
|
| 263 |
+
4. Several models are almost flat across support buckets, especially:
|
| 264 |
+
- `{flat.iloc[0]['model_label']}` range=`{flat.iloc[0]['range']:.3f}`
|
| 265 |
+
- `{flat.iloc[1]['model_label']}` range=`{flat.iloc[1]['range']:.3f}`
|
| 266 |
+
- `{flat.iloc[2]['model_label']}` range=`{flat.iloc[2]['range']:.3f}`
|
| 267 |
+
5. The most bucket-sensitive models still do not follow one universal direction:
|
| 268 |
+
- `{volatile.iloc[0]['model_label']}` range=`{volatile.iloc[0]['range']:.3f}`
|
| 269 |
+
- `{volatile.iloc[1]['model_label']}` range=`{volatile.iloc[1]['range']:.3f}`
|
| 270 |
+
- `{volatile.iloc[2]['model_label']}` range=`{volatile.iloc[2]['range']:.3f}`
|
| 271 |
+
|
| 272 |
+
## Downstream interpretation
|
| 273 |
+
|
| 274 |
+
- Broad implication: many generators change conditional-strength estimates less across dense/medium/sparse local slices than one might expect. The support size of the slice is therefore not the main explanation for strength distortion.
|
| 275 |
+
- Practical implication: if a downstream user relies on synthetic data to decide *which* conditional relationships are strongest, the bigger risk is model-specific calibration of strength, not simply sparse local support.
|
| 276 |
+
- Reading by model family:
|
| 277 |
+
- `RealTabFormer` is strong overall and also stable across buckets, which makes it the cleanest strength-preserving model in the current panel.
|
| 278 |
+
- `BayesNet`, `ARF`, and `CTGAN` are comparatively flat across buckets, suggesting that for these models the strength story is more about their overall calibration level than about sensitivity to sparse slices.
|
| 279 |
+
- `TVAE`, `TabbyFlow`, and `TabSyn` vary more by bucket, but even there the movement is not monotonic dense-to-sparse collapse.
|
| 280 |
+
|
| 281 |
+
## Applicability note
|
| 282 |
+
|
| 283 |
+
The primary `Dense / Medium / Sparse` analysis is **not** a universal conditional-family split.
|
| 284 |
+
It applies only to filtered-local templates whose support can be defined as a scalar real row count:
|
| 285 |
+
|
| 286 |
+
- `Filtered Median Numeric Slice`
|
| 287 |
+
- `Filtered Sum in Numeric Band`
|
| 288 |
+
|
| 289 |
+
`Filtered Two-Dimensional Group Count` is excluded from the main bucket claim because its natural support object is a per-cell count distribution rather than one scalar filtered-row count.
|
| 290 |
+
"""
|
| 291 |
+
(OUT_DIR / "strength_focus_report.md").write_text(report, encoding="utf-8")
|
| 292 |
+
|
| 293 |
+
readme = """# Strength Focus
|
| 294 |
+
|
| 295 |
+
Strength-only conditional analysis artifacts.
|
| 296 |
+
|
| 297 |
+
Files:
|
| 298 |
+
|
| 299 |
+
- `overall_strength_by_model.csv`
|
| 300 |
+
- `strength_support_bucket_summary.csv`
|
| 301 |
+
- `strength_support_by_model.csv`
|
| 302 |
+
- `fig_strength_overall_model_bars.png`
|
| 303 |
+
- `fig_strength_support_bucket_summary.png`
|
| 304 |
+
- `fig_strength_support_by_model.png`
|
| 305 |
+
- `strength_focus_report.md`
|
| 306 |
+
|
| 307 |
+
Generate / refresh:
|
| 308 |
+
|
| 309 |
+
```bash
|
| 310 |
+
python Evaluation/query_fivepart_breakdown/conditional_breakdown/strength_focus/generate_strength_focus.py
|
| 311 |
+
```
|
| 312 |
+
"""
|
| 313 |
+
(OUT_DIR / "README.md").write_text(readme, encoding="utf-8")
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
def main() -> None:
|
| 317 |
+
OUT_DIR.mkdir(parents=True, exist_ok=True)
|
| 318 |
+
overall, bucket_summary, model_bucket, model_bucket_pivot = _build_strength_tables()
|
| 319 |
+
overall.to_csv(OUT_DIR / "overall_strength_by_model.csv", index=False)
|
| 320 |
+
bucket_summary.to_csv(OUT_DIR / "strength_support_bucket_summary.csv", index=False)
|
| 321 |
+
model_bucket_pivot.to_csv(OUT_DIR / "strength_support_by_model.csv", index=False)
|
| 322 |
+
model_bucket.to_csv(OUT_DIR / "strength_support_by_model_long.csv", index=False)
|
| 323 |
+
_plot_overall_strength(overall)
|
| 324 |
+
_plot_strength_bucket_summary(bucket_summary)
|
| 325 |
+
_plot_strength_by_model_bucket(model_bucket_pivot)
|
| 326 |
+
_write_report(overall, bucket_summary, model_bucket_pivot)
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
if __name__ == "__main__":
|
| 330 |
+
main()
|
evaluation/query_family/conditional/strength_focus/overall_strength_by_model.csv
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model_label,dataset_count,strength_mean,strength_ci95_low,strength_ci95_high,strength_ci95_radius
|
| 2 |
+
RealTabFormer,45,0.595599,0.541776,0.649421,0.053823
|
| 3 |
+
TabDiff,16,0.583062,0.455911,0.710212,0.12715
|
| 4 |
+
TabPFGen,38,0.503638,0.421703,0.585573,0.081935
|
| 5 |
+
BayesNet,49,0.495104,0.428611,0.561597,0.066493
|
| 6 |
+
ARF,49,0.483505,0.412391,0.554619,0.071114
|
| 7 |
+
CTGAN,47,0.468992,0.399782,0.538203,0.069211
|
| 8 |
+
TVAE,48,0.446857,0.377867,0.515847,0.06899
|
| 9 |
+
TabbyFlow,31,0.446402,0.35511,0.537693,0.091291
|
| 10 |
+
TabDDPM,38,0.338094,0.264066,0.412121,0.074027
|
| 11 |
+
TabSyn,45,0.320368,0.255435,0.385301,0.064933
|
| 12 |
+
ForestDiffusion,26,0.293929,0.204667,0.38319,0.089262
|
evaluation/query_family/conditional/strength_focus/strength_focus_report.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Strength-Only Conditional Analysis
|
| 2 |
+
|
| 3 |
+
## Scope
|
| 4 |
+
|
| 5 |
+
- Focus metric: `dependency_strength_similarity`
|
| 6 |
+
- Overall source: `final/model_summary__v2.csv`
|
| 7 |
+
- Support-bucket source: `locality_support_diagnostics/runs/20260502_064421_conditional_locality_support`
|
| 8 |
+
- Primary support variant: `scalar_filtered_local`
|
| 9 |
+
|
| 10 |
+
## What this isolates
|
| 11 |
+
|
| 12 |
+
This bundle ignores `direction_consistency` and `slice_level_consistency` and asks only one question:
|
| 13 |
+
|
| 14 |
+
> When the real data contains a conditional relationship, does the synthetic data preserve how *strong* that relationship is?
|
| 15 |
+
|
| 16 |
+
In downstream terms, this matters for tasks such as:
|
| 17 |
+
|
| 18 |
+
- deciding which conditional signals look strongest and therefore most actionable
|
| 19 |
+
- ranking features, slices, or segments by how tightly they track an outcome
|
| 20 |
+
- screening for candidate interactions before deeper local analysis
|
| 21 |
+
|
| 22 |
+
If strength is distorted, a downstream analyst may still see the right columns and the right report shape, but mis-rank which relationships deserve attention.
|
| 23 |
+
|
| 24 |
+
## Main findings
|
| 25 |
+
|
| 26 |
+
1. Overall model spread is real but not huge: the top model is `RealTabFormer` at `0.596`, while the weakest is `ForestDiffusion` at `0.294`.
|
| 27 |
+
2. In the primary scalar filtered-local subset, support buckets are close: dense=`0.300`, medium=`0.285`, sparse=`0.289`.
|
| 28 |
+
3. This means strength does **not** show a clean sparse-support penalty in the current main support diagnostic.
|
| 29 |
+
4. Several models are almost flat across support buckets, especially:
|
| 30 |
+
- `ForestDiffusion` range=`0.000`
|
| 31 |
+
- `TabPFGen` range=`0.000`
|
| 32 |
+
- `RealTabFormer` range=`0.001`
|
| 33 |
+
5. The most bucket-sensitive models still do not follow one universal direction:
|
| 34 |
+
- `TVAE` range=`0.119`
|
| 35 |
+
- `TabDiff` range=`0.067`
|
| 36 |
+
- `TabbyFlow` range=`0.063`
|
| 37 |
+
|
| 38 |
+
## Downstream interpretation
|
| 39 |
+
|
| 40 |
+
- Broad implication: many generators change conditional-strength estimates less across dense/medium/sparse local slices than one might expect. The support size of the slice is therefore not the main explanation for strength distortion.
|
| 41 |
+
- Practical implication: if a downstream user relies on synthetic data to decide *which* conditional relationships are strongest, the bigger risk is model-specific calibration of strength, not simply sparse local support.
|
| 42 |
+
- Reading by model family:
|
| 43 |
+
- `RealTabFormer` is strong overall and also stable across buckets, which makes it the cleanest strength-preserving model in the current panel.
|
| 44 |
+
- `BayesNet`, `ARF`, and `CTGAN` are comparatively flat across buckets, suggesting that for these models the strength story is more about their overall calibration level than about sensitivity to sparse slices.
|
| 45 |
+
- `TVAE`, `TabbyFlow`, and `TabSyn` vary more by bucket, but even there the movement is not monotonic dense-to-sparse collapse.
|
| 46 |
+
|
| 47 |
+
## Applicability note
|
| 48 |
+
|
| 49 |
+
The primary `Dense / Medium / Sparse` analysis is **not** a universal conditional-family split.
|
| 50 |
+
It applies only to filtered-local templates whose support can be defined as a scalar real row count:
|
| 51 |
+
|
| 52 |
+
- `Filtered Median Numeric Slice`
|
| 53 |
+
- `Filtered Sum in Numeric Band`
|
| 54 |
+
|
| 55 |
+
`Filtered Two-Dimensional Group Count` is excluded from the main bucket claim because its natural support object is a per-cell count distribution rather than one scalar filtered-row count.
|
evaluation/query_family/conditional/strength_focus/strength_support_bucket_summary.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
support_bucket,strength_mean,strength_std,panel_count,strength_se,strength_ci95_radius,bucket_label
|
| 2 |
+
dense,0.29968847352024924,0.22754938710139427,214,0.015554955872560056,0.030487713510217708,Dense
|
| 3 |
+
medium,0.28484848484848485,0.22162414027366736,231,0.014581797873706105,0.028580323832463964,Medium
|
| 4 |
+
sparse,0.28879184861717616,0.19719165198754085,229,0.013030791148783387,0.02554035065161544,Sparse
|
evaluation/query_family/conditional/strength_focus/strength_support_by_model.csv
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model_label,dense,medium,sparse,range
|
| 2 |
+
RealTabFormer,0.42424242424242425,0.424,0.425,0.0010000000000000009
|
| 3 |
+
TabSyn,0.3490196078431373,0.37777777777777777,0.4,0.05098039215686273
|
| 4 |
+
TVAE,0.33333333333333337,0.21481481481481485,0.291358024691358,0.11851851851851852
|
| 5 |
+
CTGAN,0.31733333333333336,0.25925925925925924,0.25679012345679014,0.060543209876543214
|
| 6 |
+
TabbyFlow,0.30833333333333335,0.29411764705882354,0.3568627450980392,0.06274509803921569
|
| 7 |
+
ARF,0.29743589743589743,0.27142857142857146,0.2547619047619048,0.04267399267399263
|
| 8 |
+
BayesNet,0.27179487179487183,0.2857142857142857,0.2380952380952381,0.04761904761904759
|
| 9 |
+
TabDDPM,0.26666666666666666,0.3166666666666667,0.275,0.050000000000000044
|
| 10 |
+
ForestDiffusion,0.20000000000000004,0.2,0.2,2.7755575615628914e-17
|
| 11 |
+
TabDiff,0.2,0.2,0.26666666666666666,0.06666666666666665
|
| 12 |
+
TabPFGen,0.2,0.20000000000000004,0.20000000000000004,2.7755575615628914e-17
|
evaluation/query_family/conditional/strength_focus/strength_support_by_model_long.csv
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model_label,support_bucket,strength_mean,bucket_label
|
| 2 |
+
ARF,dense,0.29743589743589743,Dense
|
| 3 |
+
ARF,medium,0.27142857142857146,Medium
|
| 4 |
+
ARF,sparse,0.2547619047619048,Sparse
|
| 5 |
+
BayesNet,dense,0.27179487179487183,Dense
|
| 6 |
+
BayesNet,medium,0.2857142857142857,Medium
|
| 7 |
+
BayesNet,sparse,0.2380952380952381,Sparse
|
| 8 |
+
CTGAN,dense,0.31733333333333336,Dense
|
| 9 |
+
CTGAN,medium,0.25925925925925924,Medium
|
| 10 |
+
CTGAN,sparse,0.25679012345679014,Sparse
|
| 11 |
+
ForestDiffusion,dense,0.20000000000000004,Dense
|
| 12 |
+
ForestDiffusion,medium,0.2,Medium
|
| 13 |
+
ForestDiffusion,sparse,0.2,Sparse
|
| 14 |
+
RealTabFormer,dense,0.42424242424242425,Dense
|
| 15 |
+
RealTabFormer,medium,0.424,Medium
|
| 16 |
+
RealTabFormer,sparse,0.425,Sparse
|
| 17 |
+
TVAE,dense,0.33333333333333337,Dense
|
| 18 |
+
TVAE,medium,0.21481481481481485,Medium
|
| 19 |
+
TVAE,sparse,0.291358024691358,Sparse
|
| 20 |
+
TabDDPM,dense,0.26666666666666666,Dense
|
| 21 |
+
TabDDPM,medium,0.3166666666666667,Medium
|
| 22 |
+
TabDDPM,sparse,0.275,Sparse
|
| 23 |
+
TabDiff,dense,0.2,Dense
|
| 24 |
+
TabDiff,medium,0.2,Medium
|
| 25 |
+
TabDiff,sparse,0.26666666666666666,Sparse
|
| 26 |
+
TabPFGen,dense,0.2,Dense
|
| 27 |
+
TabPFGen,medium,0.20000000000000004,Medium
|
| 28 |
+
TabPFGen,sparse,0.20000000000000004,Sparse
|
| 29 |
+
TabSyn,dense,0.3490196078431373,Dense
|
| 30 |
+
TabSyn,medium,0.37777777777777777,Medium
|
| 31 |
+
TabSyn,sparse,0.4,Sparse
|
| 32 |
+
TabbyFlow,dense,0.30833333333333335,Dense
|
| 33 |
+
TabbyFlow,medium,0.29411764705882354,Medium
|
| 34 |
+
TabbyFlow,sparse,0.3568627450980392,Sparse
|