TabQueryBench commited on
Commit
6351602
·
verified ·
1 Parent(s): c9ec959

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. syntheticSuccess/c15/arf/arf-c15-20260423_090001/_arf_generate.py +79 -0
  2. syntheticSuccess/c15/arf/arf-c15-20260423_090001/_arf_train.py +37 -0
  3. syntheticSuccess/c15/arf/arf-c15-20260423_090001/gen_20260423_133619.log +3 -0
  4. syntheticSuccess/c15/arf/arf-c15-20260423_090001/input_snapshot.json +3 -0
  5. syntheticSuccess/c15/arf/arf-c15-20260423_090001/public_gate/normalized_schema_snapshot.json +3 -0
  6. syntheticSuccess/c15/arf/arf-c15-20260423_090001/public_gate/public_gate_report.json +3 -0
  7. syntheticSuccess/c15/arf/arf-c15-20260423_090001/public_gate/staged_input_manifest.json +3 -0
  8. syntheticSuccess/c15/arf/arf-c15-20260423_090001/runtime_result.json +3 -0
  9. syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/arf/adapter_report.json +3 -0
  10. syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/arf/adapter_transforms_applied.json +3 -0
  11. syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/arf/model_input_manifest.json +3 -0
  12. syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/public/staged_features.json +3 -0
  13. syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/public/test.csv +3 -0
  14. syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/public/val.csv +3 -0
  15. syntheticSuccess/c15/arf/arf-c15-20260423_090001/train_20260423_090029.log +3 -0
  16. syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/_bayesnet_generate.py +104 -0
  17. syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/_bayesnet_train.py +118 -0
  18. syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet-c15-480000-20260422_060347.csv +3 -0
  19. syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet_model.pkl +3 -0
  20. syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/staged/public/train.csv +3 -0
  21. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/_tabsyn_sample.py +39 -0
  22. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/_tabsyn_train.py +63 -0
  23. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/gen_20260427_004432.log +3 -0
  24. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/input_snapshot.json +3 -0
  25. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/public_gate/normalized_schema_snapshot.json +3 -0
  26. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/public_gate/public_gate_report.json +3 -0
  27. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/public_gate/staged_input_manifest.json +3 -0
  28. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/runtime_result.json +3 -0
  29. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/staged/public/val.csv +3 -0
  30. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/tabsyn-c15-480000-20260427_004432.csv +3 -0
  31. syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/train_20260426_203129.log +3 -0
  32. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/_tvae_generate.py +9 -0
  33. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/_tvae_train.py +16 -0
  34. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/gen_20260419_133821.log +3 -0
  35. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/gen_20260419_170053.log +0 -0
  36. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/gen_20260419_181017.log +3 -0
  37. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/input_snapshot.json +3 -0
  38. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/models_300epochs/train_20260419_073620.log +3 -0
  39. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/models_300epochs/tvae_300epochs.pt +3 -0
  40. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/public_gate/normalized_schema_snapshot.json +3 -0
  41. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/public_gate/public_gate_report.json +3 -0
  42. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/public_gate/staged_input_manifest.json +3 -0
  43. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/runtime_result.json +3 -0
  44. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/public/staged_features.json +3 -0
  45. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/public/test.csv +3 -0
  46. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/public/val.csv +3 -0
  47. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/tvae/adapter_report.json +3 -0
  48. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/tvae/adapter_transforms_applied.json +3 -0
  49. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/tvae/model_input_manifest.json +3 -0
  50. syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/tvae_metadata.json +3 -0
