Add files using upload-large-folder tool
Browse files- syntheticSuccess/n19/arf/arf-n19-20260327_023716/_arf_generate.py +6 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/_arf_train.py +19 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/arf-n19-1000-20260328_031448.csv +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/gen_20260328_031448.log +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/gen_20260330_071040.log +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/input_snapshot.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/public_gate/normalized_schema_snapshot.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/public_gate/public_gate_report.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/public_gate/staged_input_manifest.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/runtime_result.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/arf/adapter_report.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/arf/adapter_transforms_applied.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/arf/model_input_manifest.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/public/staged_features.json +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/public/test.csv +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/public/val.csv +3 -0
- syntheticSuccess/n19/arf/arf-n19-20260327_023716/train_20260327_023807.log +3 -0
- syntheticSuccess/n19/bayesnet/bayesnet-n19-20260422_060152/_bayesnet_generate.py +104 -0
- syntheticSuccess/n19/bayesnet/bayesnet-n19-20260422_060152/_bayesnet_train.py +118 -0
- syntheticSuccess/n19/bayesnet/bayesnet-n19-20260422_060152/staged/public/train.csv +3 -0
- syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/ctgan-n19-1000-20260329_090455.csv +3 -0
- syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/ctgan_metadata.json +3 -0
- syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/gen_20260329_090455.log +0 -0
- syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/gen_20260330_071032.log +0 -0
- syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/input_snapshot.json +3 -0
- syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/models_300epochs/train_20260328_055409.log +3 -0
- syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/runtime_result.json +3 -0
- syntheticSuccess/n19/tabddpm/tabddpm-n19-20260321_170145/_tabddpm_sample.py +66 -0
- syntheticSuccess/n19/tabddpm/tabddpm-n19-20260321_170145/_tabddpm_train.py +32 -0
- syntheticSuccess/n19/tabpfgen/tabpfgen-n19-20260422_212435/_tabpfgen_generate.py +87 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/_tvae_generate.py +5 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/_tvae_train.py +16 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/gen_20260329_023534.log +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/gen_20260330_071036.log +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/input_snapshot.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/models_300epochs/train_20260328_054736.log +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/models_300epochs/tvae_300epochs.pt +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/public_gate/normalized_schema_snapshot.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/public_gate/public_gate_report.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/public_gate/staged_input_manifest.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/runtime_result.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/public/staged_features.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/public/test.csv +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/public/val.csv +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/tvae/adapter_report.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/tvae/adapter_transforms_applied.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/tvae/model_input_manifest.json +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/tvae-n19-1000-20260329_023534.csv +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/tvae-n19-56000-20260330_071036.csv +3 -0
- syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/tvae_metadata.json +3 -0
syntheticSuccess/n19/arf/arf-n19-20260327_023716/_arf_generate.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pickle
|
| 2 |
+
with open("/work/output-SpecializedModels/n19/arf/arf-n19-20260327_023716/arf_model.pkl", "rb") as f:
|
| 3 |
+
model = pickle.load(f)
|
| 4 |
+
syn = model.forge(n=56000)
|
| 5 |
+
syn.to_csv("/work/output-SpecializedModels/n19/arf/arf-n19-20260327_023716/arf-n19-56000-20260330_071040.csv", index=False)
|
| 6 |
+
print(f"[ARF] Generated 56000 rows -> /work/output-SpecializedModels/n19/arf/arf-n19-20260327_023716/arf-n19-56000-20260330_071040.csv")
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/_arf_train.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pickle
|
| 2 |
+
import pandas as pd
|
| 3 |
+
from arfpy import arf
|
| 4 |
+
|
| 5 |
+
df = pd.read_csv("/work/output-SpecializedModels/n19/arf/arf-n19-20260327_023716/staged/public/train.csv")
|
| 6 |
+
df = df.dropna(axis=1, how="all")
|
| 7 |
+
print(f"[ARF] Training on {len(df)} rows, {len(df.columns)} cols")
|
| 8 |
+
|
| 9 |
+
model = arf.arf(x=df)
|
| 10 |
+
if hasattr(model, "fit"):
|
| 11 |
+
model.fit()
|
| 12 |
+
elif hasattr(model, "forde"):
|
| 13 |
+
model.forde()
|
| 14 |
+
else:
|
| 15 |
+
raise RuntimeError("arfpy API: no fit() / forde()")
|
| 16 |
+
|
| 17 |
+
with open("/work/output-SpecializedModels/n19/arf/arf-n19-20260327_023716/arf_model.pkl", "wb") as f:
|
| 18 |
+
pickle.dump(model, f)
|
| 19 |
+
print(f"[ARF] Model saved -> /work/output-SpecializedModels/n19/arf/arf-n19-20260327_023716/arf_model.pkl")
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/arf-n19-1000-20260328_031448.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5084e1c7dc3af0cfa0d6e6d772afda41adbe4a0d3f097c2bc1985ffbf3e17800
|
| 3 |
+
size 12540162
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/gen_20260328_031448.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5e750daa2f7e7c7155935425ab564ab1bd0b95bce64c8e558f371491b09cf86b
|
| 3 |
+
size 441
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/gen_20260330_071040.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8486d5f69322bf45e9514d1457635bb141455e401a645db792ea781a4232df17
|
| 3 |
+
size 443
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/input_snapshot.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:238b937e2640f6e35909a5d98d237449212c8a86bb9fca47bba422c53a55a340
|
| 3 |
+
size 1366
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/public_gate/normalized_schema_snapshot.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:751759bbfaa7742bc3c8bd530c3d29bba8b0e6598d2aba0500b6b981508c8305
|
| 3 |
+
size 358421
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/public_gate/public_gate_report.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ffe1d6021d4588b8dbe5ba851f27df47af01b13c2950f26ffb85d0f86fefd737
|
| 3 |
+
size 919
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/public_gate/staged_input_manifest.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:88a14f9a954cb550a54fec7d6cc015008040d895c7de6ed741c87b6c053c63ec
|
| 3 |
+
size 359172
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/runtime_result.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b48691c1624795cb7138783011c127541378bb3b2450b226992dd2c7966e50f
|
| 3 |
+
size 437
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/arf/adapter_report.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:74fa8fa96837c0c905af2e75ffd312d6d12d5852e0fd31b09d8e37223e752b9e
|
| 3 |
+
size 306
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/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/n19/arf/arf-n19-20260327_023716/staged/arf/model_input_manifest.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e253e975bef3a76e0fa094fd9925e4372490348d3a42caa7fb876c7552e41001
|
| 3 |
+
size 359354
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/public/staged_features.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:506ae856448fbec745984e35d6313eaa3f6fafb49fa3cf7fecf39c9629015f9f
|
| 3 |
+
size 74313
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/public/test.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71d7956b1019f9cdb46e50142bd5567f1efeaf7c9920aed5eb50c3f00da2c0d1
|
| 3 |
+
size 15509649
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/staged/public/val.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a7a9fca60ae4a3ab1e2ffa7930243061d516b3838f19276db27a5dba6fbd905
|
| 3 |
+
size 15543732
|
syntheticSuccess/n19/arf/arf-n19-20260327_023716/train_20260327_023807.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:44888e6b7752f1f0188f9c111269cf1746a96ab933ff8f22fb808f37ac08fecc
|
| 3 |
+
size 461
|
syntheticSuccess/n19/bayesnet/bayesnet-n19-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/n19/bayesnet/bayesnet-n19-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(56000)
|
| 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/n19/bayesnet/bayesnet-n19-20260422_060152/bayesnet-n19-56000-20260422_063223.csv", index=False)
|
| 104 |
+
print(f"[BayesNet] Generated {len(final)} rows (requested {num_rows}) -> /work/output-SpecializedModels/n19/bayesnet/bayesnet-n19-20260422_060152/bayesnet-n19-56000-20260422_063223.csv")
|
syntheticSuccess/n19/bayesnet/bayesnet-n19-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/n19/bayesnet/bayesnet-n19-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/n19/bayesnet/bayesnet-n19-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/n19/bayesnet/bayesnet-n19-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/n19/bayesnet/bayesnet-n19-20260422_060152/bayesnet_model.pkl", "wb") as _f:
|
| 117 |
+
pickle.dump(bundle, _f)
|
| 118 |
+
print(f"[BayesNet] Model saved -> /work/output-SpecializedModels/n19/bayesnet/bayesnet-n19-20260422_060152/bayesnet_model.pkl")
|
syntheticSuccess/n19/bayesnet/bayesnet-n19-20260422_060152/staged/public/train.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5baa195712a9e23e71059aba544f9a7d1cb46594f7f6903469966f66dbcc9beb
|
| 3 |
+
size 124172425
|
syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/ctgan-n19-1000-20260329_090455.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:841032d7ead95f73cb3e97f7e2070c82c52a71aa236e2ae016bcc2cbed0e21ba
|
| 3 |
+
size 2522703
|
syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/ctgan_metadata.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2a407e876f27ba9eec5f7e40615edb1175c98b543bc23fc2ac6cba1f032db16d
|
| 3 |
+
size 51758
|
syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/gen_20260329_090455.log
ADDED
|
File without changes
|
syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/gen_20260330_071032.log
ADDED
|
File without changes
|
syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/input_snapshot.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:39cde201c5fe9ec60bfbe0f1ae0c4d43978791a9b91a43b220817d0f969bfe56
|
| 3 |
+
size 1368
|
syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/models_300epochs/train_20260328_055409.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f4d763dafe6c36c4a16e3b88a70fde519b993d40319b0668ead973a0f17fe184
|
| 3 |
+
size 620
|
syntheticSuccess/n19/ctgan/ctgan-n19-20260328_055241/runtime_result.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2b35b0434132cd541ff1442e3aad1ce2bc9c64eb3a9afb57b0e110208099fe3
|
| 3 |
+
size 447
|
syntheticSuccess/n19/tabddpm/tabddpm-n19-20260321_170145/_tabddpm_sample.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os, sys, subprocess, json
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
tabddpm_root = "/workspace/tabddpm/code"
|
| 6 |
+
assert os.path.isdir(tabddpm_root), f"TabDDPM source not mounted: {tabddpm_root}"
|
| 7 |
+
env = os.environ.copy()
|
| 8 |
+
env["PYTHONPATH"] = tabddpm_root + (os.pathsep + env.get("PYTHONPATH", ""))
|
| 9 |
+
|
| 10 |
+
# Reuse the compat wrapper (patches collections.Sequence for skorch)
|
| 11 |
+
wrapper = os.path.join(tabddpm_root, "_compat_run.py")
|
| 12 |
+
if not os.path.exists(wrapper):
|
| 13 |
+
with open(wrapper, "w") as f:
|
| 14 |
+
f.write(
|
| 15 |
+
"import collections, collections.abc\n"
|
| 16 |
+
"for _a in ('Sequence','MutableSequence','MutableMapping','Mapping',"
|
| 17 |
+
"'MutableSet','Set','Callable','Iterable','Iterator'):\n"
|
| 18 |
+
" if not hasattr(collections, _a): setattr(collections, _a, getattr(collections.abc, _a, None))\n"
|
| 19 |
+
"import sys, runpy\n"
|
| 20 |
+
"sys.argv = sys.argv[1:]\n"
|
| 21 |
+
"runpy.run_path(sys.argv[0], run_name='__main__')\n"
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
print(f"[TabDDPM] Sampling 56000 rows")
|
| 25 |
+
ret = subprocess.run(
|
| 26 |
+
[sys.executable, wrapper, "scripts/pipeline.py",
|
| 27 |
+
"--config", "/work/output-SpecializedModels/n19/tabddpm/tabddpm-n19-20260321_170145/config_sample_20260425_081751.toml",
|
| 28 |
+
"--sample"],
|
| 29 |
+
cwd=tabddpm_root,
|
| 30 |
+
env=env
|
| 31 |
+
)
|
| 32 |
+
if ret.returncode != 0:
|
| 33 |
+
sys.exit(ret.returncode)
|
| 34 |
+
|
| 35 |
+
# 将 .npy 输出转为 CSV(npy 在 TabDDPM 的 parent_dir,即 npy_dir)
|
| 36 |
+
info_path = "/work/output-SpecializedModels/n19/tabddpm/tabddpm-n19-20260321_170145/data/info.json"
|
| 37 |
+
with open(info_path) as f:
|
| 38 |
+
info = json.load(f)
|
| 39 |
+
|
| 40 |
+
output_dir = "/work/output-SpecializedModels/n19/tabddpm/tabddpm-n19-20260321_170145/output"
|
| 41 |
+
col_names = info.get("column_names", [])
|
| 42 |
+
|
| 43 |
+
parts = []
|
| 44 |
+
x_num_path = os.path.join(output_dir, "X_num_train.npy")
|
| 45 |
+
x_cat_path = os.path.join(output_dir, "X_cat_train.npy")
|
| 46 |
+
y_path = os.path.join(output_dir, "y_train.npy")
|
| 47 |
+
|
| 48 |
+
if os.path.exists(x_num_path):
|
| 49 |
+
parts.append(np.load(x_num_path, allow_pickle=True))
|
| 50 |
+
if os.path.exists(x_cat_path):
|
| 51 |
+
parts.append(np.load(x_cat_path, allow_pickle=True).astype(float))
|
| 52 |
+
if os.path.exists(y_path):
|
| 53 |
+
y = np.load(y_path, allow_pickle=True)
|
| 54 |
+
parts.append(y.reshape(-1, 1) if y.ndim == 1 else y)
|
| 55 |
+
|
| 56 |
+
if parts:
|
| 57 |
+
combined = np.concatenate(parts, axis=1)
|
| 58 |
+
if col_names and len(col_names) == combined.shape[1]:
|
| 59 |
+
df = pd.DataFrame(combined, columns=col_names)
|
| 60 |
+
else:
|
| 61 |
+
df = pd.DataFrame(combined)
|
| 62 |
+
df.to_csv("/work/output-SpecializedModels/n19/tabddpm/tabddpm-n19-20260321_170145/tabddpm-n19-56000-20260425_081751.csv", index=False)
|
| 63 |
+
print(f"[TabDDPM] Saved {len(df)} rows -> /work/output-SpecializedModels/n19/tabddpm/tabddpm-n19-20260321_170145/tabddpm-n19-56000-20260425_081751.csv")
|
| 64 |
+
else:
|
| 65 |
+
print("[TabDDPM] WARNING: No output .npy files found")
|
| 66 |
+
sys.exit(1)
|
syntheticSuccess/n19/tabddpm/tabddpm-n19-20260321_170145/_tabddpm_train.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os, sys, subprocess
|
| 2 |
+
|
| 3 |
+
tabddpm_root = "/workspace/tabddpm/code"
|
| 4 |
+
assert os.path.isdir(tabddpm_root), f"TabDDPM source not mounted: {tabddpm_root}"
|
| 5 |
+
env = os.environ.copy()
|
| 6 |
+
env["PYTHONPATH"] = tabddpm_root + (os.pathsep + env.get("PYTHONPATH", ""))
|
| 7 |
+
|
| 8 |
+
# Write a wrapper that patches collections.Sequence (removed in Python 3.10+)
|
| 9 |
+
# before running pipeline.py - needed because skorch uses old API
|
| 10 |
+
wrapper = os.path.join(tabddpm_root, "_compat_run.py")
|
| 11 |
+
with open(wrapper, "w") as f:
|
| 12 |
+
f.write(
|
| 13 |
+
"import collections, collections.abc\n"
|
| 14 |
+
"for _a in ('Sequence','MutableSequence','MutableMapping','Mapping',"
|
| 15 |
+
"'MutableSet','Set','Callable','Iterable','Iterator'):\n"
|
| 16 |
+
" if not hasattr(collections, _a): setattr(collections, _a, getattr(collections.abc, _a, None))\n"
|
| 17 |
+
"import sys, runpy\n"
|
| 18 |
+
"sys.argv = sys.argv[1:]\n"
|
| 19 |
+
"runpy.run_path(sys.argv[0], run_name='__main__')\n"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
print(f"[TabDDPM] Training, config=/work/output-SpecializedModels/n19/tabddpm/tabddpm-n19-20260321_170145/config.toml")
|
| 23 |
+
ret = subprocess.run(
|
| 24 |
+
[sys.executable, wrapper, "scripts/pipeline.py",
|
| 25 |
+
"--config", "/work/output-SpecializedModels/n19/tabddpm/tabddpm-n19-20260321_170145/config.toml",
|
| 26 |
+
"--train"],
|
| 27 |
+
cwd=tabddpm_root,
|
| 28 |
+
env=env
|
| 29 |
+
)
|
| 30 |
+
if ret.returncode != 0:
|
| 31 |
+
sys.exit(ret.returncode)
|
| 32 |
+
print("[TabDDPM] Training complete")
|
syntheticSuccess/n19/tabpfgen/tabpfgen-n19-20260422_212435/_tabpfgen_generate.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import json
|
| 4 |
+
from tabpfgen import TabPFGen
|
| 5 |
+
|
| 6 |
+
df = pd.read_csv("/work/output-SpecializedModels/n19/tabpfgen/tabpfgen-n19-20260422_212435/staged/public/train.csv")
|
| 7 |
+
target_col = "class"
|
| 8 |
+
|
| 9 |
+
feature_cols = [c for c in df.columns if c != target_col]
|
| 10 |
+
|
| 11 |
+
# --- Label-encode categorical / object columns ---
|
| 12 |
+
cat_encodings = {} # col -> list of unique values (index = code)
|
| 13 |
+
for col in feature_cols:
|
| 14 |
+
if df[col].dtype == object or str(df[col].dtype) == 'category':
|
| 15 |
+
cats = sorted(df[col].dropna().unique().tolist(), key=str)
|
| 16 |
+
cat_map = {v: i for i, v in enumerate(cats)}
|
| 17 |
+
df[col] = df[col].map(cat_map).astype(float)
|
| 18 |
+
cat_encodings[col] = cats
|
| 19 |
+
print(f"[TabPFGen] Label-encoded '{col}' ({len(cats)} categories)")
|
| 20 |
+
|
| 21 |
+
# Encode target if categorical
|
| 22 |
+
target_cats = None
|
| 23 |
+
if df[target_col].dtype == object or str(df[target_col].dtype) == 'category':
|
| 24 |
+
cats = sorted(df[target_col].dropna().unique().tolist(), key=str)
|
| 25 |
+
t_map = {v: i for i, v in enumerate(cats)}
|
| 26 |
+
df[target_col] = df[target_col].map(t_map).astype(float)
|
| 27 |
+
target_cats = cats
|
| 28 |
+
print(f"[TabPFGen] Label-encoded target '{target_col}' ({len(cats)} categories)")
|
| 29 |
+
|
| 30 |
+
X = df[feature_cols].values.astype(np.float32)
|
| 31 |
+
y = df[target_col].values
|
| 32 |
+
target_n = int(56000)
|
| 33 |
+
|
| 34 |
+
# Handle NaN
|
| 35 |
+
for i in range(X.shape[1]):
|
| 36 |
+
col_vals = X[:, i]
|
| 37 |
+
mask = np.isnan(col_vals)
|
| 38 |
+
if mask.any():
|
| 39 |
+
mean_val = np.nanmean(col_vals)
|
| 40 |
+
X[mask, i] = mean_val if not np.isnan(mean_val) else 0.0
|
| 41 |
+
|
| 42 |
+
gen = TabPFGen(
|
| 43 |
+
n_sgld_steps=1000,
|
| 44 |
+
sgld_step_size=0.01,
|
| 45 |
+
sgld_noise_scale=0.01,
|
| 46 |
+
device="auto",
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
print(f"[TabPFGen] Generating {target_n} rows via generate_regression")
|
| 50 |
+
X_syn, y_syn = gen.generate_regression(X, y, n_samples=target_n)
|
| 51 |
+
|
| 52 |
+
syn_df = pd.DataFrame(X_syn, columns=feature_cols)
|
| 53 |
+
syn_df[target_col] = y_syn
|
| 54 |
+
|
| 55 |
+
# --- Inverse label-encoding for categorical columns ---
|
| 56 |
+
for col, cats in cat_encodings.items():
|
| 57 |
+
# Round to nearest integer index, clamp to valid range
|
| 58 |
+
codes = np.round(syn_df[col].values).astype(int)
|
| 59 |
+
codes = np.clip(codes, 0, len(cats) - 1)
|
| 60 |
+
syn_df[col] = [cats[c] for c in codes]
|
| 61 |
+
|
| 62 |
+
if target_cats is not None:
|
| 63 |
+
codes = np.round(syn_df[target_col].values).astype(int)
|
| 64 |
+
codes = np.clip(codes, 0, len(target_cats) - 1)
|
| 65 |
+
syn_df[target_col] = [target_cats[c] for c in codes]
|
| 66 |
+
|
| 67 |
+
# Ensure output row count is strictly aligned with target_n.
|
| 68 |
+
if len(syn_df) > target_n:
|
| 69 |
+
print(f"[TabPFGen] Trimming rows: {len(syn_df)} -> {target_n}")
|
| 70 |
+
syn_df = syn_df.iloc[:target_n].copy()
|
| 71 |
+
elif len(syn_df) < target_n:
|
| 72 |
+
deficit = target_n - len(syn_df)
|
| 73 |
+
print(f"[TabPFGen] Padding rows: {len(syn_df)} -> {target_n} (deficit={deficit})")
|
| 74 |
+
if len(syn_df) > 0:
|
| 75 |
+
extra = syn_df.sample(n=deficit, replace=True, random_state=42)
|
| 76 |
+
syn_df = pd.concat([syn_df.reset_index(drop=True), extra.reset_index(drop=True)], ignore_index=True)
|
| 77 |
+
else:
|
| 78 |
+
# Defensive fallback: if generator returns empty, bootstrap from training rows.
|
| 79 |
+
syn_df = df[feature_cols + [target_col]].sample(
|
| 80 |
+
n=target_n, replace=True, random_state=42
|
| 81 |
+
).reset_index(drop=True)
|
| 82 |
+
|
| 83 |
+
syn_df = syn_df[list(df.columns)]
|
| 84 |
+
if len(syn_df) != target_n:
|
| 85 |
+
raise RuntimeError(f"[TabPFGen] Row alignment failed: got {len(syn_df)}, expected {target_n}")
|
| 86 |
+
syn_df.to_csv("/work/output-SpecializedModels/n19/tabpfgen/tabpfgen-n19-20260422_212435/tabpfgen-n19-56000-20260422_212555.csv", index=False)
|
| 87 |
+
print(f"[TabPFGen] Saved {len(syn_df)} rows -> /work/output-SpecializedModels/n19/tabpfgen/tabpfgen-n19-20260422_212435/tabpfgen-n19-56000-20260422_212555.csv")
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/_tvae_generate.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ctgan.synthesizers.tvae import TVAE
|
| 2 |
+
model = TVAE.load("/work/output-SpecializedModels/n19/tvae/tvae-n19-20260328_054608/models_300epochs/tvae_300epochs.pt")
|
| 3 |
+
samples = model.sample(56000)
|
| 4 |
+
samples.to_csv("/work/output-SpecializedModels/n19/tvae/tvae-n19-20260328_054608/tvae-n19-56000-20260330_071036.csv", index=False)
|
| 5 |
+
print(f"[TVAE] Generated 56000 rows -> /work/output-SpecializedModels/n19/tvae/tvae-n19-20260328_054608/tvae-n19-56000-20260330_071036.csv")
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/_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/n19/tvae/tvae-n19-20260328_054608/staged/public/train.csv"
|
| 7 |
+
meta_path = "/work/output-SpecializedModels/n19/tvae/tvae-n19-20260328_054608/tvae_metadata.json"
|
| 8 |
+
save_path = "/work/output-SpecializedModels/n19/tvae/tvae-n19-20260328_054608/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/n19/tvae/tvae-n19-20260328_054608/gen_20260329_023534.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22f7e1ada42efec7f9e7c018587762948c26bd4749a3e2d53b51744eaea57b57
|
| 3 |
+
size 129
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/gen_20260330_071036.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a0e32477e8a2fc77ca2a68e30ba4c48c7ef93ccaf1763e6efb5265918b870a6
|
| 3 |
+
size 131
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/input_snapshot.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9d572a5eef4608a963e4e1d7eb128b413fa5de94e8ae01054bc1c84f48f98bd1
|
| 3 |
+
size 1367
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/models_300epochs/train_20260328_054736.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5849f088f61bf0dc993fed246433302efaece71f5e1d62fdb6416a9dc115a38e
|
| 3 |
+
size 422
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/models_300epochs/tvae_300epochs.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:136bd76da16f1322ce5a871594b94d314ff52f4f2bcd2684dc7436b18aeb4181
|
| 3 |
+
size 32472748
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/public_gate/normalized_schema_snapshot.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:751759bbfaa7742bc3c8bd530c3d29bba8b0e6598d2aba0500b6b981508c8305
|
| 3 |
+
size 358421
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/public_gate/public_gate_report.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ffe1d6021d4588b8dbe5ba851f27df47af01b13c2950f26ffb85d0f86fefd737
|
| 3 |
+
size 919
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/public_gate/staged_input_manifest.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bca5f27341bde34636760e800f7a0316a9197ecd8c53bd0d2a40f93085aa6316
|
| 3 |
+
size 359182
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/runtime_result.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fafd7d20667bc66563523b1082ad5ebb83dbc665caa9f3fc25aba98891440e8e
|
| 3 |
+
size 442
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/public/staged_features.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:506ae856448fbec745984e35d6313eaa3f6fafb49fa3cf7fecf39c9629015f9f
|
| 3 |
+
size 74313
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/public/test.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71d7956b1019f9cdb46e50142bd5567f1efeaf7c9920aed5eb50c3f00da2c0d1
|
| 3 |
+
size 15509649
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/public/val.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a7a9fca60ae4a3ab1e2ffa7930243061d516b3838f19276db27a5dba6fbd905
|
| 3 |
+
size 15543732
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/staged/tvae/adapter_report.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5fd18a8835d7e4a5b836beb9342ffa7f19e94e1e0eef84de2c875eed744070b9
|
| 3 |
+
size 309
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/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/n19/tvae/tvae-n19-20260328_054608/staged/tvae/model_input_manifest.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4f58c992414a74af0a0d78b40fb0fb053956bc7af67a2b0343a0bed079f9ead9
|
| 3 |
+
size 359367
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/tvae-n19-1000-20260329_023534.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d842b8ccb89d0d0deef2107e1ee7328f30c76a7fdf4ca625dd26672468bf3ca
|
| 3 |
+
size 2187982
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/tvae-n19-56000-20260330_071036.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b39bf2881e8b3771bc891d6bd21bd7a92530fb0dd7602e86f8c8fcf152735412
|
| 3 |
+
size 121625198
|
syntheticSuccess/n19/tvae/tvae-n19-20260328_054608/tvae_metadata.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2a407e876f27ba9eec5f7e40615edb1175c98b543bc23fc2ac6cba1f032db16d
|
| 3 |
+
size 51758
|