Add files using upload-large-folder tool
Browse files- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/_tabpfgen_generate.py +122 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/gen_20260505_030225.log +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/input_snapshot.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/public_gate/normalized_schema_snapshot.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/public_gate/public_gate_report.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/public_gate/staged_input_manifest.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/run_config.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/runtime_result.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/staged_features.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/test.csv +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/train.csv +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/val.csv +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/tabpfgen/adapter_report.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/tabpfgen/adapter_transforms_applied.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/tabpfgen/model_input_manifest.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/tabpfgen-m4-2217-20260505_030225.csv +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/tabpfgen_meta.json +3 -0
- syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/train_20260505_030225.log +3 -0
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/_tabpfgen_generate.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/train.csv")
|
| 8 |
+
target_col = "charges"
|
| 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(2217)
|
| 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 |
+
# TabPFGen v0.1.x API:仅支持 n_sgld_steps / sgld_* / device。
|
| 63 |
+
# (旧版脚本中的 energy_*_chunk 与上游 TabPFGen 不一致,会导致 TypeError。)
|
| 64 |
+
gen = TabPFGen(
|
| 65 |
+
n_sgld_steps=1000,
|
| 66 |
+
sgld_step_size=0.01,
|
| 67 |
+
sgld_noise_scale=0.01,
|
| 68 |
+
device=device,
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
print(f"[TabPFGen] Generating {target_n} rows via generate_regression (chunk_rows={chunk_rows}, device={device})")
|
| 72 |
+
x_parts = []
|
| 73 |
+
y_parts = []
|
| 74 |
+
remaining = target_n
|
| 75 |
+
while remaining > 0:
|
| 76 |
+
take = min(chunk_rows, remaining)
|
| 77 |
+
X_part, y_part = gen.generate_regression(X, y, n_samples=take)
|
| 78 |
+
x_parts.append(np.asarray(X_part))
|
| 79 |
+
y_parts.append(np.asarray(y_part))
|
| 80 |
+
remaining -= take
|
| 81 |
+
print(f"[TabPFGen] chunk done: take={take}, remaining={remaining}")
|
| 82 |
+
|
| 83 |
+
X_syn = np.concatenate(x_parts, axis=0)
|
| 84 |
+
y_syn = np.concatenate(y_parts, axis=0)
|
| 85 |
+
|
| 86 |
+
syn_df = pd.DataFrame(X_syn, columns=feature_cols)
|
| 87 |
+
syn_df[target_col] = y_syn
|
| 88 |
+
|
| 89 |
+
for col, cats in cat_encodings.items():
|
| 90 |
+
codes = np.round(syn_df[col].values).astype(int)
|
| 91 |
+
codes = np.clip(codes, 0, len(cats) - 1)
|
| 92 |
+
syn_df[col] = [cats[c] for c in codes]
|
| 93 |
+
|
| 94 |
+
if target_cats is not None:
|
| 95 |
+
codes = np.round(syn_df[target_col].values).astype(int)
|
| 96 |
+
codes = np.clip(codes, 0, len(target_cats) - 1)
|
| 97 |
+
syn_df[target_col] = [target_cats[c] for c in codes]
|
| 98 |
+
|
| 99 |
+
if len(syn_df) > target_n:
|
| 100 |
+
print(f"[TabPFGen] Trimming rows: {len(syn_df)} -> {target_n}")
|
| 101 |
+
syn_df = syn_df.iloc[:target_n].copy()
|
| 102 |
+
elif len(syn_df) < target_n:
|
| 103 |
+
deficit = target_n - len(syn_df)
|
| 104 |
+
print(f"[TabPFGen] Padding rows: {len(syn_df)} -> {target_n} (deficit={deficit})")
|
| 105 |
+
if len(syn_df) > 0:
|
| 106 |
+
extra = syn_df.sample(n=deficit, replace=True, random_state=42)
|
| 107 |
+
syn_df = pd.concat(
|
| 108 |
+
[syn_df.reset_index(drop=True), extra.reset_index(drop=True)],
|
| 109 |
+
ignore_index=True,
|
| 110 |
+
)
|
| 111 |
+
else:
|
| 112 |
+
syn_df = df[feature_cols + [target_col]].sample(
|
| 113 |
+
n=target_n, replace=True, random_state=42
|
| 114 |
+
).reset_index(drop=True)
|
| 115 |
+
|
| 116 |
+
syn_df = syn_df[list(df.columns)]
|
| 117 |
+
if len(syn_df) != target_n:
|
| 118 |
+
raise RuntimeError(
|
| 119 |
+
f"[TabPFGen] Row alignment failed: got {len(syn_df)}, expected {target_n}"
|
| 120 |
+
)
|
| 121 |
+
syn_df.to_csv("/work/output-Benchmark-trainonly-v1/m4/tabpfgen/tabpfgen-m4-20260505_030225/tabpfgen-m4-2217-20260505_030225.csv", index=False)
|
| 122 |
+
print(f"[TabPFGen] Saved {len(syn_df)} rows -> /work/output-Benchmark-trainonly-v1/m4/tabpfgen/tabpfgen-m4-20260505_030225/tabpfgen-m4-2217-20260505_030225.csv")
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/gen_20260505_030225.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b6580001583c1c0704b41554e91bc208af2e855556277b6d5542f51d26cd20c2
|
| 3 |
+
size 7438
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/input_snapshot.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb9d6e284dde8d3e2739a7093bdb3ebc04c5755a1d00c76e60c85fc3285ec8d6
|
| 3 |
+
size 1346
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/public_gate/normalized_schema_snapshot.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:147188e89a0542cf3b022c634e88c2d00f2d4ee70b9581034df8ccb87204eee8
|
| 3 |
+
size 3234
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/public_gate/public_gate_report.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:515294ac3f64bc7db5c9724dba42d4156b6a574241ce8cc363ba379c85326f47
|
| 3 |
+
size 910
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/public_gate/staged_input_manifest.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8356465accf9e9e6c864be84804ec143bc85e8fb90f2ffc4e28f9ee18458403c
|
| 3 |
+
size 4050
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/run_config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c4ffc9d8cd91bb733f22527593866cbac3ee4da3c2a9db24716699ab9dacba97
|
| 3 |
+
size 2084
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/runtime_result.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:95c6094e6f844e50f81b679f769199015b411482ed45977e3f64add642129e4f
|
| 3 |
+
size 887
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/staged_features.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1207bcd03560fd5e534c9b55e7ef32d0bf5bf1ccb7c37782749c850b76b062ef
|
| 3 |
+
size 644
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/test.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4c541b677fb2d45c5bc79338eeee9fd8c91484b195a0c2c546c2fbabf113b7ea
|
| 3 |
+
size 11298
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/train.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:614ebfac5f41d6f661aff675fa18c0f933a8d9bcc77ea71b7b2360c2f0155837
|
| 3 |
+
size 90069
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/public/val.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e55f5edbe7942ff01630de91a9c70dfbc6445eba76c7b970350364546b67c2d7
|
| 3 |
+
size 11218
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/tabpfgen/adapter_report.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7707a74e2a238918541d4c4d9cbab15045d60e67612458ad5157da89eedfeb0c
|
| 3 |
+
size 324
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/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/m4/tabpfgen/tabpfgen-m4-20260505_030225/staged/tabpfgen/model_input_manifest.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7e8d427e66a99bae21d9772c290697d66f8d224380e065a6cb663f3322a56713
|
| 3 |
+
size 4250
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/tabpfgen-m4-2217-20260505_030225.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b4c0c13ac1cbf18b17e0667a942c83ea71fde2c166ef1e918bb89ba0fd4ce2df
|
| 3 |
+
size 151485
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/tabpfgen_meta.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d22bd793f56da4a58199dd51483fcb086c928ebee3173bcc24f794189b8ddd0c
|
| 3 |
+
size 443
|
syntheticSuccess/m4/tabpfgen/tabpfgen-m4-20260505_030225/train_20260505_030225.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0e080b1b30975dc81ec4667ba1a26d54aa1e5166e8667083ad70b642286aad4
|
| 3 |
+
size 595
|