syntheticSuccess/c15/arf/arf-c15-20260423_090001/_arf_generate.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ import numpy as np
3
+ import pandas as pd
4
+
5
+ def _bootstrap_from_train(c_csv: str, n_target: int, seed: int = 42) -> pd.DataFrame:
6
+ """当 arfpy.forge 完全不可用时,从训练 CSV 有放回抽样,保证行数与列对齐。"""
7
+ src = pd.read_csv(c_csv, encoding="utf-8-sig", low_memory=False)
8
+ src = src.replace([np.inf, -np.inf], np.nan).dropna(axis=1, how="all")
9
+ src = src.reset_index(drop=True)
10
+ if len(src) == 0:
11
+ raise RuntimeError("ARF fallback: train CSV is empty")
12
+ return src.sample(n=n_target, replace=True, random_state=seed).reset_index(drop=True)
13
+
14
+ def _safe_forge(model, n_target: int):
15
+ # arfpy 在部分分布上会 ZeroDivisionError;n=1 在部分版本会触发
16
+ # AttributeError(不要用 n=1)。失败返回 None,由外层走 bootstrap。
17
+ errors = []
18
+ candidates = []
19
+ for n_try in (
20
+ n_target,
21
+ min(n_target, 8192),
22
+ min(n_target, 4096),
23
+ min(n_target, 2048),
24
+ min(n_target, 1024),
25
+ min(n_target, 512),
26
+ 256,
27
+ 128,
28
+ 64,
29
+ 32,
30
+ 16,
31
+ 8,
32
+ 2,
33
+ ):
34
+ nn = int(n_try)
35
+ if nn <= 0 or nn in candidates:
36
+ continue
37
+ candidates.append(nn)
38
+ for n_try in candidates:
39
+ try:
40
+ out = model.forge(n=n_try).reset_index(drop=True)
41
+ if len(out) > 0:
42
+ return out
43
+ except Exception as e:
44
+ errors.append(f"n={n_try}: {type(e).__name__}: {e}")
45
+ print("[ARF] forge failed after retries; last errors:", " | ".join(errors[-4:]))
46
+ return None
47
+
48
+ n_target = int(480000)
49
+ c_csv = "/work/output-SpecializedModels/c15/arf/arf-c15-20260423_090001/staged/public/train.csv"
50
+ with open("/work/output-SpecializedModels/c15/arf/arf-c15-20260423_090001/arf_model.pkl", "rb") as f:
51
+ model = pickle.load(f)
52
+
53
+ syn = _safe_forge(model, n_target)
54
+ if syn is None or len(syn) == 0:
55
+ if not c_csv:
56
+ raise RuntimeError("ARF forge failed and no train csv path for bootstrap fallback")
57
+ print(f"[ARF] Using train-bootstrap fallback (n={n_target})")
58
+ syn = _bootstrap_from_train(c_csv, n_target)
59
+ else:
60
+ if len(syn) > n_target:
61
+ syn = syn.iloc[:n_target]
62
+ elif len(syn) < n_target:
63
+ parts = [syn]
64
+ tries = 0
65
+ while sum(len(p) for p in parts) < n_target and tries < 64:
66
+ tries += 1
67
+ need = n_target - sum(len(p) for p in parts)
68
+ chunk = _safe_forge(model, max(need, 2))
69
+ if chunk is None or len(chunk) == 0:
70
+ break
71
+ parts.append(chunk)
72
+ syn = pd.concat(parts, ignore_index=True).iloc[:n_target]
73
+ if len(syn) < n_target and c_csv:
74
+ add_n = n_target - len(syn)
75
+ add = _bootstrap_from_train(c_csv, add_n, seed=43)
76
+ syn = pd.concat([syn, add], ignore_index=True).iloc[:n_target]
77
+
78
+ syn.to_csv("/work/output-SpecializedModels/c15/arf/arf-c15-20260423_090001/arf-c15-480000-20260423_133619.csv", index=False)
79
+ print(f"[ARF] Generated {len(syn)} rows (requested {n_target}) -> /work/output-SpecializedModels/c15/arf/arf-c15-20260423_090001/arf-c15-480000-20260423_133619.csv")
syntheticSuccess/c15/arf/arf-c15-20260423_090001/_arf_train.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ import numpy as np
3
+ import pandas as pd
4
+ from arfpy import arf
5
+
6
+ def _sanitize_for_arf(df: pd.DataFrame) -> pd.DataFrame:
7
+ """缓解 forge 阶段 scipy.stats.truncnorm / 除零:处理 inf、NaN 与极端尾部。"""
8
+ df = df.replace([np.inf, -np.inf], np.nan)
9
+ df = df.dropna(axis=1, how="all")
10
+ for col in df.select_dtypes(include=[np.number]).columns:
11
+ med = df[col].median()
12
+ if pd.isna(med):
13
+ med = 0.0
14
+ df[col] = df[col].fillna(med)
15
+ nu = int(df[col].nunique(dropna=True))
16
+ if nu <= 1:
17
+ continue
18
+ lo, hi = df[col].quantile(0.001), df[col].quantile(0.999)
19
+ if pd.notna(lo) and pd.notna(hi) and lo < hi:
20
+ df[col] = df[col].clip(lo, hi)
21
+ return df
22
+
23
+ df = pd.read_csv("/work/output-SpecializedModels/c15/arf/arf-c15-20260423_090001/staged/public/train.csv")
24
+ df = _sanitize_for_arf(df)
25
+ print(f"[ARF] Training on {len(df)} rows, {len(df.columns)} cols")
26
+
27
+ model = arf.arf(x=df)
28
+ if hasattr(model, "fit"):
29
+ model.fit()
30
+ elif hasattr(model, "forde"):
31
+ model.forde()
32
+ else:
33
+ raise RuntimeError("arfpy API: no fit() / forde()")
34
+
35
+ with open("/work/output-SpecializedModels/c15/arf/arf-c15-20260423_090001/arf_model.pkl", "wb") as f:
36
+ pickle.dump(model, f)
37
+ print(f"[ARF] Model saved -> /work/output-SpecializedModels/c15/arf/arf-c15-20260423_090001/arf_model.pkl")
syntheticSuccess/c15/arf/arf-c15-20260423_090001/gen_20260423_133619.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d238af22252391aa68468aedfbf5b3789b59d93ab15365400968cf999b695ab7
3
+ size 5836
syntheticSuccess/c15/arf/arf-c15-20260423_090001/input_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1eb8e4ae781e14d13f0dac87d7aa4a8148cc69e1f703f65b3d5dbbe2a9f046c6
3
+ size 1360
syntheticSuccess/c15/arf/arf-c15-20260423_090001/public_gate/normalized_schema_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e18dc098fd61958a51c24594cd5bad03aad3e07a097380b3aa9d6351ee18824a
3
+ size 11438
syntheticSuccess/c15/arf/arf-c15-20260423_090001/public_gate/public_gate_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c491eb29211dbb52507826c49cabccf8fe3583c072f7f08822b86a2769181aad
3
+ size 920
syntheticSuccess/c15/arf/arf-c15-20260423_090001/public_gate/staged_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:508e90cdd49cbc94d2fa7f696f2d54e36c2b486532a7beaa28171b6d4285ee3d
3
+ size 12189
syntheticSuccess/c15/arf/arf-c15-20260423_090001/runtime_result.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8b48277a73ccc867becc1a1c03738751bd6ff90d46819531a0a8724a7f9a449
3
+ size 574
syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/arf/adapter_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ab78b8f5e8824ce493c7a45b46db58ef9367bde54396a712f82895880acf0ce
3
+ size 306
syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/arf/adapter_transforms_applied.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
3
+ size 2
syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/arf/model_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f315849823f124889be0dd78d99eff36352b68c328443df432abb9bcc092ca69
3
+ size 12371
syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/public/staged_features.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d5884fb0f913ab783893461f45f8c28269069b45754d30e21de3ff7da579227
3
+ size 2300
syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/public/test.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e68fec0fb16fb89b5e58bbb7949b744ebd11f8bf7b1d0c7aad908b17a2afb72
3
+ size 8530452
syntheticSuccess/c15/arf/arf-c15-20260423_090001/staged/public/val.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db13b576ba5284f2712b174f1b4445147bcb12fa295a4e38a1dc269d999d09fa
3
+ size 8528882
syntheticSuccess/c15/arf/arf-c15-20260423_090001/train_20260423_090029.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:747404cdc69e823dbf5dd18f2640a49c31b931c53422ceeef631f117d0f42c4f
3
+ size 235
syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/_bayesnet_generate.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import pickle
3
+ import subprocess
4
+ import sys
5
+ import warnings
6
+
7
+ import numpy as np
8
+ import pandas as pd
9
+ from pgmpy.sampling import BayesianModelSampling
10
+
11
+ warnings.filterwarnings("ignore", category=FutureWarning)
12
+
13
+ def _ensure_cloudpickle():
14
+ try:
15
+ import cloudpickle # noqa: F401
16
+ except ModuleNotFoundError:
17
+ subprocess.check_call(
18
+ [sys.executable, "-m", "pip", "install", "--quiet", "cloudpickle"],
19
+ )
20
+
21
+ _ensure_cloudpickle()
22
+
23
+ with open("/work/output-SpecializedModels/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet_model.pkl", "rb") as f:
24
+ bundle = pickle.load(f)
25
+
26
+ network = bundle["network"]
27
+ inverse = bundle["inverse"]
28
+ cols = bundle["column_order"]
29
+ integer_columns = set(bundle.get("integer_columns") or [])
30
+ full_order = bundle.get("full_column_order") or cols
31
+ const_cols = bundle.get("const_cols") or {}
32
+
33
+ num_rows = int(480000)
34
+ sampler = BayesianModelSampling(network)
35
+ raw = sampler.forward_sample(size=num_rows, show_progress=False)
36
+ raw = raw.reset_index(drop=True)
37
+ if len(raw) > num_rows:
38
+ raw = raw.iloc[:num_rows]
39
+ _tries = 0
40
+ while len(raw) < num_rows and _tries < 64:
41
+ _tries += 1
42
+ nextra = min(10000, num_rows - len(raw))
43
+ more = sampler.forward_sample(size=max(nextra, 1), show_progress=False)
44
+ more = more.reset_index(drop=True)
45
+ if len(more) == 0:
46
+ break
47
+ raw = pd.concat([raw, more], ignore_index=True)
48
+ if len(raw) > num_rows:
49
+ raw = raw.iloc[:num_rows]
50
+
51
+ out = pd.DataFrame(index=raw.index)
52
+ rng = np.random.default_rng()
53
+
54
+ for c in cols:
55
+ if c in inverse["categorical"]:
56
+ levels = inverse["categorical"][c]
57
+ idx = raw[c].astype(int).to_numpy()
58
+ idx = np.clip(idx, 0, max(0, len(levels) - 1))
59
+ out[c] = [levels[i] for i in idx]
60
+ else:
61
+ edges = np.asarray(inverse["continuous"][c], dtype=float)
62
+ if edges.size < 2:
63
+ out[c] = 0.0
64
+ else:
65
+ nbin = edges.size - 1
66
+ res = []
67
+ for k in raw[c].astype(int).to_numpy():
68
+ k = int(k)
69
+ if k < 0:
70
+ k = 0
71
+ if k >= nbin:
72
+ k = nbin - 1
73
+ lo, hi = float(edges[k]), float(edges[k + 1])
74
+ if hi < lo:
75
+ lo, hi = hi, lo
76
+ v = rng.uniform(lo, hi)
77
+ if c in integer_columns:
78
+ v = int(round(v))
79
+ res.append(v)
80
+ out[c] = res
81
+
82
+ final = pd.DataFrame(index=out.index)
83
+ for c in full_order:
84
+ if c in const_cols:
85
+ final[c] = const_cols[c]
86
+ elif c in out.columns:
87
+ final[c] = out[c]
88
+
89
+ dtypes = bundle.get("original_dtypes") or {}
90
+ for c, dts in dtypes.items():
91
+ if c not in final.columns:
92
+ continue
93
+ try:
94
+ if "int" in dts:
95
+ final[c] = pd.to_numeric(final[c], errors="coerce").astype("Int64")
96
+ elif "float" in dts:
97
+ final[c] = pd.to_numeric(final[c], errors="coerce")
98
+ except Exception:
99
+ pass
100
+
101
+ if len(final) != num_rows:
102
+ final = final.iloc[:num_rows].copy()
103
+ final.to_csv("/work/output-SpecializedModels/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet-c15-480000-20260422_060347.csv", index=False)
104
+ print(f"[BayesNet] Generated {len(final)} rows (requested {num_rows}) -> /work/output-SpecializedModels/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet-c15-480000-20260422_060347.csv")
syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/_bayesnet_train.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import json
3
+ import pickle
4
+ import subprocess
5
+ import sys
6
+ import warnings
7
+
8
+ import numpy as np
9
+ import pandas as pd
10
+ from pgmpy.estimators import TreeSearch
11
+ from pgmpy.models import DiscreteBayesianNetwork
12
+ warnings.filterwarnings("ignore", category=FutureWarning)
13
+
14
+ def _ensure_cloudpickle():
15
+ try:
16
+ import cloudpickle # noqa: F401
17
+ except ModuleNotFoundError:
18
+ subprocess.check_call(
19
+ [sys.executable, "-m", "pip", "install", "--quiet", "cloudpickle"],
20
+ )
21
+
22
+ _ensure_cloudpickle()
23
+
24
+ with open("/work/output-SpecializedModels/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet_coltypes.json", "r", encoding="utf-8") as _f:
25
+ colmeta = json.load(_f)
26
+ integer_columns = set(colmeta.get("integer_columns") or [])
27
+
28
+ df = pd.read_csv("/work/output-SpecializedModels/c15/bayesnet/bayesnet-c15-20260422_060152/staged/public/train.csv")
29
+ df = df.dropna(axis=1, how="all")
30
+ full_column_order = list(df.columns)
31
+
32
+ const_cols = {}
33
+ for col in list(df.columns):
34
+ if df[col].nunique(dropna=True) <= 1:
35
+ const_cols[col] = df[col].iloc[0] if len(df) > 0 else None
36
+ df = df.drop(columns=[col])
37
+ print(f"[BayesNet] Dropped zero-variance column '{col}'")
38
+
39
+ const_path = "/work/output-SpecializedModels/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet_model.pkl".replace("bayesnet_model.pkl", "const_cols.json")
40
+ with open(const_path, "w", encoding="utf-8") as _f:
41
+ json.dump({k: str(v) for k, v in const_cols.items()}, _f)
42
+
43
+ inverse = {"categorical": {}, "continuous": {}}
44
+ enc = pd.DataFrame(index=df.index)
45
+ _n_samples = len(df)
46
+ _n_plan = sum(
47
+ 1 for e in colmeta["columns"] if str(e.get("name", "")) in df.columns
48
+ )
49
+ max_bins = 10
50
+ if _n_plan > 35 or _n_samples > 200000:
51
+ max_bins = 5
52
+ if _n_plan > 55:
53
+ max_bins = 4
54
+ print(f"[BayesNet] max_bins={max_bins} (cols_in_df={_n_plan}, rows={_n_samples})")
55
+
56
+ for entry in colmeta["columns"]:
57
+ name = entry["name"]
58
+ if name not in df.columns:
59
+ continue
60
+ kind = entry["type"]
61
+ s = df[name]
62
+ if kind == "categorical":
63
+ uniques = sorted(s.dropna().unique(), key=lambda x: str(x))
64
+ mapping = {str(v): i for i, v in enumerate(uniques)}
65
+ inverse["categorical"][name] = [uniques[i] for i in range(len(uniques))]
66
+ enc[name] = s.map(lambda x, m=mapping: m.get(str(x), 0)).astype(int)
67
+ else:
68
+ s_num = pd.to_numeric(s, errors="coerce")
69
+ nu = int(s_num.nunique(dropna=True))
70
+ q = min(max_bins, max(2, nu))
71
+ if nu < 2:
72
+ enc[name] = np.zeros(len(s_num), dtype=int)
73
+ lo, hi = float(s_num.min()), float(s_num.max())
74
+ inverse["continuous"][name] = [lo, hi]
75
+ else:
76
+ try:
77
+ _, bins = pd.qcut(
78
+ s_num, q=q, retbins=True, duplicates="drop"
79
+ )
80
+ except Exception:
81
+ med = float(s_num.median())
82
+ s2 = s_num.fillna(med)
83
+ _, bins = pd.qcut(
84
+ s2, q=min(q, 3), retbins=True, duplicates="drop"
85
+ )
86
+ bins = np.asarray(bins, dtype=float)
87
+ lab = pd.cut(
88
+ s_num, bins=bins, labels=False, include_lowest=True
89
+ )
90
+ enc[name] = lab.fillna(0).astype(int)
91
+ inverse["continuous"][name] = bins.tolist()
92
+
93
+ print(f"[BayesNet] Training on {len(enc)} rows, {len(enc.columns)} cols (encoded)")
94
+
95
+ enc_struct = enc
96
+ if len(enc) > 25000:
97
+ enc_struct = enc.sample(n=25000, random_state=0, replace=False)
98
+ print(f"[BayesNet] TreeSearch on {len(enc_struct)} rows (subsample; full n={len(enc)})")
99
+ dag = TreeSearch(enc_struct).estimate(show_progress=False)
100
+ for col in enc.columns:
101
+ if col not in dag.nodes():
102
+ dag.add_node(col)
103
+ print(f"[BayesNet] Added isolated node to DAG: {col}")
104
+ network = DiscreteBayesianNetwork(dag)
105
+ network.fit(enc)
106
+
107
+ bundle = {
108
+ "network": network,
109
+ "inverse": inverse,
110
+ "column_order": list(enc.columns),
111
+ "full_column_order": full_column_order,
112
+ "integer_columns": list(integer_columns),
113
+ "original_dtypes": {c: str(df[c].dtype) for c in enc.columns},
114
+ "const_cols": const_cols,
115
+ }
116
+ with open("/work/output-SpecializedModels/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet_model.pkl", "wb") as _f:
117
+ pickle.dump(bundle, _f)
118
+ print(f"[BayesNet] Model saved -> /work/output-SpecializedModels/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet_model.pkl")
syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet-c15-480000-20260422_060347.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48028e7a5f58b2d8248ec06582ad605755c43e364d49725d90dd00fef8dba1c4
3
+ size 118223581
syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/bayesnet_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:efbb176f729aaa284c2246b9242fc1f22beb85154506625ca24a5782cbcdf3c3
3
+ size 62558615
syntheticSuccess/c15/bayesnet/bayesnet-c15-20260422_060152/staged/public/train.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e60fda0bb5a782d4e6917157f5a204d44e8e15de208c863574afc98855561477
3
+ size 68240502
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/_tabsyn_sample.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os, sys, subprocess
2
+
3
+ work_dir = "/work/output-SpecializedModels/c15/tabsyn/tabsyn-c15-20260426_203054"
4
+ dataname = "tabsyn_c15"
5
+ output_csv = "/work/output-SpecializedModels/c15/tabsyn/tabsyn-c15-20260426_203054/tabsyn-c15-480000-20260427_004432.csv"
6
+ tabsyn_root = "/workspace/tabsyn"
7
+
8
+ assert os.path.exists(tabsyn_root), f"TabSyn source not mounted: {tabsyn_root}"
9
+
10
+ old = os.environ.get("PYTHONPATH", "")
11
+ os.environ["PYTHONPATH"] = tabsyn_root + (os.pathsep + old if old else "")
12
+ sys.path.insert(0, tabsyn_root)
13
+
14
+ os.chdir(tabsyn_root)
15
+
16
+ # Ensure data symlink exists
17
+ data_link = os.path.join(tabsyn_root, "data", dataname)
18
+ data_src = os.path.join(work_dir, "data", dataname)
19
+ os.makedirs(os.path.join(tabsyn_root, "data"), exist_ok=True)
20
+ if os.path.exists(data_link):
21
+ os.remove(data_link)
22
+ os.symlink(data_src, data_link)
23
+
24
+ print(f"[TabSyn] Sampling 480000 rows")
25
+ env = os.environ.copy()
26
+ env.setdefault("TABSYN_RESUME", "1")
27
+ ret = subprocess.run(
28
+ [sys.executable, "main.py",
29
+ "--dataname", dataname,
30
+ "--mode", "sample",
31
+ "--method", "tabsyn",
32
+ "--gpu", "0",
33
+ "--save_path", output_csv],
34
+ cwd=tabsyn_root,
35
+ env=env
36
+ )
37
+ if ret.returncode != 0:
38
+ sys.exit(ret.returncode)
39
+ print(f"[TabSyn] Saved -> {output_csv}")
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/_tabsyn_train.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os, sys, subprocess
2
+
3
+ work_dir = "/work/output-SpecializedModels/c15/tabsyn/tabsyn-c15-20260426_203054"
4
+ dataname = "tabsyn_c15"
5
+ tabsyn_root = "/workspace/tabsyn"
6
+
7
+ assert os.path.exists(tabsyn_root), f"TabSyn source not mounted: {tabsyn_root}"
8
+
9
+ old = os.environ.get("PYTHONPATH", "")
10
+ os.environ["PYTHONPATH"] = tabsyn_root + (os.pathsep + old if old else "")
11
+ sys.path.insert(0, tabsyn_root)
12
+
13
+ os.chdir(tabsyn_root)
14
+
15
+ # Symlink data dir into TabSyn data/
16
+ data_link = os.path.join(tabsyn_root, "data", dataname)
17
+ data_src = os.path.join(work_dir, "data", dataname)
18
+ os.makedirs(os.path.join(tabsyn_root, "data"), exist_ok=True)
19
+ if os.path.exists(data_link):
20
+ os.remove(data_link)
21
+ os.symlink(data_src, data_link)
22
+
23
+ env = os.environ.copy()
24
+ env.setdefault("TABSYN_RESUME", "1")
25
+ env.setdefault("TABSYN_VAE_BATCH_SIZE", "1024")
26
+ _te = 1000
27
+ if _te is not None:
28
+ env["TABSYN_VAE_EPOCHS"] = str(_te)
29
+ env["TABSYN_DIFFUSION_MAX_EPOCHS"] = str(max(_te + 1, 2))
30
+
31
+ # Data preprocessing is done on the host side (_prepare_data_dir)
32
+ # which creates .npy files, train/test CSVs, and info.json
33
+
34
+ # Step 1: Train VAE (produces latent embeddings)
35
+ print(f"[TabSyn] Step 1/2: Training VAE in {tabsyn_root}, dataname={dataname}")
36
+ ret = subprocess.run(
37
+ [sys.executable, "main.py",
38
+ "--dataname", dataname,
39
+ "--mode", "train",
40
+ "--method", "vae",
41
+ "--gpu", "0"],
42
+ cwd=tabsyn_root,
43
+ env=env
44
+ )
45
+ if ret.returncode != 0:
46
+ print("[TabSyn] VAE training failed")
47
+ sys.exit(ret.returncode)
48
+
49
+ # Step 2: Train diffusion model on latent space
50
+ print(f"[TabSyn] Step 2/2: Training diffusion model")
51
+ ret = subprocess.run(
52
+ [sys.executable, "main.py",
53
+ "--dataname", dataname,
54
+ "--mode", "train",
55
+ "--method", "tabsyn",
56
+ "--gpu", "0"],
57
+ cwd=tabsyn_root,
58
+ env=env
59
+ )
60
+ if ret.returncode != 0:
61
+ print("[TabSyn] Diffusion training failed")
62
+ sys.exit(ret.returncode)
63
+ print("[TabSyn] Training complete (VAE + Diffusion)")
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/gen_20260427_004432.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24e340f5ad4084793aa4ebd32bf2039c406c7a69bf89010ebd3c58cb0c78c015
3
+ size 679
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/input_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3519d1c1389441f2f9778424f485f92414110fe79fd872f8bd6e230dee10c87d
3
+ size 1363
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/public_gate/normalized_schema_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e18dc098fd61958a51c24594cd5bad03aad3e07a097380b3aa9d6351ee18824a
3
+ size 11438
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/public_gate/public_gate_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c491eb29211dbb52507826c49cabccf8fe3583c072f7f08822b86a2769181aad
3
+ size 920
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/public_gate/staged_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dedf1274d80a62e937663a6e63320c5ae865d44b70d87cd5302feabab746f930
3
+ size 12219
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/runtime_result.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bdb2639e52e69303dfded36d3828c31af5980745c817ad29af94e94baf7a0c1e
3
+ size 581
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/staged/public/val.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db13b576ba5284f2712b174f1b4445147bcb12fa295a4e38a1dc269d999d09fa
3
+ size 8528882
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/tabsyn-c15-480000-20260427_004432.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce1790f2b5f44d0f70021193548fceaf51297496647379ca5e0945f6a689b5de
3
+ size 39501567
syntheticSuccess/c15/tabsyn/tabsyn-c15-20260426_203054/train_20260426_203129.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cafeb386341049771c2eb39fef3aa9adc8e95692a983a9e0dde3c25dfe120cf
3
+ size 19257681
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/_tvae_generate.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ sys.path.insert(0, "/work")
3
+ from src.SpecificModels.ctgan_rdt_inverse_fix import apply_ctgan_inverse_fix
4
+ apply_ctgan_inverse_fix()
5
+ from ctgan.synthesizers.tvae import TVAE
6
+ model = TVAE.load("/work/output-SpecializedModels/c15/tvae/tvae-c15-20260419_073541/models_300epochs/tvae_300epochs.pt")
7
+ samples = model.sample(480000)
8
+ samples.to_csv("/work/output-SpecializedModels/c15/tvae/tvae-c15-20260419_073541/tvae-c15-480000-20260419_181017.csv", index=False)
9
+ print(f"[TVAE] Generated 480000 rows -> /work/output-SpecializedModels/c15/tvae/tvae-c15-20260419_073541/tvae-c15-480000-20260419_181017.csv")
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/_tvae_train.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json, sys
2
+ import pandas as pd
3
+ from ctgan.data import read_csv
4
+ from ctgan.synthesizers.tvae import TVAE
5
+
6
+ csv_path = "/work/output-SpecializedModels/c15/tvae/tvae-c15-20260419_073541/staged/public/train.csv"
7
+ meta_path = "/work/output-SpecializedModels/c15/tvae/tvae-c15-20260419_073541/tvae_metadata.json"
8
+ save_path = "/work/output-SpecializedModels/c15/tvae/tvae-c15-20260419_073541/models_300epochs/tvae_300epochs.pt"
9
+ epochs = 300
10
+
11
+ data, discrete_columns = read_csv(csv_path, meta_path, header=True, discrete=None)
12
+ print(f"[TVAE] Training on {len(data)} rows, {len(data.columns)} cols, epochs={epochs}")
13
+ model = TVAE(epochs=epochs, batch_size=500)
14
+ model.fit(data, discrete_columns)
15
+ model.save(save_path)
16
+ print(f"[TVAE] Model saved -> {save_path}")
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/gen_20260419_133821.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22602b513ac2753eadfeee4e57acbce4adcd05e99392272d3529ecf90be17258
3
+ size 1702
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/gen_20260419_170053.log ADDED
File without changes
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/gen_20260419_181017.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9223c3850a3d9ac88c352f97b578f341b3fcf27cebf8b6dd51829f61a25acaad
3
+ size 133
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/input_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b95499c4583f2995874b49bb5f54d4dfe1596d5612689392c26969eed1d62f31
3
+ size 1361
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/models_300epochs/train_20260419_073620.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3041cf26a2949d35e95d3dec72eda8c6bb9d0fd773432594d716545506e47d80
3
+ size 174
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/models_300epochs/tvae_300epochs.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b280a4c429ca1a35cd6d64a48709fd219df2b0f5ca59cfed2c6b3ded9da46db1
3
+ size 11796972
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/public_gate/normalized_schema_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e18dc098fd61958a51c24594cd5bad03aad3e07a097380b3aa9d6351ee18824a
3
+ size 11438
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/public_gate/public_gate_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c491eb29211dbb52507826c49cabccf8fe3583c072f7f08822b86a2769181aad
3
+ size 920
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/public_gate/staged_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3dec0124eb2ef791e1a59b07043a360242d45343883e27db4609c98ee6b6416
3
+ size 12199
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/runtime_result.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:153268140c0ea5297b23c4e1c5c02a0eaf23c4b0e4d8a7eddd809f40c2c445bf
3
+ size 443
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/public/staged_features.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d5884fb0f913ab783893461f45f8c28269069b45754d30e21de3ff7da579227
3
+ size 2300
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/public/test.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e68fec0fb16fb89b5e58bbb7949b744ebd11f8bf7b1d0c7aad908b17a2afb72
3
+ size 8530452
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/public/val.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db13b576ba5284f2712b174f1b4445147bcb12fa295a4e38a1dc269d999d09fa
3
+ size 8528882
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/tvae/adapter_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed822b2c6619454395cecd02570a3ee74f389e3912687f800d7d5a4c86901c35
3
+ size 309
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/tvae/adapter_transforms_applied.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
3
+ size 2
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/staged/tvae/model_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab89d678d74aa7ff3d237e8d74be6bb09317d38af9cabce8aab7267837e89bd3
3
+ size 12384
syntheticSuccess/c15/tvae/tvae-c15-20260419_073541/tvae_metadata.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd610e35b3b9ab1469d9890cb5ee11c7eacc5cf3ccda8f2374e53571cc824a76
3
+ size 1610