diff --git a/.gitattributes b/.gitattributes index 5b2091f060ef92297a8bf2a85d2d162d16238c41..1f85e486686406325517e581cc20e17d1d88c9fd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4740,3 +4740,37 @@ SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/check SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/scaler.pt filter=lfs diff=lfs merge=lfs -text SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/scheduler.pt filter=lfs diff=lfs merge=lfs -text SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/training_args.bin filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/train_20260329_231510.log filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/input_snapshot.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/models_tabbyflow/trained.pt filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/normalized_schema_snapshot.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/public_gate_report.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/staged_input_manifest.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/runtime_result.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/staged_features.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/test.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/train.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/val.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_report.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_transforms_applied.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/model_input_manifest.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow_train_meta.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_test.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_train.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_val.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_test.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_train.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_val.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/info.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/real.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/test.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/val.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_test.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_train.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_val.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/train_20260420_063042.log filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/columns.json filter=lfs diff=lfs merge=lfs -text diff --git a/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv new file mode 100644 index 0000000000000000000000000000000000000000..221052bae020346f46e1c71d36fce7eb347ed62d --- /dev/null +++ b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d28b60b361526450f0c203ddf50498854cb66ad5c1978516a99c265f529f8e4f +size 107696 diff --git a/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv new file mode 100644 index 0000000000000000000000000000000000000000..28f63ae8128dbf03647f9cda7458db51d98581f5 --- /dev/null +++ b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d8f85a52de0e63e292778c26cb06223383b366c589d4226c3de68b111ba5272 +size 849500 diff --git a/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv new file mode 100644 index 0000000000000000000000000000000000000000..400c35bc93bd5a660ae20c7574c7bea7bc24035f --- /dev/null +++ b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ede9f1e2036e743d822e8ed8d7b5e1050159e8fc7b402b758a294f7a14528fe +size 108137 diff --git a/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_report.json b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_report.json new file mode 100644 index 0000000000000000000000000000000000000000..dc3dffd82a7729d0af521c031d72e0b8a61d459c --- /dev/null +++ b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_report.json @@ -0,0 +1,7 @@ +{ + "adapter_ready_status": "pass", + "adapter_fail_reason_code": null, + "adapter_fail_detail": null, + "adapter_transforms_applied": [], + "model_input_manifest": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/model_input_manifest.json" +} \ No newline at end of file diff --git a/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_transforms_applied.json b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_transforms_applied.json new file mode 100644 index 0000000000000000000000000000000000000000..0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc --- /dev/null +++ b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_transforms_applied.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/model_input_manifest.json b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/model_input_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..5d1a15ab6182f0b4df2106846605c15d90603828 --- /dev/null +++ b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/model_input_manifest.json @@ -0,0 +1,176 @@ +{ + "dataset_id": "c6", + "model": "realtabformer", + "target_column": "Type of Answer", + "task_type": "classification", + "column_schema": [ + { + "name": "Student ID", + "role": "feature", + "semantic_type": "numeric", + "nullable": false, + "missing_tokens": [], + "parse_format": null, + "impute_strategy": "median", + "profile_stats": { + "missing_rate": 0.0, + "unique_count": 367, + "unique_ratio": 0.048062, + "example_values": [ + "473", + "351", + "967", + "1557", + "394" + ] + } + }, + { + "name": "Student Country", + "role": "feature", + "semantic_type": "categorical", + "nullable": false, + "missing_tokens": [], + "parse_format": null, + "impute_strategy": "mode", + "profile_stats": { + "missing_rate": 0.0, + "unique_count": 8, + "unique_ratio": 0.001048, + "example_values": [ + "Portugal", + "Italy", + "Lithuania", + "Slovenia", + "Ireland" + ] + } + }, + { + "name": "Question ID", + "role": "feature", + "semantic_type": "numeric", + "nullable": false, + "missing_tokens": [], + "parse_format": null, + "impute_strategy": "median", + "profile_stats": { + "missing_rate": 0.0, + "unique_count": 796, + "unique_ratio": 0.104243, + "example_values": [ + "346", + "796", + "453", + "87", + "325" + ] + } + }, + { + "name": "Type of Answer", + "role": "target", + "semantic_type": "boolean", + "nullable": false, + "missing_tokens": [], + "parse_format": null, + "impute_strategy": "mode", + "profile_stats": { + "missing_rate": 0.0, + "unique_count": 2, + "unique_ratio": 0.000262, + "example_values": [ + "0", + "1" + ] + } + }, + { + "name": "Question Level", + "role": "feature", + "semantic_type": "categorical", + "nullable": false, + "missing_tokens": [], + "parse_format": null, + "impute_strategy": "mode", + "profile_stats": { + "missing_rate": 0.0, + "unique_count": 2, + "unique_ratio": 0.000262, + "example_values": [ + "Advanced", + "Basic" + ] + } + }, + { + "name": "Topic", + "role": "feature", + "semantic_type": "text", + "nullable": false, + "missing_tokens": [], + "parse_format": null, + "impute_strategy": "keep_raw", + "profile_stats": { + "missing_rate": 0.0, + "unique_count": 14, + "unique_ratio": 0.001833, + "example_values": [ + "Complex Numbers", + "Fundamental Mathematics", + "Linear Algebra", + "Real Functions of a single variable", + "Analytic Geometry" + ] + } + }, + { + "name": "Subtopic", + "role": "feature", + "semantic_type": "text", + "nullable": false, + "missing_tokens": [], + "parse_format": null, + "impute_strategy": "keep_raw", + "profile_stats": { + "missing_rate": 0.0, + "unique_count": 24, + "unique_ratio": 0.003143, + "example_values": [ + "Complex Numbers", + "Algebraic expressions, Equations, and Inequalities", + "Vector Spaces", + "Limits and Continuity", + "Linear Transformations" + ] + } + }, + { + "name": "Keywords", + "role": "feature", + "semantic_type": "text", + "nullable": false, + "missing_tokens": [], + "parse_format": null, + "impute_strategy": "keep_raw", + "profile_stats": { + "missing_rate": 0.0, + "unique_count": 360, + "unique_ratio": 0.047145, + "example_values": [ + "Imaginary part,Modulus of a complex number,Operations with complex numbers,Conjugate number,Real part", + "Logarithmic function,Exponential function,Simplify expressions", + "Linear independence,Span,Linear dependence", + "Indeterminate forms,Limits", + "Range,Kernel" + ] + } + } + ], + "public_manifest": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/public_gate/staged_input_manifest.json", + "train_csv": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv", + "val_csv": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv", + "test_csv": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv", + "features_json": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/public/staged_features.json", + "public_gate_report": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/public_gate/public_gate_report.json" +} \ No newline at end of file diff --git a/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/train_20260329_231510.log b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/train_20260329_231510.log new file mode 100644 index 0000000000000000000000000000000000000000..fa118b4d7a0802943254fc81ad857bb8d7bb5fbb --- /dev/null +++ b/SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/train_20260329_231510.log @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c593588546caea885c8bc0ad25f9b58eece87a5d47e6b0e2e9106d460b86ee73 +size 1707182 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_gen.py b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_gen.py new file mode 100644 index 0000000000000000000000000000000000000000..14579306823cf5bd03d2ea9565502bf78b4edf79 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_gen.py @@ -0,0 +1,33 @@ + +import os, shutil, subprocess, sys +root = r"/workspace/ef-vfm" +name = r"pipeline_ds" +src = r"/work/output-SpecializedModels/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds" +dst_data = os.path.join(root, "data", name) +shutil.rmtree(dst_data, ignore_errors=True) +shutil.copytree(src, dst_data) +dst_syn = os.path.join(root, "synthetic", name) +os.makedirs(dst_syn, exist_ok=True) +for fn in ("real.csv", "test.csv", "val.csv"): + shutil.copy(os.path.join(src, fn), os.path.join(dst_syn, fn)) +os.chdir(root) +os.environ["PYTHONPATH"] = root + os.pathsep + os.environ.get("PYTHONPATH", "") +subprocess.check_call([ + sys.executable, "main.py", + "--dataname", name, "--mode", "test", "--gpu", "0", + "--no_wandb", "--exp_name", r"adapter_efvfm", + "--ckpt_path", r"/workspace/ef-vfm/ef_vfm/ckpt/pipeline_ds/adapter_efvfm/model_500.pt", + "--num_samples_to_generate", str(int(7636)), +]) +base = os.path.join(root, "ef_vfm", "result", name, r"adapter_efvfm") +best = None +best_t = -1.0 +for r, _, files in os.walk(base): + if "samples.csv" in files: + p = os.path.join(r, "samples.csv") + t = os.path.getmtime(p) + if t > best_t: + best_t, best = t, p +if not best: + raise SystemExit("tabbyflow: no samples.csv in " + base) +shutil.copy(best, r"/work/output-SpecializedModels/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv") diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_train.py b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_train.py new file mode 100644 index 0000000000000000000000000000000000000000..a58c6fa9a7612afa4072b1eee94f529919874d6b --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_train.py @@ -0,0 +1,22 @@ + +import os, shutil, subprocess, sys +root = r"/workspace/ef-vfm" +name = r"pipeline_ds" +src = r"/work/output-SpecializedModels/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds" +os.makedirs(os.path.join(root, "data", name), exist_ok=True) +dst_data = os.path.join(root, "data", name) +dst_syn = os.path.join(root, "synthetic", name) +shutil.rmtree(dst_data, ignore_errors=True) +shutil.copytree(src, dst_data) +os.makedirs(dst_syn, exist_ok=True) +for fn in ("real.csv", "test.csv", "val.csv"): + shutil.copy(os.path.join(src, fn), os.path.join(dst_syn, fn)) +os.chdir(root) +os.environ["PYTHONPATH"] = root + os.pathsep + os.environ.get("PYTHONPATH", "") +os.environ["EFVFM_SMOKE_STEPS"] = "500" +os.environ["EFVFM_ADAPTER_TRAIN"] = "1" +subprocess.check_call([ + sys.executable, "main.py", + "--dataname", name, "--mode", "train", "--gpu", "0", + "--no_wandb", "--exp_name", r"adapter_efvfm", +]) diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/input_snapshot.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/input_snapshot.json new file mode 100644 index 0000000000000000000000000000000000000000..a9e48ed75b2fb91bff5efdaa2431756ea671071a --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/input_snapshot.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65e30301e80c06c9014ce49f064e87375a299ebf1c313175a5a08f32ab642619 +size 1350 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/models_tabbyflow/trained.pt b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/models_tabbyflow/trained.pt new file mode 100644 index 0000000000000000000000000000000000000000..f063a878c470d9d40f79db79881596e1e497dffd --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/models_tabbyflow/trained.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:adb734fec12f2251befd371dca69e481b19464aded2a6823105a01b4be6ddbe5 +size 40 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/normalized_schema_snapshot.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/normalized_schema_snapshot.json new file mode 100644 index 0000000000000000000000000000000000000000..a9a76b04dd8a6fc6c6012a06758a36ea312d90f2 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/normalized_schema_snapshot.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:065bdbcaaeac76f0cbdb0c5fff8891508d44a53a8e05c41f90aa9bc5e7681d87 +size 4158 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/public_gate_report.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/public_gate_report.json new file mode 100644 index 0000000000000000000000000000000000000000..efa66a9f46c2c8ded3bcd6620fa734d5f15a380c --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/public_gate_report.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:caf5579c25c03b817ba8a8de781db7dc512fb35a1488a6e41f51f07997ce649b +size 921 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/staged_input_manifest.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/staged_input_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..a05bc8b33a0ae7d22a8a1b01ffdfde67257badfe --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/staged_input_manifest.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:220265cd461e79999e9e649a074b15d85f3dd699ad15a9e2e962233fc54ac96a +size 4959 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/runtime_result.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/runtime_result.json new file mode 100644 index 0000000000000000000000000000000000000000..3fd7fe73aad0e0a38e6d7988f07045f77b94e31b --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/runtime_result.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6724a1608a3f34120ee87e748ef97a39facca92eb7311fc0ae63e79e96901374 +size 621 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/staged_features.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/staged_features.json new file mode 100644 index 0000000000000000000000000000000000000000..68dd06357f9e7cc9daad78514ad77a2d5e67b760 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/staged_features.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfdf5dc24983833c54d8dd0e6c39aaea73c21fb9552c8b7d60db4a3b4e2dc022 +size 783 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/test.csv b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/test.csv new file mode 100644 index 0000000000000000000000000000000000000000..221052bae020346f46e1c71d36fce7eb347ed62d --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/test.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d28b60b361526450f0c203ddf50498854cb66ad5c1978516a99c265f529f8e4f +size 107696 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/train.csv b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/train.csv new file mode 100644 index 0000000000000000000000000000000000000000..28f63ae8128dbf03647f9cda7458db51d98581f5 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/train.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d8f85a52de0e63e292778c26cb06223383b366c589d4226c3de68b111ba5272 +size 849500 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/val.csv b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/val.csv new file mode 100644 index 0000000000000000000000000000000000000000..400c35bc93bd5a660ae20c7574c7bea7bc24035f --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/val.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ede9f1e2036e743d822e8ed8d7b5e1050159e8fc7b402b758a294f7a14528fe +size 108137 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_report.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_report.json new file mode 100644 index 0000000000000000000000000000000000000000..2102a39035074ca7c359c50e97bb66a931a3bf06 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_report.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3f152301852308e2ab1d6c5d6168600067b27234b3023c94bb3a2f404c893bd +size 322 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_transforms_applied.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_transforms_applied.json new file mode 100644 index 0000000000000000000000000000000000000000..6f3aaa01a627a955d2022165805d2786c0da78ba --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_transforms_applied.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945 +size 2 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/model_input_manifest.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/model_input_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..18836b339af4c085f13ca2cd6ac32eae1aea446d --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/model_input_manifest.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a06cceb0194640f866ac899656b3d24894841d175d9869695e607c5b01fe323e +size 5157 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv new file mode 100644 index 0000000000000000000000000000000000000000..583d07fa3b4e2e1301dc3481499e24d2f77268f1 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:277de07ba0e03cc33b5811f48ac3736def96875b4f7e5a45f721cf4e74e948a5 +size 562960 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow_train_meta.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow_train_meta.json new file mode 100644 index 0000000000000000000000000000000000000000..18d978a0406162ed2e2c2d1db8b7fffaf089fe0f --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow_train_meta.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bbe507388dc5629e9155e6ecf504bc121a9c227c10ff53532d15220fc65ee13 +size 78 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_test.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_test.npy new file mode 100644 index 0000000000000000000000000000000000000000..f639c33b2939658021bbb75cfc6579b113771bfe --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_test.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0166d691afe31be41a6a7bcbd1c19508d44d02e52cc7aa9004aef843133a4565 +size 38368 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_train.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_train.npy new file mode 100644 index 0000000000000000000000000000000000000000..3e2d877dfa3155ff72de450bb0a75411870fb100 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_train.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13c6003f01f936249abb83aa4818534e23fae62a3b8d55c3f2751af25aa08122 +size 305568 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_val.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_val.npy new file mode 100644 index 0000000000000000000000000000000000000000..e22c7579c7eaf031299431db6bde44b843511815 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_val.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9b139a3150ceb04ef986bce457f05379562e57b6803a33e473206b4981b0870 +size 38288 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_test.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_test.npy new file mode 100644 index 0000000000000000000000000000000000000000..6d4bcce97fb70f11b1e488e10df25eba63aedbb4 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_test.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eff443efa63dca8c3aa82fa2aa01653c220cf31d5e65e2e75f839f13a2dba5eb +size 7776 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_train.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_train.npy new file mode 100644 index 0000000000000000000000000000000000000000..96a7b66bd0652716f3abcf31006d60ba8e31f3cb --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_train.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24258565807b5a7fc2c0c3c9a4f26f21a6bb9f8e60c004592425f19e3b2b55a1 +size 61216 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_val.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_val.npy new file mode 100644 index 0000000000000000000000000000000000000000..18e2c09f14b6252868888316b9abe452779e18de --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_val.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00358b4aadd30d21f876db8493e7c6bd9c8a7d3900997d674d4e838eb4e6e5b7 +size 7760 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/info.json b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/info.json new file mode 100644 index 0000000000000000000000000000000000000000..6f0e4456a816635bf1c3a158628ed4cff8e35c67 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/info.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab0cd3dd2f27cc18d6d5b50be8ec3a3c586a22598ce1e96919f15001c5e9eb37 +size 1592 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/real.csv b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/real.csv new file mode 100644 index 0000000000000000000000000000000000000000..19df1d9173f2005e6313e80ab844f50713307f36 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/real.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d54fcadad6523ae53e8c9a3cebe53bca7b4d404fdf04df8bd475e8353b3ab273 +size 174950 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/test.csv b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/test.csv new file mode 100644 index 0000000000000000000000000000000000000000..b4e14f702468a5124bc292a4e6d6ad8f81e36765 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/test.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef143d4543f0a65c6c7400acbe17848a1d895746e9834ab707b3234e6799d675 +size 21959 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/val.csv b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/val.csv new file mode 100644 index 0000000000000000000000000000000000000000..825fd0dcfb5374094a0dc60dab92c55b841b67ac --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/val.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1df2b5b548fe565f4a33bd2798be543cad469f29ca7f32560e23aeb038827ae6 +size 21941 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_test.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_test.npy new file mode 100644 index 0000000000000000000000000000000000000000..873daebd724f36239defc4e625f1dda5f2ab3f24 --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_test.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4c747068f22f9e2e9c73161ef11c536909ed8a2e44445e33a0995a4bfb0dbd4 +size 7776 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_train.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_train.npy new file mode 100644 index 0000000000000000000000000000000000000000..e3d00467aef8fc9a268b944152a3b82564c8d1df --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_train.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80ccc3344a1009b642b589707df9c94cbc3dfa53970e361d51fe44862d17d9f2 +size 61216 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_val.npy b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_val.npy new file mode 100644 index 0000000000000000000000000000000000000000..9e236a7a9c3f622d63ee71019c2eb20bd73cdbee --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_val.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb96c431016954da476d05276bc9daef4e208abfe3045dcaff0b65626c0ef3b1 +size 7760 diff --git a/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/train_20260420_063042.log b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/train_20260420_063042.log new file mode 100644 index 0000000000000000000000000000000000000000..3f86c62ff37d64d8e3717d27a1a411ba6f2fb64f --- /dev/null +++ b/SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/train_20260420_063042.log @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab434ed514852222d056742e0eda13b60c72167505932bcbd34f9895ff9f9b4e +size 360815 diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/._data b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/._data new file mode 100644 index 0000000000000000000000000000000000000000..89e52d9d55eea94a37ca2bfdd186b4b892b24643 Binary files /dev/null and b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/._data differ diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitignore b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..9b148cde6e315b01b30652b19f39a11f211dff1c --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitignore @@ -0,0 +1,22 @@ +.DS_Store +__pycache__/ +catboost_info/ +**/**.pt +**/**.ipynb +!agg_results.ipynb +**/**.npy +**/**.gz +**/**.sh +**/**.obj +**/**.png +**/**.tar +**/**.code-workspace +**/**.csv +exp/**/**/results_catboost.json +exp/**/**/results_mlp.json + +configs/ +data/ +junk/ +RF/ +exps/ \ No newline at end of file diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitmodules b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..8c677ab737cbbdbc5c806cf58d27960efefcb11a --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitmodules @@ -0,0 +1,9 @@ +[submodule "ctgan"] + # path = CTGAN/CTGAN + url = https://github.com/sdv-dev/CTGAN +[submodule "ctabgan"] + # path = CTAB-GAN + url = https://github.com/Team-TUD/CTAB-GAN +[submodule "ctabgan+"] + # path = CTAB-GAN-Plus + url = https://github.com/Team-TUD/CTAB-GAN-Plus \ No newline at end of file diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CONFIG_DESCRIPTION.md b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CONFIG_DESCRIPTION.md new file mode 100644 index 0000000000000000000000000000000000000000..646a0c00f329b55bc736d5cdbd1e797d1143cd1c --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CONFIG_DESCRIPTION.md @@ -0,0 +1,78 @@ +# Description of .toml config for TabDDPM +First of all, `train.T` and `eval.T` denote preprocessing for training and for evaluation, respectively. + +Here we list non-obvious parameters. + +Main part: +- `seed = 0` -- evaluation seed (and training, but for training it is fixed to 0) +- `parent_dir = "exp/abalone/check"` -- exp folder +- `real_data_path = "data/abalone/"` +- `model_type = "mlp"` -- model type that approximates the reverse process +- `num_numerical_features ` -- a number of numerical features in dataset +- `device = "cuda:0"` + +Model params: +- `is_y_cond` -- false for regression, true for classification +- `d_in` -- input dimension (not necessary, since scripts calculate it automatically) +- `num_calsses` -- zero for regression, a number of classes for classification +- `rtdl_params` -- MLP parameters + +```toml +seed = 0 +parent_dir = "exp/abalone/check" +real_data_path = "data/abalone/" +model_type = "mlp" +num_numerical_features = 7 +device = "cuda:0" + +[model_params] +is_y_cond = false +d_in = 11 +num_classes = 0 + +[model_params.rtdl_params] +d_layers = [ + 256, + 256, +] +dropout = 0.0 + +[diffusion_params] +num_timesteps = 1000 +gaussian_loss_type = "mse" +scheduler = "cosine" + +[train.main] +steps = 1000 +lr = 0.001 +weight_decay = 1e-05 +batch_size = 4096 + +[train.T] +seed = 0 +normalization = "quantile" +num_nan_policy = "__none__" +cat_nan_policy = "__none__" +cat_min_frequency = "__none__" +cat_encoding = "__none__" +y_policy = "default" + +[sample] +num_samples = 20800 +batch_size = 10000 +seed = 0 + +[eval.type] +eval_model = "catboost" +eval_type = "synthetic" + +[eval.T] +seed = 0 +normalization = "__none__" +num_nan_policy = "__none__" +cat_nan_policy = "__none__" +cat_min_frequency = "__none__" +cat_encoding = "__none__" +y_policy = "default" + +``` \ No newline at end of file diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/.gitignore b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2473a164760acb3c77f225f094e19e2e0f523912 --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/.gitignore @@ -0,0 +1 @@ +**/**.csv \ No newline at end of file diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/README.md b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e873924cc56b6603669d17e6ab3badd4aba0657a --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/README.md @@ -0,0 +1,49 @@ +# CTAB-GAN+ +This is the official git paper [CTAB-GAN+: Enhancing Tabular Data Synthesis](https://arxiv.org/abs/2204.00401). Current code is without differential privacy part. +If you have any question, please contact `z.zhao-8@tudelft.nl` for more information. + + +## Prerequisite + +The required package version +``` +numpy==1.21.0 +torch==1.9.1 +pandas==1.2.4 +sklearn==0.24.1 +dython==0.6.4.post1 +scipy==1.4.1 +``` +The sklean package in newer version has updated its function for `sklearn.mixture.BayesianGaussianMixture`. Therefore, user should use this proposed sklearn version to successfully run the code! + +## Example +`Experiment_Script_Adult.ipynb` `Experiment_Script_king.ipynb` are two example notebooks for training CTAB-GAN+ with Adult (classification) and king (regression) datasets. The datasets are alread under `Real_Datasets` folder. +The evaluation code is also provided. + +## Problem type + +You can either indicate your dataset problem type as Classification, Regression. If there is no problem type, you can leave the problem type as None as follows: +``` +problem_type= {None: None} +``` + +## For large dataset + +If your dataset has large number of column, you may encounter the problem that our currnet code cannot encode all of your data since CTAB-GAN+ will wrap the encoded data into an image-like format. What you can do is changing the line 378 and 385 in `model/synthesizer/ctabgan_synthesizer.py`. The number in the `slide` list +``` +sides = [4, 8, 16, 24, 32] +``` +is the side size of image. You can enlarge the list to [4, 8, 16, 24, 32, 64] or [4, 8, 16, 24, 32, 64, 128] for accepting larger dataset. + +## Bibtex + +To cite this paper, you could use this bibtex + +``` +@article{zhao2022ctab, + title={CTAB-GAN+: Enhancing Tabular Data Synthesis}, + author={Zhao, Zilong and Kunar, Aditya and Birke, Robert and Chen, Lydia Y}, + journal={arXiv preprint arXiv:2204.00401}, + year={2022} +} +``` \ No newline at end of file diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/columns.json b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/columns.json new file mode 100644 index 0000000000000000000000000000000000000000..ac695958cb0fb057fa024d712d065588e43e5279 --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/columns.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0d9e05a1c251995561cb1f4b2688be2c332a4971a0513d15645089efc0e236a +size 4355 diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/ctabgan.py b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/ctabgan.py new file mode 100644 index 0000000000000000000000000000000000000000..81782dcde9f07f3d8178c29ba08ceb129c40f58f --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/ctabgan.py @@ -0,0 +1,70 @@ +""" +Generative model training algorithm based on the CTABGANSynthesiser + +""" +import pandas as pd +import time +from model.pipeline.data_preparation import DataPrep +from model.synthesizer.ctabgan_synthesizer import CTABGANSynthesizer + +import warnings + +warnings.filterwarnings("ignore") + +class CTABGAN(): + + def __init__(self, + df, + test_ratio = 0.20, + categorical_columns = [ 'workclass', 'education', 'marital-status', 'occupation', 'relationship', 'race', 'gender', 'native-country', 'income'], + log_columns = [], + mixed_columns= {'capital-loss':[0.0],'capital-gain':[0.0]}, + general_columns = ["age"], + non_categorical_columns = [], + integer_columns = ['age', 'fnlwgt','capital-gain', 'capital-loss','hours-per-week'], + problem_type= {"Classification": "income"}, + class_dim=(256, 256, 256, 256), + random_dim=100, + num_channels=64, + l2scale=1e-5, + batch_size=500, + epochs=150, + device="cpu"): + + self.__name__ = 'CTABGAN' + + self.synthesizer = CTABGANSynthesizer( + class_dim=class_dim, + random_dim=random_dim, + num_channels=num_channels, + l2scale=l2scale, + batch_size=batch_size, + epochs=epochs, + device=device + ) + self.raw_df = df + self.test_ratio = test_ratio + self.categorical_columns = categorical_columns + self.log_columns = log_columns + self.mixed_columns = mixed_columns + self.general_columns = general_columns + self.non_categorical_columns = non_categorical_columns + self.integer_columns = integer_columns + self.problem_type = problem_type + + def fit(self): + + start_time = time.time() + self.data_prep = DataPrep(self.raw_df,self.categorical_columns,self.log_columns,self.mixed_columns,self.general_columns,self.non_categorical_columns,self.integer_columns,self.problem_type,self.test_ratio) + self.synthesizer.fit(train_data=self.data_prep.df, categorical = self.data_prep.column_types["categorical"], mixed = self.data_prep.column_types["mixed"], + general = self.data_prep.column_types["general"], non_categorical = self.data_prep.column_types["non_categorical"], type=self.problem_type) + end_time = time.time() + print('Finished training in',end_time-start_time," seconds.") + + + def generate_samples(self, seed=0): + + sample = self.synthesizer.sample(len(self.raw_df), seed) + sample_df = self.data_prep.inverse_prep(sample) + + return sample_df diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/eval/evaluation.py b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/eval/evaluation.py new file mode 100644 index 0000000000000000000000000000000000000000..1492fcf80cfb907f95b3844e4c0f38f15effbdb0 --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/eval/evaluation.py @@ -0,0 +1,193 @@ +import numpy as np +import pandas as pd +from sklearn import metrics +from sklearn import model_selection +from sklearn.preprocessing import MinMaxScaler,StandardScaler +from sklearn.neural_network import MLPClassifier +from sklearn.linear_model import LogisticRegression +from sklearn import svm,tree +from sklearn.ensemble import RandomForestClassifier +from dython.nominal import compute_associations +from scipy.stats import wasserstein_distance +from scipy.spatial import distance +import warnings + +warnings.filterwarnings("ignore") + +def supervised_model_training(x_train, y_train, x_test, + y_test, model_name): + + + if model_name == 'lr': + model = LogisticRegression(random_state=42,max_iter=500) + elif model_name == 'svm': + model = svm.SVC(random_state=42,probability=True) + elif model_name == 'dt': + model = tree.DecisionTreeClassifier(random_state=42) + elif model_name == 'rf': + model = RandomForestClassifier(random_state=42) + elif model_name == "mlp": + model = MLPClassifier(random_state=42,max_iter=100) + + model.fit(x_train, y_train) + pred = model.predict(x_test) + + if len(np.unique(y_train))>2: + predict = model.predict_proba(x_test) + acc = metrics.accuracy_score(y_test,pred)*100 + auc = metrics.roc_auc_score(y_test, predict,average="weighted",multi_class="ovr") + f1_score = metrics.precision_recall_fscore_support(y_test, pred,average="weighted")[2] + return [acc, auc,f1_score] + + else: + predict = model.predict_proba(x_test)[:,1] + acc = metrics.accuracy_score(y_test,pred)*100 + auc = metrics.roc_auc_score(y_test, predict) + f1_score = metrics.precision_recall_fscore_support(y_test,pred)[2].mean() + return [acc, auc,f1_score] + + +def get_utility_metrics(real_path,fake_paths,scaler="MinMax",classifiers=["lr","dt","rf","mlp"],test_ratio=.20): + + data_real = pd.read_csv(real_path).to_numpy() + data_dim = data_real.shape[1] + + data_real_y = data_real[:,-1] + data_real_X = data_real[:,:data_dim-1] + X_train_real, X_test_real, y_train_real, y_test_real = model_selection.train_test_split(data_real_X ,data_real_y, test_size=test_ratio, stratify=data_real_y,random_state=42) + + if scaler=="MinMax": + scaler_real = MinMaxScaler() + else: + scaler_real = StandardScaler() + + scaler_real.fit(data_real_X) + X_train_real_scaled = scaler_real.transform(X_train_real) + X_test_real_scaled = scaler_real.transform(X_test_real) + + all_real_results = [] + for classifier in classifiers: + real_results = supervised_model_training(X_train_real_scaled,y_train_real,X_test_real_scaled,y_test_real,classifier) + all_real_results.append(real_results) + + all_fake_results_avg = [] + + for fake_path in fake_paths: + data_fake = pd.read_csv(fake_path).to_numpy() + data_fake_y = data_fake[:,-1] + data_fake_X = data_fake[:,:data_dim-1] + X_train_fake, _ , y_train_fake, _ = model_selection.train_test_split(data_fake_X ,data_fake_y, test_size=test_ratio, stratify=data_fake_y,random_state=42) + + if scaler=="MinMax": + scaler_fake = MinMaxScaler() + else: + scaler_fake = StandardScaler() + + scaler_fake.fit(data_fake_X) + + X_train_fake_scaled = scaler_fake.transform(X_train_fake) + + all_fake_results = [] + for classifier in classifiers: + fake_results = supervised_model_training(X_train_fake_scaled,y_train_fake,X_test_real_scaled,y_test_real,classifier) + all_fake_results.append(fake_results) + + all_fake_results_avg.append(all_fake_results) + + diff_results = np.array(all_real_results)- np.array(all_fake_results_avg).mean(axis=0) + + return diff_results + +def stat_sim(real_path,fake_path,cat_cols=None): + + Stat_dict={} + + real = pd.read_csv(real_path) + fake = pd.read_csv(fake_path) + + really = real.copy() + fakey = fake.copy() + + real_corr = compute_associations(real, nominal_columns=cat_cols) + + fake_corr = compute_associations(fake, nominal_columns=cat_cols) + + corr_dist = np.linalg.norm(real_corr - fake_corr) + + cat_stat = [] + num_stat = [] + + for column in real.columns: + + if column in cat_cols: + + real_pdf=(really[column].value_counts()/really[column].value_counts().sum()) + fake_pdf=(fakey[column].value_counts()/fakey[column].value_counts().sum()) + categories = (fakey[column].value_counts()/fakey[column].value_counts().sum()).keys().tolist() + sorted_categories = sorted(categories) + + real_pdf_values = [] + fake_pdf_values = [] + + for i in sorted_categories: + real_pdf_values.append(real_pdf[i]) + fake_pdf_values.append(fake_pdf[i]) + + if len(real_pdf)!=len(fake_pdf): + zero_cats = set(really[column].value_counts().keys())-set(fakey[column].value_counts().keys()) + for z in zero_cats: + real_pdf_values.append(real_pdf[z]) + fake_pdf_values.append(0) + Stat_dict[column]=(distance.jensenshannon(real_pdf_values,fake_pdf_values, 2.0)) + cat_stat.append(Stat_dict[column]) + else: + scaler = MinMaxScaler() + scaler.fit(real[column].values.reshape(-1,1)) + l1 = scaler.transform(real[column].values.reshape(-1,1)).flatten() + l2 = scaler.transform(fake[column].values.reshape(-1,1)).flatten() + Stat_dict[column]= (wasserstein_distance(l1,l2)) + num_stat.append(Stat_dict[column]) + + return [np.mean(num_stat),np.mean(cat_stat),corr_dist] + +def privacy_metrics(real_path,fake_path,data_percent=15): + + real = pd.read_csv(real_path).drop_duplicates(keep=False) + fake = pd.read_csv(fake_path).drop_duplicates(keep=False) + + real_refined = real.sample(n=int(len(real)*(.01*data_percent)), random_state=42).to_numpy() + fake_refined = fake.sample(n=int(len(fake)*(.01*data_percent)), random_state=42).to_numpy() + + scalerR = StandardScaler() + scalerR.fit(real_refined) + scalerF = StandardScaler() + scalerF.fit(fake_refined) + df_real_scaled = scalerR.transform(real_refined) + df_fake_scaled = scalerF.transform(fake_refined) + + dist_rf = metrics.pairwise_distances(df_real_scaled, Y=df_fake_scaled, metric='minkowski', n_jobs=-1) + dist_rr = metrics.pairwise_distances(df_real_scaled, Y=None, metric='minkowski', n_jobs=-1) + rd_dist_rr = dist_rr[~np.eye(dist_rr.shape[0],dtype=bool)].reshape(dist_rr.shape[0],-1) + dist_ff = metrics.pairwise_distances(df_fake_scaled, Y=None, metric='minkowski', n_jobs=-1) + rd_dist_ff = dist_ff[~np.eye(dist_ff.shape[0],dtype=bool)].reshape(dist_ff.shape[0],-1) + smallest_two_indexes_rf = [dist_rf[i].argsort()[:2] for i in range(len(dist_rf))] + smallest_two_rf = [dist_rf[i][smallest_two_indexes_rf[i]] for i in range(len(dist_rf))] + smallest_two_indexes_rr = [rd_dist_rr[i].argsort()[:2] for i in range(len(rd_dist_rr))] + smallest_two_rr = [rd_dist_rr[i][smallest_two_indexes_rr[i]] for i in range(len(rd_dist_rr))] + smallest_two_indexes_ff = [rd_dist_ff[i].argsort()[:2] for i in range(len(rd_dist_ff))] + smallest_two_ff = [rd_dist_ff[i][smallest_two_indexes_ff[i]] for i in range(len(rd_dist_ff))] + nn_ratio_rr = np.array([i[0]/i[1] for i in smallest_two_rr]) + nn_ratio_ff = np.array([i[0]/i[1] for i in smallest_two_ff]) + nn_ratio_rf = np.array([i[0]/i[1] for i in smallest_two_rf]) + nn_fifth_perc_rr = np.percentile(nn_ratio_rr,5) + nn_fifth_perc_ff = np.percentile(nn_ratio_ff,5) + nn_fifth_perc_rf = np.percentile(nn_ratio_rf,5) + + min_dist_rf = np.array([i[0] for i in smallest_two_rf]) + fifth_perc_rf = np.percentile(min_dist_rf,5) + min_dist_rr = np.array([i[0] for i in smallest_two_rr]) + fifth_perc_rr = np.percentile(min_dist_rr,5) + min_dist_ff = np.array([i[0] for i in smallest_two_ff]) + fifth_perc_ff = np.percentile(min_dist_ff,5) + + return np.array([fifth_perc_rf,fifth_perc_rr,fifth_perc_ff,nn_fifth_perc_rf,nn_fifth_perc_rr,nn_fifth_perc_ff]).reshape(1,6) \ No newline at end of file diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/pipeline/data_preparation.py b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/pipeline/data_preparation.py new file mode 100644 index 0000000000000000000000000000000000000000..abe1f725f7d09f7284abef0dd9c1187f0e3c96bf --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/pipeline/data_preparation.py @@ -0,0 +1,130 @@ +import numpy as np +import pandas as pd +from sklearn import preprocessing +from sklearn import model_selection + +class DataPrep(object): + + def __init__(self, raw_df: pd.DataFrame, categorical: list, log:list, mixed:dict, general:list, non_categorical:list, integer:list, type:dict, test_ratio:float): + + + self.categorical_columns = categorical + self.log_columns = log + self.mixed_columns = mixed + self.general_columns = general + self.non_categorical_columns = non_categorical + self.integer_columns = integer + self.column_types = dict() + self.column_types["categorical"] = [] + self.column_types["mixed"] = {} + self.column_types["general"] = [] + self.column_types["non_categorical"] = [] + self.lower_bounds = {} + self.label_encoder_list = [] + + target_col = list(type.values())[0] + if target_col is not None: + y_real = raw_df[target_col] + X_real = raw_df.drop(columns=[target_col]) + X_train_real, _, y_train_real, _ = model_selection.train_test_split(X_real ,y_real, test_size=test_ratio, stratify=y_real,random_state=42) + + X_train_real[target_col]= y_train_real + + self.df = X_train_real + else: + self.df = raw_df + + self.df = self.df.replace(r' ', np.nan) + self.df = self.df.fillna('empty') + + all_columns= set(self.df.columns) + irrelevant_missing_columns = set(self.categorical_columns) + relevant_missing_columns = list(all_columns - irrelevant_missing_columns) + + for i in relevant_missing_columns: + if i in self.log_columns: + if "empty" in list(self.df[i].values): + self.df[i] = self.df[i].apply(lambda x: -9999999 if x=="empty" else x) + self.mixed_columns[i] = [-9999999] + elif i in list(self.mixed_columns.keys()): + if "empty" in list(self.df[i].values): + self.df[i] = self.df[i].apply(lambda x: -9999999 if x=="empty" else x ) + self.mixed_columns[i].append(-9999999) + else: + if "empty" in list(self.df[i].values): + self.df[i] = self.df[i].apply(lambda x: -9999999 if x=="empty" else x) + self.mixed_columns[i] = [-9999999] + + if self.log_columns: + for log_column in self.log_columns: + valid_indices = [] + for idx,val in enumerate(self.df[log_column].values): + if val!=-9999999: + valid_indices.append(idx) + eps = 1 + lower = np.min(self.df[log_column].iloc[valid_indices].values) + self.lower_bounds[log_column] = lower + if lower>0: + self.df[log_column] = self.df[log_column].apply(lambda x: np.log(x) if x!=-9999999 else -9999999) + elif lower == 0: + self.df[log_column] = self.df[log_column].apply(lambda x: np.log(x+eps) if x!=-9999999 else -9999999) + else: + self.df[log_column] = self.df[log_column].apply(lambda x: np.log(x-lower+eps) if x!=-9999999 else -9999999) + + for column_index, column in enumerate(self.df.columns): + if column in self.categorical_columns: + label_encoder = preprocessing.LabelEncoder() + self.df[column] = self.df[column].astype(str) + label_encoder.fit(self.df[column]) + current_label_encoder = dict() + current_label_encoder['column'] = column + current_label_encoder['label_encoder'] = label_encoder + transformed_column = label_encoder.transform(self.df[column]) + self.df[column] = transformed_column + self.label_encoder_list.append(current_label_encoder) + self.column_types["categorical"].append(column_index) + + if column in self.general_columns: + self.column_types["general"].append(column_index) + + if column in self.non_categorical_columns: + self.column_types["non_categorical"].append(column_index) + + elif column in self.mixed_columns: + self.column_types["mixed"][column_index] = self.mixed_columns[column] + + elif column in self.general_columns: + self.column_types["general"].append(column_index) + + + super().__init__() + + def inverse_prep(self, data, eps=1): + + df_sample = pd.DataFrame(data,columns=self.df.columns) + + for i in range(len(self.label_encoder_list)): + le = self.label_encoder_list[i]["label_encoder"] + df_sample[self.label_encoder_list[i]["column"]] = df_sample[self.label_encoder_list[i]["column"]].astype(int) + df_sample[self.label_encoder_list[i]["column"]] = le.inverse_transform(df_sample[self.label_encoder_list[i]["column"]]) + + if self.log_columns: + for i in df_sample: + if i in self.log_columns: + lower_bound = self.lower_bounds[i] + if lower_bound>0: + df_sample[i].apply(lambda x: np.exp(x)) + elif lower_bound==0: + df_sample[i] = df_sample[i].apply(lambda x: np.ceil(np.exp(x)-eps) if (np.exp(x)-eps) < 0 else (np.exp(x)-eps)) + else: + df_sample[i] = df_sample[i].apply(lambda x: np.exp(x)-eps+lower_bound) + + if self.integer_columns: + for column in self.integer_columns: + df_sample[column]= (np.round(df_sample[column].values)) + df_sample[column] = df_sample[column].astype(int) + + df_sample.replace(-9999999, np.nan,inplace=True) + df_sample.replace('empty', np.nan,inplace=True) + + return df_sample diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/privacy_utils/rdp_accountant.py b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/privacy_utils/rdp_accountant.py new file mode 100644 index 0000000000000000000000000000000000000000..5e225cbb0994fa6b9e9726f38d873754bbfe82cf --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/privacy_utils/rdp_accountant.py @@ -0,0 +1,280 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import math +import sys + +import numpy as np +from scipy import special +import six + +######################## +# LOG-SPACE ARITHMETIC # +######################## + + +def _log_add(logx, logy): + """Add two numbers in the log space.""" + a, b = min(logx, logy), max(logx, logy) + if a == -np.inf: # adding 0 + return b + # Use exp(a) + exp(b) = (exp(a - b) + 1) * exp(b) + return math.log1p(math.exp(a - b)) + b # log1p(x) = log(x + 1) + + +def _log_sub(logx, logy): + """Subtract two numbers in the log space. Answer must be non-negative.""" + if logx < logy: + raise ValueError("The result of subtraction must be non-negative.") + if logy == -np.inf: # subtracting 0 + return logx + if logx == logy: + return -np.inf # 0 is represented as -np.inf in the log space. + + try: + # Use exp(x) - exp(y) = (exp(x - y) - 1) * exp(y). + return math.log(math.expm1(logx - logy)) + logy # expm1(x) = exp(x) - 1 + except OverflowError: + return logx + + +def _log_print(logx): + """Pretty print.""" + if logx < math.log(sys.float_info.max): + return "{}".format(math.exp(logx)) + else: + return "exp({})".format(logx) + + +def _compute_log_a_int(q, sigma, alpha): + """Compute log(A_alpha) for integer alpha. 0 < q < 1.""" + assert isinstance(alpha, six.integer_types) + + # Initialize with 0 in the log space. + log_a = -np.inf + + for i in range(alpha + 1): + log_coef_i = ( + math.log(special.binom(alpha, i)) + i * math.log(q) + + (alpha - i) * math.log(1 - q)) + + s = log_coef_i + (i * i - i) / (2 * (sigma**2)) + log_a = _log_add(log_a, s) + + return float(log_a) + + +def _compute_log_a_frac(q, sigma, alpha): + """Compute log(A_alpha) for fractional alpha. 0 < q < 1.""" + # The two parts of A_alpha, integrals over (-inf,z0] and [z0, +inf), are + # initialized to 0 in the log space: + log_a0, log_a1 = -np.inf, -np.inf + i = 0 + + z0 = sigma**2 * math.log(1 / q - 1) + .5 + + while True: # do ... until loop + coef = special.binom(alpha, i) + log_coef = math.log(abs(coef)) + j = alpha - i + + log_t0 = log_coef + i * math.log(q) + j * math.log(1 - q) + log_t1 = log_coef + j * math.log(q) + i * math.log(1 - q) + + log_e0 = math.log(.5) + _log_erfc((i - z0) / (math.sqrt(2) * sigma)) + log_e1 = math.log(.5) + _log_erfc((z0 - j) / (math.sqrt(2) * sigma)) + + log_s0 = log_t0 + (i * i - i) / (2 * (sigma**2)) + log_e0 + log_s1 = log_t1 + (j * j - j) / (2 * (sigma**2)) + log_e1 + + if coef > 0: + log_a0 = _log_add(log_a0, log_s0) + log_a1 = _log_add(log_a1, log_s1) + else: + log_a0 = _log_sub(log_a0, log_s0) + log_a1 = _log_sub(log_a1, log_s1) + + i += 1 + if max(log_s0, log_s1) < -30: + break + + return _log_add(log_a0, log_a1) + + +def _compute_log_a(q, sigma, alpha): + """Compute log(A_alpha) for any positive finite alpha.""" + if float(alpha).is_integer(): + return _compute_log_a_int(q, sigma, int(alpha)) + else: + return _compute_log_a_frac(q, sigma, alpha) + + +def _log_erfc(x): + """Compute log(erfc(x)) with high accuracy for large x.""" + try: + return math.log(2) + special.log_ndtr(-x * 2**.5) + except NameError: + # If log_ndtr is not available, approximate as follows: + r = special.erfc(x) + if r == 0.0: + # Using the Laurent series at infinity for the tail of the erfc function: + # erfc(x) ~ exp(-x^2-.5/x^2+.625/x^4)/(x*pi^.5) + # To verify in Mathematica: + # Series[Log[Erfc[x]] + Log[x] + Log[Pi]/2 + x^2, {x, Infinity, 6}] + return (-math.log(math.pi) / 2 - math.log(x) - x**2 - .5 * x**-2 + + .625 * x**-4 - 37. / 24. * x**-6 + 353. / 64. * x**-8) + else: + return math.log(r) + + +def _compute_delta(orders, rdp, eps): + """Compute delta given a list of RDP values and target epsilon. + + Args: + orders: An array (or a scalar) of orders. + rdp: A list (or a scalar) of RDP guarantees. + eps: The target epsilon. + + Returns: + Pair of (delta, optimal_order). + + Raises: + ValueError: If input is malformed. + + """ + orders_vec = np.atleast_1d(orders) + rdp_vec = np.atleast_1d(rdp) + + if len(orders_vec) != len(rdp_vec): + raise ValueError("Input lists must have the same length.") + + deltas = np.exp((rdp_vec - eps) * (orders_vec - 1)) + idx_opt = np.argmin(deltas) + return min(deltas[idx_opt], 1.), orders_vec[idx_opt] + + +def _compute_eps(orders, rdp, delta): + """Compute epsilon given a list of RDP values and target delta. + + Args: + orders: An array (or a scalar) of orders. + rdp: A list (or a scalar) of RDP guarantees. + delta: The target delta. + + Returns: + Pair of (eps, optimal_order). + + Raises: + ValueError: If input is malformed. + + """ + orders_vec = np.atleast_1d(orders) + rdp_vec = np.atleast_1d(rdp) + + if len(orders_vec) != len(rdp_vec): + raise ValueError("Input lists must have the same length.") + + eps = rdp_vec - math.log(delta) / (orders_vec - 1) + + idx_opt = np.nanargmin(eps) # Ignore NaNs + return eps[idx_opt], orders_vec[idx_opt] + + +def _compute_rdp(q, sigma, alpha): + """Compute RDP of the Sampled Gaussian mechanism at order alpha. + + Args: + q: The sampling rate. + sigma: The std of the additive Gaussian noise. + alpha: The order at which RDP is computed. + + Returns: + RDP at alpha, can be np.inf. + """ + if q == 0: + return 0 + + if q == 1.: + return alpha / (2 * sigma**2) + + if np.isinf(alpha): + return np.inf + + return _compute_log_a(q, sigma, alpha) / (alpha - 1) + + +def compute_rdp(q, noise_multiplier, steps, orders): + """Compute RDP of the Sampled Gaussian Mechanism. + + Args: + q: The sampling rate. + noise_multiplier: The ratio of the standard deviation of the Gaussian noise + to the l2-sensitivity of the function to which it is added. + steps: The number of steps. + orders: An array (or a scalar) of RDP orders. + + Returns: + The RDPs at all orders, can be np.inf. + """ + if np.isscalar(orders): + rdp = _compute_rdp(q, noise_multiplier, orders) + else: + rdp = np.array([_compute_rdp(q, noise_multiplier, order) + for order in orders]) + + return rdp * steps + + +def get_privacy_spent(orders, rdp, target_eps=None, target_delta=None): + """Compute delta (or eps) for given eps (or delta) from RDP values. + + Args: + orders: An array (or a scalar) of RDP orders. + rdp: An array of RDP values. Must be of the same length as the orders list. + target_eps: If not None, the epsilon for which we compute the corresponding + delta. + target_delta: If not None, the delta for which we compute the corresponding + epsilon. Exactly one of target_eps and target_delta must be None. + + Returns: + eps, delta, opt_order. + + Raises: + ValueError: If target_eps and target_delta are messed up. + """ + if target_eps is None and target_delta is None: + raise ValueError( + "Exactly one out of eps and delta must be None. (Both are).") + + if target_eps is not None and target_delta is not None: + raise ValueError( + "Exactly one out of eps and delta must be None. (None is).") + + if target_eps is not None: + delta, opt_order = _compute_delta(orders, rdp, target_eps) + return target_eps, delta, opt_order + else: + eps, opt_order = _compute_eps(orders, rdp, target_delta) + return eps, target_delta, opt_order + + +def compute_rdp_from_ledger(ledger, orders): + """Compute RDP of Sampled Gaussian Mechanism from ledger. + + Args: + ledger: A formatted privacy ledger. + orders: An array (or a scalar) of RDP orders. + + Returns: + RDP at all orders, can be np.inf. + """ + total_rdp = np.zeros_like(orders, dtype=float) + for sample in ledger: + # Compute equivalent z from l2_clip_bounds and noise stddevs in sample. + # See https://arxiv.org/pdf/1812.06210.pdf for derivation of this formula. + effective_z = sum([ + (q.noise_stddev / q.l2_norm_bound)**-2 for q in sample.queries])**-0.5 + total_rdp += compute_rdp( + sample.selection_probability, effective_z, 1, orders) + return total_rdp \ No newline at end of file diff --git a/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/synthesizer/ctabgan_synthesizer.py b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/synthesizer/ctabgan_synthesizer.py new file mode 100644 index 0000000000000000000000000000000000000000..9fd6845ffaf8f3a991acceba92af143941e5c11f --- /dev/null +++ b/SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/synthesizer/ctabgan_synthesizer.py @@ -0,0 +1,601 @@ +import numpy as np +import pandas as pd +import torch +import torch.utils.data +import torch.optim as optim +from torch.optim import Adam +from torch.nn import functional as F +from torch.nn import (Dropout, LeakyReLU, Linear, Module, ReLU, Sequential, +Conv2d, ConvTranspose2d, Sigmoid, init, BCELoss, CrossEntropyLoss,SmoothL1Loss,LayerNorm) +from model.synthesizer.transformer import ImageTransformer,DataTransformer +from model.privacy_utils.rdp_accountant import compute_rdp, get_privacy_spent +from tqdm import tqdm + + +class Classifier(Module): + def __init__(self,input_dim, dis_dims,st_ed): + super(Classifier,self).__init__() + dim = input_dim-(st_ed[1]-st_ed[0]) + seq = [] + self.str_end = st_ed + for item in list(dis_dims): + seq += [ + Linear(dim, item), + LeakyReLU(0.2), + Dropout(0.5) + ] + dim = item + + if (st_ed[1]-st_ed[0])==1: + seq += [Linear(dim, 1)] + + elif (st_ed[1]-st_ed[0])==2: + seq += [Linear(dim, 1),Sigmoid()] + else: + seq += [Linear(dim,(st_ed[1]-st_ed[0]))] + + self.seq = Sequential(*seq) + + def forward(self, input): + + label=None + + if (self.str_end[1]-self.str_end[0])==1: + label = input[:, self.str_end[0]:self.str_end[1]] + else: + label = torch.argmax(input[:, self.str_end[0]:self.str_end[1]], axis=-1) + + new_imp = torch.cat((input[:,:self.str_end[0]],input[:,self.str_end[1]:]),1) + + if ((self.str_end[1]-self.str_end[0])==2) | ((self.str_end[1]-self.str_end[0])==1): + return self.seq(new_imp).view(-1), label + else: + return self.seq(new_imp), label + +def apply_activate(data, output_info): + data_t = [] + st = 0 + for item in output_info: + if item[1] == 'tanh': + ed = st + item[0] + data_t.append(torch.tanh(data[:, st:ed])) + st = ed + elif item[1] == 'softmax': + ed = st + item[0] + data_t.append(F.gumbel_softmax(data[:, st:ed], tau=0.2)) + st = ed + return torch.cat(data_t, dim=1) + +def get_st_ed(target_col_index,output_info): + st = 0 + c= 0 + tc= 0 + + for item in output_info: + if c==target_col_index: + break + if item[1]=='tanh': + st += item[0] + if item[2] == 'yes_g': + c+=1 + elif item[1] == 'softmax': + st += item[0] + c+=1 + tc+=1 + + ed= st+output_info[tc][0] + + return (st,ed) + +def random_choice_prob_index_sampling(probs,col_idx): + option_list = [] + for i in col_idx: + pp = probs[i] + option_list.append(np.random.choice(np.arange(len(probs[i])), p=pp)) + + return np.array(option_list).reshape(col_idx.shape) + +def random_choice_prob_index(a, axis=1): + r = np.expand_dims(np.random.rand(a.shape[1 - axis]), axis=axis) + return (a.cumsum(axis=axis) > r).argmax(axis=axis) + +def maximum_interval(output_info): + max_interval = 0 + for item in output_info: + max_interval = max(max_interval, item[0]) + return max_interval + +class Cond(object): + def __init__(self, data, output_info): + + self.model = [] + st = 0 + counter = 0 + for item in output_info: + + if item[1] == 'tanh': + st += item[0] + continue + elif item[1] == 'softmax': + ed = st + item[0] + counter += 1 + self.model.append(np.argmax(data[:, st:ed], axis=-1)) + st = ed + + self.interval = [] + self.n_col = 0 + self.n_opt = 0 + st = 0 + self.p = np.zeros((counter, maximum_interval(output_info))) + self.p_sampling = [] + for item in output_info: + if item[1] == 'tanh': + st += item[0] + continue + elif item[1] == 'softmax': + ed = st + item[0] + tmp = np.sum(data[:, st:ed], axis=0) + tmp_sampling = np.sum(data[:, st:ed], axis=0) + tmp = np.log(tmp + 1) + tmp = tmp / np.sum(tmp) + tmp_sampling = tmp_sampling / np.sum(tmp_sampling) + self.p_sampling.append(tmp_sampling) + self.p[self.n_col, :item[0]] = tmp + self.interval.append((self.n_opt, item[0])) + self.n_opt += item[0] + self.n_col += 1 + st = ed + + self.interval = np.asarray(self.interval) + + def sample_train(self, batch): + if self.n_col == 0: + return None + batch = batch + + idx = np.random.choice(np.arange(self.n_col), batch) + + vec = np.zeros((batch, self.n_opt), dtype='float32') + mask = np.zeros((batch, self.n_col), dtype='float32') + mask[np.arange(batch), idx] = 1 + opt1prime = random_choice_prob_index(self.p[idx]) + for i in np.arange(batch): + vec[i, self.interval[idx[i], 0] + opt1prime[i]] = 1 + + return vec, mask, idx, opt1prime + + def sample(self, batch): + if self.n_col == 0: + return None + batch = batch + + idx = np.random.choice(np.arange(self.n_col), batch) + + vec = np.zeros((batch, self.n_opt), dtype='float32') + opt1prime = random_choice_prob_index_sampling(self.p_sampling,idx) + + for i in np.arange(batch): + vec[i, self.interval[idx[i], 0] + opt1prime[i]] = 1 + + return vec + +def cond_loss(data, output_info, c, m): + loss = [] + st = 0 + st_c = 0 + for item in output_info: + if item[1] == 'tanh': + st += item[0] + continue + + elif item[1] == 'softmax': + ed = st + item[0] + ed_c = st_c + item[0] + tmp = F.cross_entropy( + data[:, st:ed], + torch.argmax(c[:, st_c:ed_c], dim=1), + reduction='none') + loss.append(tmp) + st = ed + st_c = ed_c + + loss = torch.stack(loss, dim=1) + return (loss * m).sum() / data.size()[0] + +class Sampler(object): + def __init__(self, data, output_info): + super(Sampler, self).__init__() + self.data = data + self.model = [] + self.n = len(data) + st = 0 + for item in output_info: + if item[1] == 'tanh': + st += item[0] + continue + elif item[1] == 'softmax': + ed = st + item[0] + tmp = [] + for j in range(item[0]): + tmp.append(np.nonzero(data[:, st + j])[0]) + self.model.append(tmp) + st = ed + + def sample(self, n, col, opt): + if col is None: + idx = np.random.choice(np.arange(self.n), n) + return self.data[idx] + idx = [] + for c, o in zip(col, opt): + idx.append(np.random.choice(self.model[c][o])) + return self.data[idx] + +class Discriminator(Module): + def __init__(self, side, layers): + super(Discriminator, self).__init__() + self.side = side + info = len(layers)-2 + self.seq = Sequential(*layers) + self.seq_info = Sequential(*layers[:info]) + + def forward(self, input): + return (self.seq(input)), self.seq_info(input) + +class Generator(Module): + def __init__(self, side, layers): + super(Generator, self).__init__() + self.side = side + self.seq = Sequential(*layers) + + def forward(self, input_): + return self.seq(input_) + +def determine_layers_disc(side, num_channels): + assert side >= 4 and side <= 64 + + layer_dims = [(1, side), (num_channels, side // 2)] + + while layer_dims[-1][1] > 3 and len(layer_dims) < 4: + layer_dims.append((layer_dims[-1][0] * 2, layer_dims[-1][1] // 2)) + + layerNorms = [] + num_c = num_channels + num_s = side / 2 + for l in range(len(layer_dims) - 1): + layerNorms.append([int(num_c), int(num_s), int(num_s)]) + num_c = num_c * 2 + num_s = num_s / 2 + + layers_D = [] + + for prev, curr, ln in zip(layer_dims, layer_dims[1:], layerNorms): + layers_D += [ + Conv2d(prev[0], curr[0], 4, 2, 1, bias=False), + LayerNorm(ln), + LeakyReLU(0.2, inplace=True), + ] + + layers_D += [Conv2d(layer_dims[-1][0], 1, layer_dims[-1][1], 1, 0), ReLU(True)] + + return layers_D + +def determine_layers_gen(side, random_dim, num_channels): + assert side >= 4 and side <= 64 + + layer_dims = [(1, side), (num_channels, side // 2)] + + while layer_dims[-1][1] > 3 and len(layer_dims) < 4: + layer_dims.append((layer_dims[-1][0] * 2, layer_dims[-1][1] // 2)) + + layerNorms = [] + + num_c = num_channels * (2 ** (len(layer_dims) - 2)) + num_s = int(side / (2 ** (len(layer_dims) - 1))) + for l in range(len(layer_dims) - 1): + layerNorms.append([int(num_c), int(num_s), int(num_s)]) + num_c = num_c / 2 + num_s = num_s * 2 + + layers_G = [ConvTranspose2d(random_dim, layer_dims[-1][0], layer_dims[-1][1], 1, 0, output_padding=0, bias=False)] + + for prev, curr, ln in zip(reversed(layer_dims), reversed(layer_dims[:-1]), layerNorms): + layers_G += [LayerNorm(ln), ReLU(True), ConvTranspose2d(prev[0], curr[0], 4, 2, 1, output_padding=0, bias=True)] + return layers_G + +def slerp(val, low, high): + low_norm = low/torch.norm(low, dim=1, keepdim=True) + high_norm = high/torch.norm(high, dim=1, keepdim=True) + omega = torch.acos((low_norm*high_norm).sum(1)).view(val.size(0), 1) + so = torch.sin(omega) + res = (torch.sin((1.0-val)*omega)/so)*low + (torch.sin(val*omega)/so) * high + + return res + +def calc_gradient_penalty_slerp(netD, real_data, fake_data, transformer, device='cpu', lambda_=10): + batchsize = real_data.shape[0] + alpha = torch.rand(batchsize, 1, device=device) + interpolates = slerp(alpha, real_data, fake_data) + interpolates = interpolates.to(device) + interpolates = transformer.transform(interpolates) + interpolates = torch.autograd.Variable(interpolates, requires_grad=True) + disc_interpolates,_ = netD(interpolates) + + gradients = torch.autograd.grad(outputs=disc_interpolates, inputs=interpolates, + grad_outputs=torch.ones(disc_interpolates.size()).to(device), + create_graph=True, retain_graph=True, only_inputs=True)[0] + + gradients_norm = gradients.norm(2, dim=1) + gradient_penalty = ((gradients_norm - 1) ** 2).mean() * lambda_ + + return gradient_penalty + +def weights_init(m): + classname = m.__class__.__name__ + + if classname.find('Conv') != -1: + init.normal_(m.weight.data, 0.0, 0.02) + + elif classname.find('BatchNorm') != -1: + init.normal_(m.weight.data, 1.0, 0.02) + init.constant_(m.bias.data, 0) + +class CTABGANSynthesizer: + def __init__(self, + class_dim=(256, 256, 256, 256), + random_dim=100, + num_channels=64, + l2scale=1e-5, + batch_size=500, + epochs=150, + device="cpu"): + + + self.random_dim = random_dim + self.class_dim = class_dim + self.num_channels = num_channels + self.dside = None + self.gside = None + self.l2scale = l2scale + self.batch_size = batch_size + self.epochs = epochs + self.device = torch.device(device) + + def fit(self, train_data=pd.DataFrame, categorical=[], mixed={}, general=[], non_categorical=[], type={}): + + problem_type = None + target_index=None + if type: + problem_type = list(type.keys())[0] + if problem_type: + target_index = train_data.columns.get_loc(type[problem_type]) + + self.transformer = DataTransformer(train_data=train_data, categorical_list=categorical, mixed_dict=mixed, general_list=general, non_categorical_list=non_categorical) + self.transformer.fit() + train_data = self.transformer.transform(train_data.values) + data_sampler = Sampler(train_data, self.transformer.output_info) + data_dim = self.transformer.output_dim + self.cond_generator = Cond(train_data, self.transformer.output_info) + + sides = [4, 8, 16, 24, 64] + col_size_d = data_dim + self.cond_generator.n_opt + for i in sides: + if i * i >= col_size_d: + self.dside = i + break + + sides = [4, 8, 16, 24, 64] + col_size_g = data_dim + for i in sides: + if i * i >= col_size_g: + self.gside = i + break + + + layers_G = determine_layers_gen(self.gside, self.random_dim+self.cond_generator.n_opt, self.num_channels) + layers_D = determine_layers_disc(self.dside, self.num_channels) + + self.generator = Generator(self.gside, layers_G).to(self.device) + discriminator = Discriminator(self.dside, layers_D).to(self.device) + optimizer_params = dict(lr=2e-4, betas=(0.5, 0.9), eps=1e-3, weight_decay=self.l2scale) + optimizerG = Adam(self.generator.parameters(), **optimizer_params) + optimizerD = Adam(discriminator.parameters(), **optimizer_params) + + st_ed = None + classifier=None + optimizerC= None + if target_index != None: + st_ed= get_st_ed(target_index,self.transformer.output_info) + classifier = Classifier(data_dim,self.class_dim,st_ed).to(self.device) + optimizerC = optim.Adam(classifier.parameters(),**optimizer_params) + + + self.generator.apply(weights_init) + discriminator.apply(weights_init) + + self.Gtransformer = ImageTransformer(self.gside) + self.Dtransformer = ImageTransformer(self.dside) + + epsilon = 0 + epoch = 0 + steps = 0 + ci = 1 + + for i in tqdm(range(self.epochs)): + + + for _ in range(ci): + noisez = torch.randn(self.batch_size, self.random_dim, device=self.device) + condvec = self.cond_generator.sample_train(self.batch_size) + + c, m, col, opt = condvec + c = torch.from_numpy(c).to(self.device) + m = torch.from_numpy(m).to(self.device) + noisez = torch.cat([noisez, c], dim=1) + noisez = noisez.view(self.batch_size,self.random_dim+self.cond_generator.n_opt,1,1) + + perm = np.arange(self.batch_size) + np.random.shuffle(perm) + real = data_sampler.sample(self.batch_size, col[perm], opt[perm]) + c_perm = c[perm] + + real = torch.from_numpy(real.astype('float32')).to(self.device) + + fake = self.generator(noisez) + faket = self.Gtransformer.inverse_transform(fake) + fakeact = apply_activate(faket, self.transformer.output_info) + + fake_cat = torch.cat([fakeact, c], dim=1) + real_cat = torch.cat([real, c_perm], dim=1) + + real_cat_d = self.Dtransformer.transform(real_cat) + fake_cat_d = self.Dtransformer.transform(fake_cat) + + optimizerD.zero_grad() + + d_real,_ = discriminator(real_cat_d) + + + d_real = -torch.mean(d_real) + d_real.backward() + + + d_fake,_ = discriminator(fake_cat_d) + + d_fake = torch.mean(d_fake) + + d_fake.backward() + + pen = calc_gradient_penalty_slerp(discriminator, real_cat, fake_cat, self.Dtransformer , self.device) + + pen.backward() + + optimizerD.step() + + noisez = torch.randn(self.batch_size, self.random_dim, device=self.device) + + condvec = self.cond_generator.sample_train(self.batch_size) + + c, m, col, opt = condvec + c = torch.from_numpy(c).to(self.device) + m = torch.from_numpy(m).to(self.device) + noisez = torch.cat([noisez, c], dim=1) + noisez = noisez.view(self.batch_size,self.random_dim+self.cond_generator.n_opt,1,1) + + optimizerG.zero_grad() + + fake = self.generator(noisez) + faket = self.Gtransformer.inverse_transform(fake) + fakeact = apply_activate(faket, self.transformer.output_info) + + fake_cat = torch.cat([fakeact, c], dim=1) + fake_cat = self.Dtransformer.transform(fake_cat) + + y_fake,info_fake = discriminator(fake_cat) + + cross_entropy = cond_loss(faket, self.transformer.output_info, c, m) + + _,info_real = discriminator(real_cat_d) + + + g = -torch.mean(y_fake) + cross_entropy + g.backward(retain_graph=True) + loss_mean = torch.norm(torch.mean(info_fake.view(self.batch_size,-1), dim=0) - torch.mean(info_real.view(self.batch_size,-1), dim=0), 1) + loss_std = torch.norm(torch.std(info_fake.view(self.batch_size,-1), dim=0) - torch.std(info_real.view(self.batch_size,-1), dim=0), 1) + loss_info = loss_mean + loss_std + loss_info.backward() + optimizerG.step() + + + if problem_type: + + fake = self.generator(noisez) + + faket = self.Gtransformer.inverse_transform(fake) + + fakeact = apply_activate(faket, self.transformer.output_info) + + real_pre, real_label = classifier(real) + fake_pre, fake_label = classifier(fakeact) + + c_loss = CrossEntropyLoss() + + if (st_ed[1] - st_ed[0])==1: + c_loss= SmoothL1Loss() + real_label = real_label.type_as(real_pre) + fake_label = fake_label.type_as(fake_pre) + real_label = torch.reshape(real_label,real_pre.size()) + fake_label = torch.reshape(fake_label,fake_pre.size()) + + + elif (st_ed[1] - st_ed[0])==2: + c_loss = BCELoss() + real_label = real_label.type_as(real_pre) + fake_label = fake_label.type_as(fake_pre) + + loss_cc = c_loss(real_pre, real_label) + loss_cg = c_loss(fake_pre, fake_label) + + optimizerG.zero_grad() + loss_cg.backward() + optimizerG.step() + + optimizerC.zero_grad() + loss_cc.backward() + optimizerC.step() + + + + + @torch.no_grad() + def sample(self, n, seed=0): + + torch.manual_seed(seed) + torch.cuda.manual_seed(seed) + sample_batch_size = 8092 + self.generator.eval() + + output_info = self.transformer.output_info + steps = n // sample_batch_size + 1 + + data = [] + + for i in range(steps): + noisez = torch.randn(self.batch_size, self.random_dim, device=self.device) + condvec = self.cond_generator.sample(self.batch_size) + c = condvec + c = torch.from_numpy(c).to(self.device) + noisez = torch.cat([noisez, c], dim=1) + noisez = noisez.view(self.batch_size,self.random_dim+self.cond_generator.n_opt,1,1) + + fake = self.generator(noisez) + faket = self.Gtransformer.inverse_transform(fake) + fakeact = apply_activate(faket,output_info) + data.append(fakeact.detach().cpu().numpy()) + + data = np.concatenate(data, axis=0) + result,resample = self.transformer.inverse_transform(data) + + while len(result) < n: + data_resample = [] + steps_left = resample// self.batch_size + 1 + + for i in range(steps_left): + noisez = torch.randn(self.batch_size, self.random_dim, device=self.device) + condvec = self.cond_generator.sample(self.batch_size) + c = condvec + c = torch.from_numpy(c).to(self.device) + noisez = torch.cat([noisez, c], dim=1) + noisez = noisez.view(self.batch_size,self.random_dim+self.cond_generator.n_opt,1,1) + + fake = self.generator(noisez) + faket = self.Gtransformer.inverse_transform(fake) + fakeact = apply_activate(faket, output_info) + data_resample.append(fakeact.detach().cpu().numpy()) + + data_resample = np.concatenate(data_resample, axis=0) + + res,resample = self.transformer.inverse_transform(data_resample) + result = np.concatenate([result,res],axis=0) + + return result[0:n] +