TabQueryBench commited on
Commit
5ebbab7
·
verified ·
1 Parent(s): 53fded4

Add files using upload-large-folder tool

Browse files
Files changed (18) hide show
  1. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/_tabpfgen_generate.py +131 -0
  2. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/gen_20260511_061054.log +3 -0
  3. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/input_snapshot.json +3 -0
  4. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/public_gate/normalized_schema_snapshot.json +3 -0
  5. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/public_gate/public_gate_report.json +3 -0
  6. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/public_gate/staged_input_manifest.json +3 -0
  7. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/run_config.json +3 -0
  8. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/runtime_result.json +3 -0
  9. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/staged_features.json +3 -0
  10. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/test.csv +3 -0
  11. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/train.csv +3 -0
  12. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/val.csv +3 -0
  13. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/tabpfgen/adapter_report.json +3 -0
  14. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/tabpfgen/adapter_transforms_applied.json +3 -0
  15. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/tabpfgen/model_input_manifest.json +3 -0
  16. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/tabpfgen-c5-6732-20260511_061054.csv +3 -0
  17. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/tabpfgen_meta.json +3 -0
  18. syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/train_20260511_061054.log +3 -0
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/_tabpfgen_generate.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import numpy as np
3
+ import pandas as pd
4
+ import json
5
+ from tabpfgen import TabPFGen
6
+
7
+ df = pd.read_csv("/work/output-Benchmark-trainonly-v1/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/train.csv")
8
+ target_col = "class"
9
+
10
+ target_missing = df[target_col].isna()
11
+ if target_missing.any():
12
+ dropped = int(target_missing.sum())
13
+ df = df.loc[~target_missing].copy()
14
+ print(
15
+ f"[TabPFGen] Dropped {dropped} rows with missing target '{target_col}'"
16
+ )
17
+ if df.empty:
18
+ raise ValueError(
19
+ f"[TabPFGen] No rows remain after dropping missing target '{target_col}'"
20
+ )
21
+
22
+ feature_cols = [c for c in df.columns if c != target_col]
23
+
24
+ cat_encodings = {}
25
+ for col in feature_cols:
26
+ if df[col].dtype == object or str(df[col].dtype) == 'category':
27
+ cats = sorted(df[col].dropna().unique().tolist(), key=str)
28
+ cat_map = {v: i for i, v in enumerate(cats)}
29
+ df[col] = df[col].map(cat_map).astype(float)
30
+ cat_encodings[col] = cats
31
+ print(f"[TabPFGen] Label-encoded '{col}' ({len(cats)} categories)")
32
+
33
+ target_cats = None
34
+ if df[target_col].dtype == object or str(df[target_col].dtype) == 'category':
35
+ cats = sorted(df[target_col].dropna().unique().tolist(), key=str)
36
+ t_map = {v: i for i, v in enumerate(cats)}
37
+ df[target_col] = df[target_col].map(t_map).astype(float)
38
+ target_cats = cats
39
+ print(f"[TabPFGen] Label-encoded target '{target_col}' ({len(cats)} categories)")
40
+
41
+ X = df[feature_cols].values.astype(np.float32)
42
+ y = df[target_col].values
43
+ fit_rows_cap = max(1, int(os.environ.get("TABPFGEN_FIT_MAX_ROWS", "50000")))
44
+ if len(X) > fit_rows_cap:
45
+ rng = np.random.default_rng(42)
46
+ idx = np.sort(rng.choice(len(X), size=fit_rows_cap, replace=False))
47
+ X = X[idx]
48
+ y = y[idx]
49
+ print(f"[TabPFGen] Downsampled fit rows -> {len(X)} (cap={fit_rows_cap})")
50
+ target_n = int(6732)
51
+
52
+ for i in range(X.shape[1]):
53
+ col_vals = X[:, i]
54
+ mask = np.isnan(col_vals)
55
+ if mask.any():
56
+ mean_val = np.nanmean(col_vals)
57
+ X[mask, i] = mean_val if not np.isnan(mean_val) else 0.0
58
+
59
+ chunk_rows = max(1, int(os.environ.get("TABPFGEN_GEN_CHUNK_ROWS", "256")))
60
+ device = (os.environ.get("TABPFGEN_DEVICE") or "auto").strip() or "auto"
61
+
62
+ n_sgld_steps = max(1, int(os.environ.get("TABPFGEN_N_SGLD_STEPS", "1000")))
63
+ sgld_step_size = float(os.environ.get("TABPFGEN_SGLD_STEP_SIZE", "0.01"))
64
+ sgld_noise_scale = float(os.environ.get("TABPFGEN_SGLD_NOISE_SCALE", "0.01"))
65
+
66
+ # TabPFGen v0.1.x API:仅支持 n_sgld_steps / sgld_* / device。
67
+ # (旧版脚本中的 energy_*_chunk 与上游 TabPFGen 不一致,会导致 TypeError。)
68
+ gen = TabPFGen(
69
+ n_sgld_steps=n_sgld_steps,
70
+ sgld_step_size=sgld_step_size,
71
+ sgld_noise_scale=sgld_noise_scale,
72
+ device=device,
73
+ )
74
+
75
+ print(
76
+ f"[TabPFGen] Generating {target_n} rows via generate_classification "
77
+ f"(chunk_rows={chunk_rows}, device={device}, "
78
+ f"n_sgld_steps={n_sgld_steps}, sgld_step_size={sgld_step_size}, "
79
+ f"sgld_noise_scale={sgld_noise_scale})"
80
+ )
81
+ x_parts = []
82
+ y_parts = []
83
+ remaining = target_n
84
+ while remaining > 0:
85
+ take = min(chunk_rows, remaining)
86
+ X_part, y_part = gen.generate_classification(X, y, n_samples=take)
87
+ x_parts.append(np.asarray(X_part))
88
+ y_parts.append(np.asarray(y_part))
89
+ remaining -= take
90
+ print(f"[TabPFGen] chunk done: take={take}, remaining={remaining}")
91
+
92
+ X_syn = np.concatenate(x_parts, axis=0)
93
+ y_syn = np.concatenate(y_parts, axis=0)
94
+
95
+ syn_df = pd.DataFrame(X_syn, columns=feature_cols)
96
+ syn_df[target_col] = y_syn
97
+
98
+ for col, cats in cat_encodings.items():
99
+ codes = np.round(syn_df[col].values).astype(int)
100
+ codes = np.clip(codes, 0, len(cats) - 1)
101
+ syn_df[col] = [cats[c] for c in codes]
102
+
103
+ if target_cats is not None:
104
+ codes = np.round(syn_df[target_col].values).astype(int)
105
+ codes = np.clip(codes, 0, len(target_cats) - 1)
106
+ syn_df[target_col] = [target_cats[c] for c in codes]
107
+
108
+ if len(syn_df) > target_n:
109
+ print(f"[TabPFGen] Trimming rows: {len(syn_df)} -> {target_n}")
110
+ syn_df = syn_df.iloc[:target_n].copy()
111
+ elif len(syn_df) < target_n:
112
+ deficit = target_n - len(syn_df)
113
+ print(f"[TabPFGen] Padding rows: {len(syn_df)} -> {target_n} (deficit={deficit})")
114
+ if len(syn_df) > 0:
115
+ extra = syn_df.sample(n=deficit, replace=True, random_state=42)
116
+ syn_df = pd.concat(
117
+ [syn_df.reset_index(drop=True), extra.reset_index(drop=True)],
118
+ ignore_index=True,
119
+ )
120
+ else:
121
+ syn_df = df[feature_cols + [target_col]].sample(
122
+ n=target_n, replace=True, random_state=42
123
+ ).reset_index(drop=True)
124
+
125
+ syn_df = syn_df[list(df.columns)]
126
+ if len(syn_df) != target_n:
127
+ raise RuntimeError(
128
+ f"[TabPFGen] Row alignment failed: got {len(syn_df)}, expected {target_n}"
129
+ )
130
+ syn_df.to_csv("/work/output-Benchmark-trainonly-v1/c5/tabpfgen/tabpfgen-c5-20260511_061054/tabpfgen-c5-6732-20260511_061054.csv", index=False)
131
+ print(f"[TabPFGen] Saved {len(syn_df)} rows -> /work/output-Benchmark-trainonly-v1/c5/tabpfgen/tabpfgen-c5-20260511_061054/tabpfgen-c5-6732-20260511_061054.csv")
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/gen_20260511_061054.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1903405b611216531665a2f28b7f544b5c21b50a521bbdca146f773fad8baa87
3
+ size 7005
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/input_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52291b91e8e5a9621446682439a7900b3d8d7e58c3825607dae340737b8b2c21
3
+ size 1351
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/public_gate/normalized_schema_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a82dde0a0b02bb1e4531b9f5e04984f7873c1c4981a2b343015d3a380445ebf
3
+ size 10604
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/public_gate/public_gate_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aea5012ab6077fba838eb8fdd15d8d8fd7e74ddeebf20f9317e675f0f5ab48a8
3
+ size 912
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/public_gate/staged_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93fc022d4623dc6b427cafb4bc02dcca0772fd075741858798fb76bbec3ff5dc
3
+ size 11420
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/run_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2018351074cca9e15290b9997a183181b3be832adda04f4846a2da88cad5e73
3
+ size 2012
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/runtime_result.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6f48376f0e4b48ed211a90be4fce6e84691019cca111aa1e50197da63dede1e
3
+ size 887
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/staged_features.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ace7d0e8b3fdcd849ddbae15387f2fbaeb5a1756991805f39eca5eae193e7f7
3
+ size 2303
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/test.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22374ee05e54a92c07546639c8485d89e02a7c7b38db99ef9ac5dfb259bd032d
3
+ size 125218
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/train.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a23d9f1558e4268759d44a5a58662ddff4e0b757a65c49e7019e9db25203034
3
+ size 997613
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/public/val.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa96f3f053a3ae913c7cd723e390bf19f86afc22192eea09094e136ce2a6eb6c
3
+ size 124824
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/tabpfgen/adapter_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34fad81b4aee6b04f03e3c6938ab63f0410425ac627a4520dad3a365127c680b
3
+ size 324
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/tabpfgen/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/c5/tabpfgen/tabpfgen-c5-20260511_061054/staged/tabpfgen/model_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3a61fffa20fa3c7a47fb5f0bd30704ba90e7477af37b6084c1c265d4323c7d2
3
+ size 11620
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/tabpfgen-c5-6732-20260511_061054.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:396b6d183ed89a0d6bd263d4730cc1d436e0d3e0569545174335614634d3dbf3
3
+ size 1018296
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/tabpfgen_meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cbdc5f2c2aff06a042c37093af56613dfb9644e5eeb06f4e0ee2b3bd09c64e8
3
+ size 445
syntheticSuccess/c5/tabpfgen/tabpfgen-c5-20260511_061054/train_20260511_061054.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e715c0d2fecc9f9973d7ea928ef8413aaa3b43bdb9f1fc1b4d213ded8540cc75
3
+ size 595