Resume SynthData0523 main/c18 batch 1
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+44
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/_arf_generate.pyAdded+23
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/_arf_train.pyAdded+37
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/arf-c18-103976-20260422_073913.csvAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/arf_model.pklAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/gen_20260422_073913.logAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/input_snapshot.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/normalized_schema_snapshot.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/public_gate_report.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/staged_input_manifest.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/runtime_result.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/adapter_report.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/adapter_transforms_applied.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/model_input_manifest.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/staged_features.jsonAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/test.csvAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/train.csvAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/val.csvAdded+3
- SynthData0523/main/c18/arf/arf-c18-20260422_055912/train_20260422_055923.logAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/_bayesnet_generate.pyAdded+105
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/_bayesnet_train.pyAdded+133
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet-c18-103976-20260422_192851.csvAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_coltypes.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_model.pklAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/const_cols.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/gen_20260422_192851.logAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/input_snapshot.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/normalized_schema_snapshot.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/public_gate_report.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/staged_input_manifest.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/runtime_result.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/adapter_report.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/adapter_transforms_applied.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/model_input_manifest.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/staged_features.jsonAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/test.csvAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/train.csvAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/val.csvAdded+3
- SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/train_20260422_192821.logAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/_ctgan_generate.pyAdded+18
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/_ctgan_train.pyAdded+17
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan-c18-103976-20260512_083614.csvAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan_metadata.jsonAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan_train_prepared.csvAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/gen_20260512_083614.logAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/input_snapshot.jsonAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/ctgan_50epochs.ptAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/train_20260511_052110.logAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/public_gate/normalized_schema_snapshot.jsonAdded+3
- SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/public_gate/public_gate_report.jsonAdded+3
2418 unmodified lines241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652418 unmodified linesSynthData0523/main/c17/tvae/tvae-c17-20260328_052612/staged/public/val.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c17/tvae/tvae-c17-20260328_052612/tvae-c17-1000-20260328_053530.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c17/tvae/tvae-c17-20260328_052612/tvae-c17-7045-20260330_065440.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/arf-c18-103976-20260422_073913.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/arf_model.pkl filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/gen_20260422_073913.log filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/input_snapshot.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/normalized_schema_snapshot.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/public_gate_report.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/staged_input_manifest.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/runtime_result.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/adapter_report.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/adapter_transforms_applied.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/model_input_manifest.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/staged_features.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/test.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/train.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/val.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/arf/arf-c18-20260422_055912/train_20260422_055923.log filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet-c18-103976-20260422_192851.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_coltypes.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_model.pkl filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/const_cols.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/gen_20260422_192851.log filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/input_snapshot.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/normalized_schema_snapshot.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/public_gate_report.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/staged_input_manifest.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/runtime_result.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/adapter_report.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/adapter_transforms_applied.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/model_input_manifest.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/staged_features.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/test.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/train.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/val.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/train_20260422_192821.log filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan-c18-103976-20260512_083614.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan_metadata.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan_train_prepared.csv filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/gen_20260512_083614.log filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/input_snapshot.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/ctgan_50epochs.pt filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/train_20260511_052110.log filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/public_gate/normalized_schema_snapshot.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/public_gate/public_gate_report.json filter=lfs diff=lfs merge=lfs -textSynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/public_gate/staged_input_manifest.json filter=lfs diff=lfs merge=lfs -text1234567891011121314151617181920212223import pickleimport pandas as pd
n_target = int(103976)with open("/work/output-SpecializedModels/c18/arf/arf-c18-20260422_055912/arf_model.pkl", "rb") as f: model = pickle.load(f)syn = model.forge(n=n_target)syn = syn.reset_index(drop=True)if len(syn) > n_target: syn = syn.iloc[:n_target]elif len(syn) < n_target: parts = [syn] tries = 0 while sum(len(p) for p in parts) < n_target and tries < 64: tries += 1 need = n_target - sum(len(p) for p in parts) chunk = model.forge(n=max(need, 1)).reset_index(drop=True) if len(chunk) == 0: break parts.append(chunk) syn = pd.concat(parts, ignore_index=True).iloc[:n_target]syn.to_csv("/work/output-SpecializedModels/c18/arf/arf-c18-20260422_055912/arf-c18-103976-20260422_073913.csv", index=False)print(f"[ARF] Generated {len(syn)} rows (requested {n_target}) -> /work/output-SpecializedModels/c18/arf/arf-c18-20260422_055912/arf-c18-103976-20260422_073913.csv")12345678910111213141516171819202122232425262728293031323334353637import pickleimport numpy as npimport pandas as pdfrom arfpy import arf
def _sanitize_for_arf(df: pd.DataFrame) -> pd.DataFrame: """缓解 forge 阶段 scipy.stats.truncnorm / 除零:处理 inf、NaN 与极端尾部。""" df = df.replace([np.inf, -np.inf], np.nan) df = df.dropna(axis=1, how="all") for col in df.select_dtypes(include=[np.number]).columns: med = df[col].median() if pd.isna(med): med = 0.0 df[col] = df[col].fillna(med) nu = int(df[col].nunique(dropna=True)) if nu <= 1: continue lo, hi = df[col].quantile(0.001), df[col].quantile(0.999) if pd.notna(lo) and pd.notna(hi) and lo < hi: df[col] = df[col].clip(lo, hi) return df
df = pd.read_csv("/work/output-SpecializedModels/c18/arf/arf-c18-20260422_055912/staged/public/train.csv")df = _sanitize_for_arf(df)print(f"[ARF] Training on {len(df)} rows, {len(df.columns)} cols")
model = arf.arf(x=df)if hasattr(model, "fit"): model.fit()elif hasattr(model, "forde"): model.forde()else: raise RuntimeError("arfpy API: no fit() / forde()")
with open("/work/output-SpecializedModels/c18/arf/arf-c18-20260422_055912/arf_model.pkl", "wb") as f: pickle.dump(model, f)print(f"[ARF] Model saved -> /work/output-SpecializedModels/c18/arf/arf-c18-20260422_055912/arf_model.pkl")123version https://git-lfs.github.com/spec/v1oid sha256:efd9a936e0a6c2ceb8a2e5b81a75fa2a08274bbff98501c02e20418a0d12993fsize 46496248123version https://git-lfs.github.com/spec/v1oid sha256:5fd1cdc08e24aebcd8a88b5b2389635d905871aa66aae9e6703866890a279836size 1193005953123version https://git-lfs.github.com/spec/v1oid sha256:d78d0b88b9b6251fd3d55a1bb085865159dd2b3c120e56b7a045dc53a8bc38c1size 3624123version https://git-lfs.github.com/spec/v1oid sha256:a1c10b8cc4ec29f65b5327b5abba22064e170a371bbf0842768a4db88eab0e6dsize 1359123version https://git-lfs.github.com/spec/v1oid sha256:ca33a02c28873c5ec5fec52da747d206cd9e461100244e401a7a2e5ef3cba096size 8391123version https://git-lfs.github.com/spec/v1oid sha256:27f1ca3c2a10e936a41ba26048d2f0bc62addbfac55033a559ba761621c8ed22size 921123version https://git-lfs.github.com/spec/v1oid sha256:5326e8dc8c38920650d69a484d1ad0328b0a37a5ec76dc39dae42cf01b199a49size 9142123version https://git-lfs.github.com/spec/v1oid sha256:59011ca16f704b0ef3581e3d556dc196ad7da7332da51aca3f2cc03a750d5428size 574123version https://git-lfs.github.com/spec/v1oid sha256:9a9b26bdad70e840f578c14cbcf2ba40e38f4124c8f67dda44dd0b15181c55b8size 306123version https://git-lfs.github.com/spec/v1oid sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945size 2123version https://git-lfs.github.com/spec/v1oid sha256:e8435b77ec8bc47a4d7cf5f6a6109ea1763384aaa35cf7f0d4fac64df27be8c6size 9324123version https://git-lfs.github.com/spec/v1oid sha256:632cd1c583d7dfd3107947bb9a317b8bb4bc567040e03ec88232c59e6f87a161size 1350123version https://git-lfs.github.com/spec/v1oid sha256:f9b247fe90d1b3de687afbee0871f768b5b9b41d8974110c1a1a4be0a1581258size 5283050123version https://git-lfs.github.com/spec/v1oid sha256:d36ba8fd95415355fed46a70cd71921339f0b4b8f05320279bef35443ce4cc16size 42317177123version https://git-lfs.github.com/spec/v1oid sha256:6368d0c3f97d7449830710d697fc67e7fb71fa7038bc480892279eb41c153f0bsize 5289617123version https://git-lfs.github.com/spec/v1oid sha256:0ab14e38c987b32b095b7647c4be6f6bc305a0c75e29ebc58906f8e65381379esize 625123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
import pickleimport subprocessimport sysimport warnings
import numpy as npimport pandas as pdfrom pgmpy.sampling import BayesianModelSampling
warnings.filterwarnings("ignore", category=FutureWarning)
def _ensure_cloudpickle(): try: import cloudpickle # noqa: F401 except ModuleNotFoundError: subprocess.check_call( [sys.executable, "-m", "pip", "install", "--quiet", "cloudpickle"], )
_ensure_cloudpickle()
with open("/work/output-SpecializedModels/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_model.pkl", "rb") as f: bundle = pickle.load(f)
network = bundle["network"]inverse = bundle["inverse"]cols = bundle["column_order"]integer_columns = set(bundle.get("integer_columns") or [])full_order = bundle.get("full_column_order") or colsconst_cols = bundle.get("const_cols") or {}
num_rows = int(103976)sampler = BayesianModelSampling(network)raw = sampler.forward_sample(size=num_rows, show_progress=False)raw = raw.reset_index(drop=True)if len(raw) > num_rows: raw = raw.iloc[:num_rows]_tries = 0while len(raw) < num_rows and _tries < 64: _tries += 1 nextra = min(10000, num_rows - len(raw)) more = sampler.forward_sample(size=max(nextra, 1), show_progress=False) more = more.reset_index(drop=True) if len(more) == 0: break raw = pd.concat([raw, more], ignore_index=True) if len(raw) > num_rows: raw = raw.iloc[:num_rows]
out = pd.DataFrame(index=raw.index)rng = np.random.default_rng()
for c in cols: if c in inverse["categorical"]: levels = inverse["categorical"][c] idx = raw[c].astype(int).to_numpy() idx = np.clip(idx, 0, max(0, len(levels) - 1)) out[c] = [levels[i] for i in idx] else: edges = np.asarray(inverse["continuous"][c], dtype=float) if edges.size < 2: out[c] = 0.0 else: nbin = edges.size - 1 res = [] for k in raw[c].astype(int).to_numpy(): k = int(k) if k < 0: k = 0 if k >= nbin: k = nbin - 1 lo, hi = float(edges[k]), float(edges[k + 1]) if hi < lo: lo, hi = hi, lo v = rng.uniform(lo, hi) if c in integer_columns: v = int(round(v)) res.append(v) out[c] = res
final = pd.DataFrame(index=out.index)for c in full_order: if c in const_cols: final[c] = const_cols[c] elif c in out.columns: final[c] = out[c]
dtypes = bundle.get("original_dtypes") or {}for c, dts in dtypes.items(): if c not in final.columns: continue try: if "int" in dts: final[c] = pd.to_numeric(final[c], errors="coerce").astype("Int64") elif "float" in dts: final[c] = pd.to_numeric(final[c], errors="coerce") except Exception: pass
if len(final) != num_rows: final = final.iloc[:num_rows].copy()final = final.reset_index(drop=True)final.to_csv("/work/output-SpecializedModels/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet-c18-103976-20260422_192851.csv", index=False)print(f"[BayesNet] Generated {len(final)} rows (requested {num_rows}) -> /work/output-SpecializedModels/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet-c18-103976-20260422_192851.csv")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
import jsonimport pickleimport subprocessimport sysimport warnings
import numpy as npimport pandas as pdfrom pgmpy.estimators import TreeSearchfrom pgmpy.models import DiscreteBayesianNetworkwarnings.filterwarnings("ignore", category=FutureWarning)
def _ensure_cloudpickle(): try: import cloudpickle # noqa: F401 except ModuleNotFoundError: subprocess.check_call( [sys.executable, "-m", "pip", "install", "--quiet", "cloudpickle"], )
_ensure_cloudpickle()
with open("/work/output-SpecializedModels/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_coltypes.json", "r", encoding="utf-8") as _f: colmeta = json.load(_f)integer_columns = set(colmeta.get("integer_columns") or [])
df = pd.read_csv("/work/output-SpecializedModels/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/train.csv")df = df.dropna(axis=1, how="all")full_column_order = list(df.columns)
const_cols = {}for col in list(df.columns): if df[col].nunique(dropna=True) <= 1: const_cols[col] = df[col].iloc[0] if len(df) > 0 else None df = df.drop(columns=[col]) print(f"[BayesNet] Dropped zero-variance column '{col}'")
const_path = "/work/output-SpecializedModels/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_model.pkl".replace("bayesnet_model.pkl", "const_cols.json")with open(const_path, "w", encoding="utf-8") as _f: json.dump({k: str(v) for k, v in const_cols.items()}, _f)
inverse = {"categorical": {}, "continuous": {}}enc = pd.DataFrame(index=df.index)_n_samples = len(df)_n_plan = sum( 1 for e in colmeta["columns"] if str(e.get("name", "")) in df.columns)max_bins = 10max_cat_levels = 256if _n_plan > 35 or _n_samples > 200000: max_bins = 5 max_cat_levels = 64if _n_plan > 55: max_bins = 4 max_cat_levels = 32print( f"[BayesNet] max_bins={max_bins}, max_cat_levels={max_cat_levels} " f"(cols_in_df={_n_plan}, rows={_n_samples})")
for entry in colmeta["columns"]: name = entry["name"] if name not in df.columns: continue kind = entry["type"] s = df[name] if kind == "categorical": s2 = s.astype(str).fillna("__NA__") counts = s2.value_counts(dropna=False) if len(counts) > max_cat_levels: keep = set(counts.index[: max_cat_levels - 1].tolist()) s2 = s2.map(lambda x: x if x in keep else "__OTHER__") uniques = sorted(s2.dropna().unique(), key=lambda x: str(x)) mapping = {str(v): i for i, v in enumerate(uniques)} inverse["categorical"][name] = [uniques[i] for i in range(len(uniques))] enc[name] = s2.map(lambda x, m=mapping: m.get(str(x), 0)).astype(int) else: s_num = pd.to_numeric(s, errors="coerce") nu = int(s_num.nunique(dropna=True)) q = min(max_bins, max(2, nu)) if nu < 2: enc[name] = np.zeros(len(s_num), dtype=int) lo, hi = float(s_num.min()), float(s_num.max()) inverse["continuous"][name] = [lo, hi] else: try: _, bins = pd.qcut( s_num, q=q, retbins=True, duplicates="drop" ) except Exception: med = float(s_num.median()) s2 = s_num.fillna(med) _, bins = pd.qcut( s2, q=min(q, 3), retbins=True, duplicates="drop" ) bins = np.asarray(bins, dtype=float) lab = pd.cut( s_num, bins=bins, labels=False, include_lowest=True ) enc[name] = lab.fillna(0).astype(int) inverse["continuous"][name] = bins.tolist()
print(f"[BayesNet] Training on {len(enc)} rows, {len(enc.columns)} cols (encoded)")
enc_struct = encif len(enc) > 25000: enc_struct = enc.sample(n=25000, random_state=0, replace=False) print(f"[BayesNet] TreeSearch on {len(enc_struct)} rows (subsample; full n={len(enc)})")dag = TreeSearch(enc_struct).estimate(show_progress=False)for col in enc.columns: if col not in dag.nodes(): dag.add_node(col) print(f"[BayesNet] Added isolated node to DAG: {col}")network = DiscreteBayesianNetwork(dag)enc_fit = encif len(enc) > 120000: enc_fit = enc.sample(n=120000, random_state=1, replace=False) print(f"[BayesNet] fit() on {len(enc_fit)} rows (full n={len(enc)})")network.fit(enc_fit)
bundle = { "network": network, "inverse": inverse, "column_order": list(enc.columns), "full_column_order": full_column_order, "integer_columns": list(integer_columns), "original_dtypes": {c: str(df[c].dtype) for c in enc.columns}, "const_cols": const_cols,}with open("/work/output-SpecializedModels/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_model.pkl", "wb") as _f: pickle.dump(bundle, _f)print(f"[BayesNet] Model saved -> /work/output-SpecializedModels/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_model.pkl")123version https://git-lfs.github.com/spec/v1oid sha256:ecdd44d353f4b6e46d8cbf2728e74f4360e1c7a354898df5e5668af813500a0bsize 17511212123version https://git-lfs.github.com/spec/v1oid sha256:8cda6947a7fcf53749561c0079c94010324f32a400d051ad9dc494f71552c810size 989123version https://git-lfs.github.com/spec/v1oid sha256:9e8285ef152901f1195310373b86aa633ed3e0fb68af2808bb4419d55d68a098size 3564015123version https://git-lfs.github.com/spec/v1oid sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8asize 2123version https://git-lfs.github.com/spec/v1oid sha256:4d2434896ab720382c4ae78e684ded2f0da9205ecaba501541abba77bcee11fasize 3396123version https://git-lfs.github.com/spec/v1oid sha256:17f0c9bffdd9d7a3551a0aec99481a7c0b88aba73d374849730b6c57372e07fbsize 1364123version https://git-lfs.github.com/spec/v1oid sha256:ca33a02c28873c5ec5fec52da747d206cd9e461100244e401a7a2e5ef3cba096size 8391123version https://git-lfs.github.com/spec/v1oid sha256:27f1ca3c2a10e936a41ba26048d2f0bc62addbfac55033a559ba761621c8ed22size 921123version https://git-lfs.github.com/spec/v1oid sha256:5682aec53d8dae292824c2456ca9d6c5d80895c34c4a505d8f97ab229ba59422size 9192123version https://git-lfs.github.com/spec/v1oid sha256:a296a7ca8db38deabc940e878d77b5c475a3ec7fdb19e4611d1290ac0365bdb6size 614123version https://git-lfs.github.com/spec/v1oid sha256:fb579c72d5185fd24d7be8806f8ebb105824c580f095aea6acb4e6124f9663desize 321123version https://git-lfs.github.com/spec/v1oid sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945size 2123version https://git-lfs.github.com/spec/v1oid sha256:57286b97c87f0814ae815a3a964ddd33c3d23b95d9b4df881e09f22a440fc158size 9389123version https://git-lfs.github.com/spec/v1oid sha256:632cd1c583d7dfd3107947bb9a317b8bb4bc567040e03ec88232c59e6f87a161size 1350123version https://git-lfs.github.com/spec/v1oid sha256:f9b247fe90d1b3de687afbee0871f768b5b9b41d8974110c1a1a4be0a1581258size 5283050123version https://git-lfs.github.com/spec/v1oid sha256:d36ba8fd95415355fed46a70cd71921339f0b4b8f05320279bef35443ce4cc16size 42317177123version https://git-lfs.github.com/spec/v1oid sha256:6368d0c3f97d7449830710d697fc67e7fb71fa7038bc480892279eb41c153f0bsize 5289617123version https://git-lfs.github.com/spec/v1oid sha256:7dae46b6d3ec0927f712d1c944fdffc026905a5f54f6b09028e201efd026912dsize 3535123456789101112131415161718import syssys.path.insert(0, "/work")from src.SpecificModels.ctgan_rdt_inverse_fix import apply_ctgan_inverse_fixapply_ctgan_inverse_fix()import pandas as pdfrom ctgan.synthesizers.ctgan import CTGANmodel = CTGAN.load("/work/output-Benchmark-trainonly-v1/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/ctgan_50epochs.pt")total = 103976chunk = min(50000, total) if total > 50000 else totalparts = []left = totalwhile left > 0: take = min(chunk, left) parts.append(model.sample(take)) left -= takesampled = pd.concat(parts, ignore_index=True) if len(parts) > 1 else parts[0]sampled.to_csv("/work/output-Benchmark-trainonly-v1/c18/ctgan/ctgan-c18-20260511_052106/ctgan-c18-103976-20260512_083614.csv", index=False)print("[CTGAN] Generated", total, "rows in", len(parts), "chunks ->", "/work/output-Benchmark-trainonly-v1/c18/ctgan/ctgan-c18-20260511_052106/ctgan-c18-103976-20260512_083614.csv")1234567891011121314151617import pandas as pdfrom ctgan.synthesizers.ctgan import CTGAN
data = pd.read_csv("/work/output-Benchmark-trainonly-v1/c18/ctgan/ctgan-c18-20260511_052106/ctgan_train_prepared.csv")discrete_columns = ['country', 'description', 'designation', 'province', 'region_1', 'region_2', 'taster_name', 'taster_twitter_handle', 'title', 'variety', 'winery']model = CTGAN( embedding_dim=4, generator_dim=(8, 8), discriminator_dim=(8, 8), batch_size=4, pac=1, epochs=50, verbose=True,)model.fit(data, discrete_columns)model.save("/work/output-Benchmark-trainonly-v1/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/ctgan_50epochs.pt")print("[CTGAN] Saved model ->", "/work/output-Benchmark-trainonly-v1/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/ctgan_50epochs.pt")123version https://git-lfs.github.com/spec/v1oid sha256:cc1c72fe2070c3164862dd55b9b9157ad1d4df098c49848dfebdb16b40ae31f7size 44702713123version https://git-lfs.github.com/spec/v1oid sha256:0ce70ca4107634e7429768841842833a760655af3d4d43b787f735a8b3e2907asize 964123version https://git-lfs.github.com/spec/v1oid sha256:f9d0f4861cd488757e8489f63c9ecdbece64a3397ecfa3dcd59ed2cbb3807fdcsize 8152223123version https://git-lfs.github.com/spec/v1oid sha256:38cecd657e8654d180231e2267d55086b037a6767567cbfe288e298b4e26dab6size 304123version https://git-lfs.github.com/spec/v1oid sha256:32f3ce9b045a2f4c804a26c2dda5da0e9c450c6e463eb17d1a4e7155067f46a1size 1361123version https://git-lfs.github.com/spec/v1oid sha256:0d55145e0cb30decd982604c86fbc73307b27c52f2498a6e68841791e9464f5csize 13987531981123version https://git-lfs.github.com/spec/v1oid sha256:7c2cc2dbf940c39b9a6d160d59d134aadc48b63aea91fc92a5c6c1eee9ed56a7size 12705123version https://git-lfs.github.com/spec/v1oid sha256:ca33a02c28873c5ec5fec52da747d206cd9e461100244e401a7a2e5ef3cba096size 8391123version https://git-lfs.github.com/spec/v1oid sha256:27f1ca3c2a10e936a41ba26048d2f0bc62addbfac55033a559ba761621c8ed22size 921.gitattributes+44
SynthData0523/main/c18/arf/arf-c18-20260422_055912/_arf_generate.pyAdded+23
SynthData0523/main/c18/arf/arf-c18-20260422_055912/_arf_train.pyAdded+37
SynthData0523/main/c18/arf/arf-c18-20260422_055912/arf-c18-103976-20260422_073913.csvAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/arf_model.pklAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/gen_20260422_073913.logAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/input_snapshot.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/normalized_schema_snapshot.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/public_gate_report.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/public_gate/staged_input_manifest.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/runtime_result.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/adapter_report.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/adapter_transforms_applied.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/arf/model_input_manifest.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/staged_features.jsonAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/test.csvAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/train.csvAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/staged/public/val.csvAdded+3
SynthData0523/main/c18/arf/arf-c18-20260422_055912/train_20260422_055923.logAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/_bayesnet_generate.pyAdded+105
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/_bayesnet_train.pyAdded+133
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet-c18-103976-20260422_192851.csvAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_coltypes.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/bayesnet_model.pklAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/const_cols.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/gen_20260422_192851.logAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/input_snapshot.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/normalized_schema_snapshot.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/public_gate_report.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/public_gate/staged_input_manifest.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/runtime_result.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/adapter_report.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/adapter_transforms_applied.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/bayesnet/model_input_manifest.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/staged_features.jsonAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/test.csvAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/train.csvAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/staged/public/val.csvAdded+3
SynthData0523/main/c18/bayesnet/bayesnet-c18-20260422_192809/train_20260422_192821.logAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/_ctgan_generate.pyAdded+18
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/_ctgan_train.pyAdded+17
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan-c18-103976-20260512_083614.csvAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan_metadata.jsonAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/ctgan_train_prepared.csvAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/gen_20260512_083614.logAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/input_snapshot.jsonAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/ctgan_50epochs.ptAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/models_50epochs/train_20260511_052110.logAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/public_gate/normalized_schema_snapshot.jsonAdded+3
SynthData0523/main/c18/ctgan/ctgan-c18-20260511_052106/public_gate/public_gate_report.jsonAdded+3