TabQueryBench commited on
Commit
66c7934
·
verified ·
1 Parent(s): 3ebd36d

Add files using upload-large-folder tool

Browse files
Files changed (17) hide show
  1. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/_tabpfgen_generate.py +100 -0
  2. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/gen_20260501_041015.log +3 -0
  3. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/input_snapshot.json +3 -0
  4. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/public_gate/normalized_schema_snapshot.json +3 -0
  5. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/public_gate/public_gate_report.json +3 -0
  6. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/public_gate/staged_input_manifest.json +3 -0
  7. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/runtime_result.json +3 -0
  8. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/staged_features.json +3 -0
  9. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/test.csv +3 -0
  10. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/train.csv +3 -0
  11. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/val.csv +3 -0
  12. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/tabpfgen/adapter_report.json +3 -0
  13. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/tabpfgen/adapter_transforms_applied.json +3 -0
  14. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/tabpfgen/model_input_manifest.json +3 -0
  15. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/tabpfgen-m8-36168-20260501_041015.csv +3 -0
  16. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/tabpfgen_meta.json +3 -0
  17. syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/train_20260501_041015.log +3 -0
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/_tabpfgen_generate.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/train.csv")
8
+ target_col = "y"
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
+ target_n = int(36168)
44
+
45
+ for i in range(X.shape[1]):
46
+ col_vals = X[:, i]
47
+ mask = np.isnan(col_vals)
48
+ if mask.any():
49
+ mean_val = np.nanmean(col_vals)
50
+ X[mask, i] = mean_val if not np.isnan(mean_val) else 0.0
51
+
52
+ # TabPFGen v0.1.x API:仅支持 n_sgld_steps / sgld_* / device。
53
+ # (旧版脚本中的 energy_*_chunk 与上游 TabPFGen 不一致,会导致 TypeError。)
54
+ gen = TabPFGen(
55
+ n_sgld_steps=1000,
56
+ sgld_step_size=0.01,
57
+ sgld_noise_scale=0.01,
58
+ device="auto",
59
+ )
60
+
61
+ print(f"[TabPFGen] Generating {target_n} rows via generate_classification")
62
+ X_syn, y_syn = gen.generate_classification(X, y, n_samples=target_n)
63
+
64
+ syn_df = pd.DataFrame(X_syn, columns=feature_cols)
65
+ syn_df[target_col] = y_syn
66
+
67
+ for col, cats in cat_encodings.items():
68
+ codes = np.round(syn_df[col].values).astype(int)
69
+ codes = np.clip(codes, 0, len(cats) - 1)
70
+ syn_df[col] = [cats[c] for c in codes]
71
+
72
+ if target_cats is not None:
73
+ codes = np.round(syn_df[target_col].values).astype(int)
74
+ codes = np.clip(codes, 0, len(target_cats) - 1)
75
+ syn_df[target_col] = [target_cats[c] for c in codes]
76
+
77
+ if len(syn_df) > target_n:
78
+ print(f"[TabPFGen] Trimming rows: {len(syn_df)} -> {target_n}")
79
+ syn_df = syn_df.iloc[:target_n].copy()
80
+ elif len(syn_df) < target_n:
81
+ deficit = target_n - len(syn_df)
82
+ print(f"[TabPFGen] Padding rows: {len(syn_df)} -> {target_n} (deficit={deficit})")
83
+ if len(syn_df) > 0:
84
+ extra = syn_df.sample(n=deficit, replace=True, random_state=42)
85
+ syn_df = pd.concat(
86
+ [syn_df.reset_index(drop=True), extra.reset_index(drop=True)],
87
+ ignore_index=True,
88
+ )
89
+ else:
90
+ syn_df = df[feature_cols + [target_col]].sample(
91
+ n=target_n, replace=True, random_state=42
92
+ ).reset_index(drop=True)
93
+
94
+ syn_df = syn_df[list(df.columns)]
95
+ if len(syn_df) != target_n:
96
+ raise RuntimeError(
97
+ f"[TabPFGen] Row alignment failed: got {len(syn_df)}, expected {target_n}"
98
+ )
99
+ syn_df.to_csv("/work/output-Benchmark-trainonly-v1/m8/tabpfgen/tabpfgen-m8-20260501_041014/tabpfgen-m8-36168-20260501_041015.csv", index=False)
100
+ print(f"[TabPFGen] Saved {len(syn_df)} rows -> /work/output-Benchmark-trainonly-v1/m8/tabpfgen/tabpfgen-m8-20260501_041014/tabpfgen-m8-36168-20260501_041015.csv")
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/gen_20260501_041015.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d5413dbeb0bc7c758aa9f5619c6d0c579940c9af26ad88a327bc5279a246dfe
3
+ size 1400
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/input_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8952bdb9e01456e1e8582817284a7872752773a121d9d6ff1e17cbb281ffb53
3
+ size 1350
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/public_gate/normalized_schema_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d733310afeedb79582ccecc72b050f6a9a712817177584d3824924c50e502e38
3
+ size 7627
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/public_gate/public_gate_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d069ba59e0bad764d31cf1059ffe64fcc37d324eba6441fdff3756c384a2efd7
3
+ size 908
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/public_gate/staged_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:485fb2fe0ee47135674c2ffcfb45827b4b4cf603460dc0cf61e30c79c945fd7f
3
+ size 8443
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/runtime_result.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc38b23a84b164227797423e18ba8583f51deda1f3bd46d7f636fa5fd060a7df
3
+ size 889
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/staged_features.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0cf7f5cbab67fd23b227d3d6dd45fee61797fb10d962495c5e6e65ae5dbcb5f0
3
+ size 1570
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/test.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6221943e422e75c8317b79b7ef93e9cd01f61fdd8de6ce42909a8e4610966310
3
+ size 370991
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/train.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9cbb71aa793de19869a138d41aea5808f772b31082741b185ffb8ca7b821833
3
+ size 2964802
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/public/val.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ee8612128aae92155906abc0fdc752ac24fd04d63c78c080c89e3900efe6525
3
+ size 370535
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/tabpfgen/adapter_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9bd574b9ad704a5e661a5b79fb647756735822ebaeeb99bcb43d0e6bce97190f
3
+ size 324
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/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/m8/tabpfgen/tabpfgen-m8-20260501_041014/staged/tabpfgen/model_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8258f5d2f1d2016b9f7f638a9edc3c07d616db7de36e471b3f88555c695532ec
3
+ size 8643
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/tabpfgen-m8-36168-20260501_041015.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73544a68ce12d9a3954ea8187523cfb72ebfda7d909e0678bc9c594b6c1f249d
3
+ size 4800851
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/tabpfgen_meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bca2a71ae737138e26f018bf1b9f308a21f30a28fe2e02f4b2c7c011c7aeaf42
3
+ size 442
syntheticSuccess/m8/tabpfgen/tabpfgen-m8-20260501_041014/train_20260501_041015.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adf60cf4bb06aa19e6e6234ca72b24e46110e57714d374ed37dff34ceb1a38d8
3
+ size 595