TabQueryBench commited on
Commit
eb0c332
·
verified ·
1 Parent(s): 5a6d389

Resume SynthData0523 main/c6 batch 4

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +34 -0
  2. SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv +3 -0
  3. SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv +3 -0
  4. SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv +3 -0
  5. SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_report.json +7 -0
  6. SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_transforms_applied.json +1 -0
  7. SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/model_input_manifest.json +176 -0
  8. SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/train_20260329_231510.log +3 -0
  9. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_gen.py +33 -0
  10. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_train.py +22 -0
  11. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/input_snapshot.json +3 -0
  12. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/models_tabbyflow/trained.pt +3 -0
  13. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/normalized_schema_snapshot.json +3 -0
  14. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/public_gate_report.json +3 -0
  15. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/staged_input_manifest.json +3 -0
  16. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/runtime_result.json +3 -0
  17. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/staged_features.json +3 -0
  18. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/test.csv +3 -0
  19. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/train.csv +3 -0
  20. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/val.csv +3 -0
  21. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_report.json +3 -0
  22. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_transforms_applied.json +3 -0
  23. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/model_input_manifest.json +3 -0
  24. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv +3 -0
  25. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow_train_meta.json +3 -0
  26. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_test.npy +3 -0
  27. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_train.npy +3 -0
  28. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_val.npy +3 -0
  29. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_test.npy +3 -0
  30. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_train.npy +3 -0
  31. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_val.npy +3 -0
  32. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/info.json +3 -0
  33. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/real.csv +3 -0
  34. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/test.csv +3 -0
  35. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/val.csv +3 -0
  36. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_test.npy +3 -0
  37. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_train.npy +3 -0
  38. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_val.npy +3 -0
  39. SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/train_20260420_063042.log +3 -0
  40. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/._data +0 -0
  41. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitignore +22 -0
  42. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitmodules +9 -0
  43. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CONFIG_DESCRIPTION.md +78 -0
  44. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/.gitignore +1 -0
  45. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/README.md +49 -0
  46. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/columns.json +3 -0
  47. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/ctabgan.py +70 -0
  48. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/eval/evaluation.py +193 -0
  49. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/pipeline/data_preparation.py +130 -0
  50. SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/privacy_utils/rdp_accountant.py +280 -0
.gitattributes CHANGED
@@ -4740,3 +4740,37 @@ SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/check
4740
  SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/scaler.pt filter=lfs diff=lfs merge=lfs -text
4741
  SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/scheduler.pt filter=lfs diff=lfs merge=lfs -text
4742
  SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/training_args.bin filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4740
  SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/scaler.pt filter=lfs diff=lfs merge=lfs -text
4741
  SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/scheduler.pt filter=lfs diff=lfs merge=lfs -text
4742
  SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/rtf_checkpoints/checkpoint-23900/training_args.bin filter=lfs diff=lfs merge=lfs -text
4743
+ SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv filter=lfs diff=lfs merge=lfs -text
4744
+ SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv filter=lfs diff=lfs merge=lfs -text
4745
+ SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv filter=lfs diff=lfs merge=lfs -text
4746
+ SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/train_20260329_231510.log filter=lfs diff=lfs merge=lfs -text
4747
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/input_snapshot.json filter=lfs diff=lfs merge=lfs -text
4748
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/models_tabbyflow/trained.pt filter=lfs diff=lfs merge=lfs -text
4749
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/normalized_schema_snapshot.json filter=lfs diff=lfs merge=lfs -text
4750
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/public_gate_report.json filter=lfs diff=lfs merge=lfs -text
4751
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/staged_input_manifest.json filter=lfs diff=lfs merge=lfs -text
4752
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/runtime_result.json filter=lfs diff=lfs merge=lfs -text
4753
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/staged_features.json filter=lfs diff=lfs merge=lfs -text
4754
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/test.csv filter=lfs diff=lfs merge=lfs -text
4755
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/train.csv filter=lfs diff=lfs merge=lfs -text
4756
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/val.csv filter=lfs diff=lfs merge=lfs -text
4757
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_report.json filter=lfs diff=lfs merge=lfs -text
4758
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_transforms_applied.json filter=lfs diff=lfs merge=lfs -text
4759
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/model_input_manifest.json filter=lfs diff=lfs merge=lfs -text
4760
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv filter=lfs diff=lfs merge=lfs -text
4761
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow_train_meta.json filter=lfs diff=lfs merge=lfs -text
4762
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_test.npy filter=lfs diff=lfs merge=lfs -text
4763
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_train.npy filter=lfs diff=lfs merge=lfs -text
4764
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_val.npy filter=lfs diff=lfs merge=lfs -text
4765
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_test.npy filter=lfs diff=lfs merge=lfs -text
4766
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_train.npy filter=lfs diff=lfs merge=lfs -text
4767
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_val.npy filter=lfs diff=lfs merge=lfs -text
4768
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/info.json filter=lfs diff=lfs merge=lfs -text
4769
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/real.csv filter=lfs diff=lfs merge=lfs -text
4770
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/test.csv filter=lfs diff=lfs merge=lfs -text
4771
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/val.csv filter=lfs diff=lfs merge=lfs -text
4772
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_test.npy filter=lfs diff=lfs merge=lfs -text
4773
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_train.npy filter=lfs diff=lfs merge=lfs -text
4774
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_val.npy filter=lfs diff=lfs merge=lfs -text
4775
+ SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/train_20260420_063042.log filter=lfs diff=lfs merge=lfs -text
4776
+ SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/columns.json filter=lfs diff=lfs merge=lfs -text
SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d28b60b361526450f0c203ddf50498854cb66ad5c1978516a99c265f529f8e4f
3
+ size 107696
SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d8f85a52de0e63e292778c26cb06223383b366c589d4226c3de68b111ba5272
3
+ size 849500
SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ede9f1e2036e743d822e8ed8d7b5e1050159e8fc7b402b758a294f7a14528fe
3
+ size 108137
SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_report.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "adapter_ready_status": "pass",
3
+ "adapter_fail_reason_code": null,
4
+ "adapter_fail_detail": null,
5
+ "adapter_transforms_applied": [],
6
+ "model_input_manifest": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/model_input_manifest.json"
7
+ }
SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/adapter_transforms_applied.json ADDED
@@ -0,0 +1 @@
 
 
1
+ []
SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/staged/realtabformer/model_input_manifest.json ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dataset_id": "c6",
3
+ "model": "realtabformer",
4
+ "target_column": "Type of Answer",
5
+ "task_type": "classification",
6
+ "column_schema": [
7
+ {
8
+ "name": "Student ID",
9
+ "role": "feature",
10
+ "semantic_type": "numeric",
11
+ "nullable": false,
12
+ "missing_tokens": [],
13
+ "parse_format": null,
14
+ "impute_strategy": "median",
15
+ "profile_stats": {
16
+ "missing_rate": 0.0,
17
+ "unique_count": 367,
18
+ "unique_ratio": 0.048062,
19
+ "example_values": [
20
+ "473",
21
+ "351",
22
+ "967",
23
+ "1557",
24
+ "394"
25
+ ]
26
+ }
27
+ },
28
+ {
29
+ "name": "Student Country",
30
+ "role": "feature",
31
+ "semantic_type": "categorical",
32
+ "nullable": false,
33
+ "missing_tokens": [],
34
+ "parse_format": null,
35
+ "impute_strategy": "mode",
36
+ "profile_stats": {
37
+ "missing_rate": 0.0,
38
+ "unique_count": 8,
39
+ "unique_ratio": 0.001048,
40
+ "example_values": [
41
+ "Portugal",
42
+ "Italy",
43
+ "Lithuania",
44
+ "Slovenia",
45
+ "Ireland"
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "name": "Question ID",
51
+ "role": "feature",
52
+ "semantic_type": "numeric",
53
+ "nullable": false,
54
+ "missing_tokens": [],
55
+ "parse_format": null,
56
+ "impute_strategy": "median",
57
+ "profile_stats": {
58
+ "missing_rate": 0.0,
59
+ "unique_count": 796,
60
+ "unique_ratio": 0.104243,
61
+ "example_values": [
62
+ "346",
63
+ "796",
64
+ "453",
65
+ "87",
66
+ "325"
67
+ ]
68
+ }
69
+ },
70
+ {
71
+ "name": "Type of Answer",
72
+ "role": "target",
73
+ "semantic_type": "boolean",
74
+ "nullable": false,
75
+ "missing_tokens": [],
76
+ "parse_format": null,
77
+ "impute_strategy": "mode",
78
+ "profile_stats": {
79
+ "missing_rate": 0.0,
80
+ "unique_count": 2,
81
+ "unique_ratio": 0.000262,
82
+ "example_values": [
83
+ "0",
84
+ "1"
85
+ ]
86
+ }
87
+ },
88
+ {
89
+ "name": "Question Level",
90
+ "role": "feature",
91
+ "semantic_type": "categorical",
92
+ "nullable": false,
93
+ "missing_tokens": [],
94
+ "parse_format": null,
95
+ "impute_strategy": "mode",
96
+ "profile_stats": {
97
+ "missing_rate": 0.0,
98
+ "unique_count": 2,
99
+ "unique_ratio": 0.000262,
100
+ "example_values": [
101
+ "Advanced",
102
+ "Basic"
103
+ ]
104
+ }
105
+ },
106
+ {
107
+ "name": "Topic",
108
+ "role": "feature",
109
+ "semantic_type": "text",
110
+ "nullable": false,
111
+ "missing_tokens": [],
112
+ "parse_format": null,
113
+ "impute_strategy": "keep_raw",
114
+ "profile_stats": {
115
+ "missing_rate": 0.0,
116
+ "unique_count": 14,
117
+ "unique_ratio": 0.001833,
118
+ "example_values": [
119
+ "Complex Numbers",
120
+ "Fundamental Mathematics",
121
+ "Linear Algebra",
122
+ "Real Functions of a single variable",
123
+ "Analytic Geometry"
124
+ ]
125
+ }
126
+ },
127
+ {
128
+ "name": "Subtopic",
129
+ "role": "feature",
130
+ "semantic_type": "text",
131
+ "nullable": false,
132
+ "missing_tokens": [],
133
+ "parse_format": null,
134
+ "impute_strategy": "keep_raw",
135
+ "profile_stats": {
136
+ "missing_rate": 0.0,
137
+ "unique_count": 24,
138
+ "unique_ratio": 0.003143,
139
+ "example_values": [
140
+ "Complex Numbers",
141
+ "Algebraic expressions, Equations, and Inequalities",
142
+ "Vector Spaces",
143
+ "Limits and Continuity",
144
+ "Linear Transformations"
145
+ ]
146
+ }
147
+ },
148
+ {
149
+ "name": "Keywords",
150
+ "role": "feature",
151
+ "semantic_type": "text",
152
+ "nullable": false,
153
+ "missing_tokens": [],
154
+ "parse_format": null,
155
+ "impute_strategy": "keep_raw",
156
+ "profile_stats": {
157
+ "missing_rate": 0.0,
158
+ "unique_count": 360,
159
+ "unique_ratio": 0.047145,
160
+ "example_values": [
161
+ "Imaginary part,Modulus of a complex number,Operations with complex numbers,Conjugate number,Real part",
162
+ "Logarithmic function,Exponential function,Simplify expressions",
163
+ "Linear independence,Span,Linear dependence",
164
+ "Indeterminate forms,Limits",
165
+ "Range,Kernel"
166
+ ]
167
+ }
168
+ }
169
+ ],
170
+ "public_manifest": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/public_gate/staged_input_manifest.json",
171
+ "train_csv": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/public/train.csv",
172
+ "val_csv": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/public/val.csv",
173
+ "test_csv": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/public/test.csv",
174
+ "features_json": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/staged/public/staged_features.json",
175
+ "public_gate_report": "/data/jialinzhang/SynthesizePipeline-server/output-SpecializedModels/c6/realtabformer/rtf-c6-20260329_231509/public_gate/public_gate_report.json"
176
+ }
SynthData0523/main/c6/realtabformer/rtf-c6-20260329_231509/train_20260329_231510.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c593588546caea885c8bc0ad25f9b58eece87a5d47e6b0e2e9106d460b86ee73
3
+ size 1707182
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_gen.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os, shutil, subprocess, sys
3
+ root = r"/workspace/ef-vfm"
4
+ name = r"pipeline_ds"
5
+ src = r"/work/output-SpecializedModels/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds"
6
+ dst_data = os.path.join(root, "data", name)
7
+ shutil.rmtree(dst_data, ignore_errors=True)
8
+ shutil.copytree(src, dst_data)
9
+ dst_syn = os.path.join(root, "synthetic", name)
10
+ os.makedirs(dst_syn, exist_ok=True)
11
+ for fn in ("real.csv", "test.csv", "val.csv"):
12
+ shutil.copy(os.path.join(src, fn), os.path.join(dst_syn, fn))
13
+ os.chdir(root)
14
+ os.environ["PYTHONPATH"] = root + os.pathsep + os.environ.get("PYTHONPATH", "")
15
+ subprocess.check_call([
16
+ sys.executable, "main.py",
17
+ "--dataname", name, "--mode", "test", "--gpu", "0",
18
+ "--no_wandb", "--exp_name", r"adapter_efvfm",
19
+ "--ckpt_path", r"/workspace/ef-vfm/ef_vfm/ckpt/pipeline_ds/adapter_efvfm/model_500.pt",
20
+ "--num_samples_to_generate", str(int(7636)),
21
+ ])
22
+ base = os.path.join(root, "ef_vfm", "result", name, r"adapter_efvfm")
23
+ best = None
24
+ best_t = -1.0
25
+ for r, _, files in os.walk(base):
26
+ if "samples.csv" in files:
27
+ p = os.path.join(r, "samples.csv")
28
+ t = os.path.getmtime(p)
29
+ if t > best_t:
30
+ best_t, best = t, p
31
+ if not best:
32
+ raise SystemExit("tabbyflow: no samples.csv in " + base)
33
+ shutil.copy(best, r"/work/output-SpecializedModels/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv")
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/_tabbyflow_train.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os, shutil, subprocess, sys
3
+ root = r"/workspace/ef-vfm"
4
+ name = r"pipeline_ds"
5
+ src = r"/work/output-SpecializedModels/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds"
6
+ os.makedirs(os.path.join(root, "data", name), exist_ok=True)
7
+ dst_data = os.path.join(root, "data", name)
8
+ dst_syn = os.path.join(root, "synthetic", name)
9
+ shutil.rmtree(dst_data, ignore_errors=True)
10
+ shutil.copytree(src, dst_data)
11
+ os.makedirs(dst_syn, exist_ok=True)
12
+ for fn in ("real.csv", "test.csv", "val.csv"):
13
+ shutil.copy(os.path.join(src, fn), os.path.join(dst_syn, fn))
14
+ os.chdir(root)
15
+ os.environ["PYTHONPATH"] = root + os.pathsep + os.environ.get("PYTHONPATH", "")
16
+ os.environ["EFVFM_SMOKE_STEPS"] = "500"
17
+ os.environ["EFVFM_ADAPTER_TRAIN"] = "1"
18
+ subprocess.check_call([
19
+ sys.executable, "main.py",
20
+ "--dataname", name, "--mode", "train", "--gpu", "0",
21
+ "--no_wandb", "--exp_name", r"adapter_efvfm",
22
+ ])
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/input_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65e30301e80c06c9014ce49f064e87375a299ebf1c313175a5a08f32ab642619
3
+ size 1350
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/models_tabbyflow/trained.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adb734fec12f2251befd371dca69e481b19464aded2a6823105a01b4be6ddbe5
3
+ size 40
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/normalized_schema_snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:065bdbcaaeac76f0cbdb0c5fff8891508d44a53a8e05c41f90aa9bc5e7681d87
3
+ size 4158
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/public_gate_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:caf5579c25c03b817ba8a8de781db7dc512fb35a1488a6e41f51f07997ce649b
3
+ size 921
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/public_gate/staged_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:220265cd461e79999e9e649a074b15d85f3dd699ad15a9e2e962233fc54ac96a
3
+ size 4959
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/runtime_result.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6724a1608a3f34120ee87e748ef97a39facca92eb7311fc0ae63e79e96901374
3
+ size 621
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/staged_features.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfdf5dc24983833c54d8dd0e6c39aaea73c21fb9552c8b7d60db4a3b4e2dc022
3
+ size 783
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/test.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d28b60b361526450f0c203ddf50498854cb66ad5c1978516a99c265f529f8e4f
3
+ size 107696
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/train.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d8f85a52de0e63e292778c26cb06223383b366c589d4226c3de68b111ba5272
3
+ size 849500
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/public/val.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ede9f1e2036e743d822e8ed8d7b5e1050159e8fc7b402b758a294f7a14528fe
3
+ size 108137
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/adapter_report.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3f152301852308e2ab1d6c5d6168600067b27234b3023c94bb3a2f404c893bd
3
+ size 322
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/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
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/staged/tabbyflow/model_input_manifest.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a06cceb0194640f866ac899656b3d24894841d175d9869695e607c5b01fe323e
3
+ size 5157
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow-c6-7636-20260420_063635.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:277de07ba0e03cc33b5811f48ac3736def96875b4f7e5a45f721cf4e74e948a5
3
+ size 562960
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabbyflow_train_meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1bbe507388dc5629e9155e6ecf504bc121a9c227c10ff53532d15220fc65ee13
3
+ size 78
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_test.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0166d691afe31be41a6a7bcbd1c19508d44d02e52cc7aa9004aef843133a4565
3
+ size 38368
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_train.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13c6003f01f936249abb83aa4818534e23fae62a3b8d55c3f2751af25aa08122
3
+ size 305568
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_cat_val.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9b139a3150ceb04ef986bce457f05379562e57b6803a33e473206b4981b0870
3
+ size 38288
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_test.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eff443efa63dca8c3aa82fa2aa01653c220cf31d5e65e2e75f839f13a2dba5eb
3
+ size 7776
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_train.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24258565807b5a7fc2c0c3c9a4f26f21a6bb9f8e60c004592425f19e3b2b55a1
3
+ size 61216
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/X_num_val.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00358b4aadd30d21f876db8493e7c6bd9c8a7d3900997d674d4e838eb4e6e5b7
3
+ size 7760
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/info.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab0cd3dd2f27cc18d6d5b50be8ec3a3c586a22598ce1e96919f15001c5e9eb37
3
+ size 1592
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/real.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d54fcadad6523ae53e8c9a3cebe53bca7b4d404fdf04df8bd475e8353b3ab273
3
+ size 174950
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/test.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef143d4543f0a65c6c7400acbe17848a1d895746e9834ab707b3234e6799d675
3
+ size 21959
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/val.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1df2b5b548fe565f4a33bd2798be543cad469f29ca7f32560e23aeb038827ae6
3
+ size 21941
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_test.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4c747068f22f9e2e9c73161ef11c536909ed8a2e44445e33a0995a4bfb0dbd4
3
+ size 7776
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_train.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80ccc3344a1009b642b589707df9c94cbc3dfa53970e361d51fe44862d17d9f2
3
+ size 61216
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/tabular_bundle/pipeline_ds/y_val.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb96c431016954da476d05276bc9daef4e208abfe3045dcaff0b65626c0ef3b1
3
+ size 7760
SynthData0523/main/c6/tabbyflow/tabbyflow-c6-20260420_063042/train_20260420_063042.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab434ed514852222d056742e0eda13b60c72167505932bcbd34f9895ff9f9b4e
3
+ size 360815
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/._data ADDED
Binary file (220 Bytes). View file
 
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitignore ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ __pycache__/
3
+ catboost_info/
4
+ **/**.pt
5
+ **/**.ipynb
6
+ !agg_results.ipynb
7
+ **/**.npy
8
+ **/**.gz
9
+ **/**.sh
10
+ **/**.obj
11
+ **/**.png
12
+ **/**.tar
13
+ **/**.code-workspace
14
+ **/**.csv
15
+ exp/**/**/results_catboost.json
16
+ exp/**/**/results_mlp.json
17
+
18
+ configs/
19
+ data/
20
+ junk/
21
+ RF/
22
+ exps/
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/.gitmodules ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [submodule "ctgan"]
2
+ # path = CTGAN/CTGAN
3
+ url = https://github.com/sdv-dev/CTGAN
4
+ [submodule "ctabgan"]
5
+ # path = CTAB-GAN
6
+ url = https://github.com/Team-TUD/CTAB-GAN
7
+ [submodule "ctabgan+"]
8
+ # path = CTAB-GAN-Plus
9
+ url = https://github.com/Team-TUD/CTAB-GAN-Plus
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CONFIG_DESCRIPTION.md ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Description of .toml config for TabDDPM
2
+ First of all, `train.T` and `eval.T` denote preprocessing for training and for evaluation, respectively.
3
+
4
+ Here we list non-obvious parameters.
5
+
6
+ Main part:
7
+ - `seed = 0` -- evaluation seed (and training, but for training it is fixed to 0)
8
+ - `parent_dir = "exp/abalone/check"` -- exp folder
9
+ - `real_data_path = "data/abalone/"`
10
+ - `model_type = "mlp"` -- model type that approximates the reverse process
11
+ - `num_numerical_features ` -- a number of numerical features in dataset
12
+ - `device = "cuda:0"`
13
+
14
+ Model params:
15
+ - `is_y_cond` -- false for regression, true for classification
16
+ - `d_in` -- input dimension (not necessary, since scripts calculate it automatically)
17
+ - `num_calsses` -- zero for regression, a number of classes for classification
18
+ - `rtdl_params` -- MLP parameters
19
+
20
+ ```toml
21
+ seed = 0
22
+ parent_dir = "exp/abalone/check"
23
+ real_data_path = "data/abalone/"
24
+ model_type = "mlp"
25
+ num_numerical_features = 7
26
+ device = "cuda:0"
27
+
28
+ [model_params]
29
+ is_y_cond = false
30
+ d_in = 11
31
+ num_classes = 0
32
+
33
+ [model_params.rtdl_params]
34
+ d_layers = [
35
+ 256,
36
+ 256,
37
+ ]
38
+ dropout = 0.0
39
+
40
+ [diffusion_params]
41
+ num_timesteps = 1000
42
+ gaussian_loss_type = "mse"
43
+ scheduler = "cosine"
44
+
45
+ [train.main]
46
+ steps = 1000
47
+ lr = 0.001
48
+ weight_decay = 1e-05
49
+ batch_size = 4096
50
+
51
+ [train.T]
52
+ seed = 0
53
+ normalization = "quantile"
54
+ num_nan_policy = "__none__"
55
+ cat_nan_policy = "__none__"
56
+ cat_min_frequency = "__none__"
57
+ cat_encoding = "__none__"
58
+ y_policy = "default"
59
+
60
+ [sample]
61
+ num_samples = 20800
62
+ batch_size = 10000
63
+ seed = 0
64
+
65
+ [eval.type]
66
+ eval_model = "catboost"
67
+ eval_type = "synthetic"
68
+
69
+ [eval.T]
70
+ seed = 0
71
+ normalization = "__none__"
72
+ num_nan_policy = "__none__"
73
+ cat_nan_policy = "__none__"
74
+ cat_min_frequency = "__none__"
75
+ cat_encoding = "__none__"
76
+ y_policy = "default"
77
+
78
+ ```
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ **/**.csv
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CTAB-GAN+
2
+ 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.
3
+ If you have any question, please contact `z.zhao-8@tudelft.nl` for more information.
4
+
5
+
6
+ ## Prerequisite
7
+
8
+ The required package version
9
+ ```
10
+ numpy==1.21.0
11
+ torch==1.9.1
12
+ pandas==1.2.4
13
+ sklearn==0.24.1
14
+ dython==0.6.4.post1
15
+ scipy==1.4.1
16
+ ```
17
+ 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!
18
+
19
+ ## Example
20
+ `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.
21
+ The evaluation code is also provided.
22
+
23
+ ## Problem type
24
+
25
+ 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:
26
+ ```
27
+ problem_type= {None: None}
28
+ ```
29
+
30
+ ## For large dataset
31
+
32
+ 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
33
+ ```
34
+ sides = [4, 8, 16, 24, 32]
35
+ ```
36
+ 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.
37
+
38
+ ## Bibtex
39
+
40
+ To cite this paper, you could use this bibtex
41
+
42
+ ```
43
+ @article{zhao2022ctab,
44
+ title={CTAB-GAN+: Enhancing Tabular Data Synthesis},
45
+ author={Zhao, Zilong and Kunar, Aditya and Birke, Robert and Chen, Lydia Y},
46
+ journal={arXiv preprint arXiv:2204.00401},
47
+ year={2022}
48
+ }
49
+ ```
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/columns.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0d9e05a1c251995561cb1f4b2688be2c332a4971a0513d15645089efc0e236a
3
+ size 4355
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/ctabgan.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Generative model training algorithm based on the CTABGANSynthesiser
3
+
4
+ """
5
+ import pandas as pd
6
+ import time
7
+ from model.pipeline.data_preparation import DataPrep
8
+ from model.synthesizer.ctabgan_synthesizer import CTABGANSynthesizer
9
+
10
+ import warnings
11
+
12
+ warnings.filterwarnings("ignore")
13
+
14
+ class CTABGAN():
15
+
16
+ def __init__(self,
17
+ df,
18
+ test_ratio = 0.20,
19
+ categorical_columns = [ 'workclass', 'education', 'marital-status', 'occupation', 'relationship', 'race', 'gender', 'native-country', 'income'],
20
+ log_columns = [],
21
+ mixed_columns= {'capital-loss':[0.0],'capital-gain':[0.0]},
22
+ general_columns = ["age"],
23
+ non_categorical_columns = [],
24
+ integer_columns = ['age', 'fnlwgt','capital-gain', 'capital-loss','hours-per-week'],
25
+ problem_type= {"Classification": "income"},
26
+ class_dim=(256, 256, 256, 256),
27
+ random_dim=100,
28
+ num_channels=64,
29
+ l2scale=1e-5,
30
+ batch_size=500,
31
+ epochs=150,
32
+ device="cpu"):
33
+
34
+ self.__name__ = 'CTABGAN'
35
+
36
+ self.synthesizer = CTABGANSynthesizer(
37
+ class_dim=class_dim,
38
+ random_dim=random_dim,
39
+ num_channels=num_channels,
40
+ l2scale=l2scale,
41
+ batch_size=batch_size,
42
+ epochs=epochs,
43
+ device=device
44
+ )
45
+ self.raw_df = df
46
+ self.test_ratio = test_ratio
47
+ self.categorical_columns = categorical_columns
48
+ self.log_columns = log_columns
49
+ self.mixed_columns = mixed_columns
50
+ self.general_columns = general_columns
51
+ self.non_categorical_columns = non_categorical_columns
52
+ self.integer_columns = integer_columns
53
+ self.problem_type = problem_type
54
+
55
+ def fit(self):
56
+
57
+ start_time = time.time()
58
+ 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)
59
+ self.synthesizer.fit(train_data=self.data_prep.df, categorical = self.data_prep.column_types["categorical"], mixed = self.data_prep.column_types["mixed"],
60
+ general = self.data_prep.column_types["general"], non_categorical = self.data_prep.column_types["non_categorical"], type=self.problem_type)
61
+ end_time = time.time()
62
+ print('Finished training in',end_time-start_time," seconds.")
63
+
64
+
65
+ def generate_samples(self, seed=0):
66
+
67
+ sample = self.synthesizer.sample(len(self.raw_df), seed)
68
+ sample_df = self.data_prep.inverse_prep(sample)
69
+
70
+ return sample_df
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/eval/evaluation.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ from sklearn import metrics
4
+ from sklearn import model_selection
5
+ from sklearn.preprocessing import MinMaxScaler,StandardScaler
6
+ from sklearn.neural_network import MLPClassifier
7
+ from sklearn.linear_model import LogisticRegression
8
+ from sklearn import svm,tree
9
+ from sklearn.ensemble import RandomForestClassifier
10
+ from dython.nominal import compute_associations
11
+ from scipy.stats import wasserstein_distance
12
+ from scipy.spatial import distance
13
+ import warnings
14
+
15
+ warnings.filterwarnings("ignore")
16
+
17
+ def supervised_model_training(x_train, y_train, x_test,
18
+ y_test, model_name):
19
+
20
+
21
+ if model_name == 'lr':
22
+ model = LogisticRegression(random_state=42,max_iter=500)
23
+ elif model_name == 'svm':
24
+ model = svm.SVC(random_state=42,probability=True)
25
+ elif model_name == 'dt':
26
+ model = tree.DecisionTreeClassifier(random_state=42)
27
+ elif model_name == 'rf':
28
+ model = RandomForestClassifier(random_state=42)
29
+ elif model_name == "mlp":
30
+ model = MLPClassifier(random_state=42,max_iter=100)
31
+
32
+ model.fit(x_train, y_train)
33
+ pred = model.predict(x_test)
34
+
35
+ if len(np.unique(y_train))>2:
36
+ predict = model.predict_proba(x_test)
37
+ acc = metrics.accuracy_score(y_test,pred)*100
38
+ auc = metrics.roc_auc_score(y_test, predict,average="weighted",multi_class="ovr")
39
+ f1_score = metrics.precision_recall_fscore_support(y_test, pred,average="weighted")[2]
40
+ return [acc, auc,f1_score]
41
+
42
+ else:
43
+ predict = model.predict_proba(x_test)[:,1]
44
+ acc = metrics.accuracy_score(y_test,pred)*100
45
+ auc = metrics.roc_auc_score(y_test, predict)
46
+ f1_score = metrics.precision_recall_fscore_support(y_test,pred)[2].mean()
47
+ return [acc, auc,f1_score]
48
+
49
+
50
+ def get_utility_metrics(real_path,fake_paths,scaler="MinMax",classifiers=["lr","dt","rf","mlp"],test_ratio=.20):
51
+
52
+ data_real = pd.read_csv(real_path).to_numpy()
53
+ data_dim = data_real.shape[1]
54
+
55
+ data_real_y = data_real[:,-1]
56
+ data_real_X = data_real[:,:data_dim-1]
57
+ 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)
58
+
59
+ if scaler=="MinMax":
60
+ scaler_real = MinMaxScaler()
61
+ else:
62
+ scaler_real = StandardScaler()
63
+
64
+ scaler_real.fit(data_real_X)
65
+ X_train_real_scaled = scaler_real.transform(X_train_real)
66
+ X_test_real_scaled = scaler_real.transform(X_test_real)
67
+
68
+ all_real_results = []
69
+ for classifier in classifiers:
70
+ real_results = supervised_model_training(X_train_real_scaled,y_train_real,X_test_real_scaled,y_test_real,classifier)
71
+ all_real_results.append(real_results)
72
+
73
+ all_fake_results_avg = []
74
+
75
+ for fake_path in fake_paths:
76
+ data_fake = pd.read_csv(fake_path).to_numpy()
77
+ data_fake_y = data_fake[:,-1]
78
+ data_fake_X = data_fake[:,:data_dim-1]
79
+ 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)
80
+
81
+ if scaler=="MinMax":
82
+ scaler_fake = MinMaxScaler()
83
+ else:
84
+ scaler_fake = StandardScaler()
85
+
86
+ scaler_fake.fit(data_fake_X)
87
+
88
+ X_train_fake_scaled = scaler_fake.transform(X_train_fake)
89
+
90
+ all_fake_results = []
91
+ for classifier in classifiers:
92
+ fake_results = supervised_model_training(X_train_fake_scaled,y_train_fake,X_test_real_scaled,y_test_real,classifier)
93
+ all_fake_results.append(fake_results)
94
+
95
+ all_fake_results_avg.append(all_fake_results)
96
+
97
+ diff_results = np.array(all_real_results)- np.array(all_fake_results_avg).mean(axis=0)
98
+
99
+ return diff_results
100
+
101
+ def stat_sim(real_path,fake_path,cat_cols=None):
102
+
103
+ Stat_dict={}
104
+
105
+ real = pd.read_csv(real_path)
106
+ fake = pd.read_csv(fake_path)
107
+
108
+ really = real.copy()
109
+ fakey = fake.copy()
110
+
111
+ real_corr = compute_associations(real, nominal_columns=cat_cols)
112
+
113
+ fake_corr = compute_associations(fake, nominal_columns=cat_cols)
114
+
115
+ corr_dist = np.linalg.norm(real_corr - fake_corr)
116
+
117
+ cat_stat = []
118
+ num_stat = []
119
+
120
+ for column in real.columns:
121
+
122
+ if column in cat_cols:
123
+
124
+ real_pdf=(really[column].value_counts()/really[column].value_counts().sum())
125
+ fake_pdf=(fakey[column].value_counts()/fakey[column].value_counts().sum())
126
+ categories = (fakey[column].value_counts()/fakey[column].value_counts().sum()).keys().tolist()
127
+ sorted_categories = sorted(categories)
128
+
129
+ real_pdf_values = []
130
+ fake_pdf_values = []
131
+
132
+ for i in sorted_categories:
133
+ real_pdf_values.append(real_pdf[i])
134
+ fake_pdf_values.append(fake_pdf[i])
135
+
136
+ if len(real_pdf)!=len(fake_pdf):
137
+ zero_cats = set(really[column].value_counts().keys())-set(fakey[column].value_counts().keys())
138
+ for z in zero_cats:
139
+ real_pdf_values.append(real_pdf[z])
140
+ fake_pdf_values.append(0)
141
+ Stat_dict[column]=(distance.jensenshannon(real_pdf_values,fake_pdf_values, 2.0))
142
+ cat_stat.append(Stat_dict[column])
143
+ else:
144
+ scaler = MinMaxScaler()
145
+ scaler.fit(real[column].values.reshape(-1,1))
146
+ l1 = scaler.transform(real[column].values.reshape(-1,1)).flatten()
147
+ l2 = scaler.transform(fake[column].values.reshape(-1,1)).flatten()
148
+ Stat_dict[column]= (wasserstein_distance(l1,l2))
149
+ num_stat.append(Stat_dict[column])
150
+
151
+ return [np.mean(num_stat),np.mean(cat_stat),corr_dist]
152
+
153
+ def privacy_metrics(real_path,fake_path,data_percent=15):
154
+
155
+ real = pd.read_csv(real_path).drop_duplicates(keep=False)
156
+ fake = pd.read_csv(fake_path).drop_duplicates(keep=False)
157
+
158
+ real_refined = real.sample(n=int(len(real)*(.01*data_percent)), random_state=42).to_numpy()
159
+ fake_refined = fake.sample(n=int(len(fake)*(.01*data_percent)), random_state=42).to_numpy()
160
+
161
+ scalerR = StandardScaler()
162
+ scalerR.fit(real_refined)
163
+ scalerF = StandardScaler()
164
+ scalerF.fit(fake_refined)
165
+ df_real_scaled = scalerR.transform(real_refined)
166
+ df_fake_scaled = scalerF.transform(fake_refined)
167
+
168
+ dist_rf = metrics.pairwise_distances(df_real_scaled, Y=df_fake_scaled, metric='minkowski', n_jobs=-1)
169
+ dist_rr = metrics.pairwise_distances(df_real_scaled, Y=None, metric='minkowski', n_jobs=-1)
170
+ rd_dist_rr = dist_rr[~np.eye(dist_rr.shape[0],dtype=bool)].reshape(dist_rr.shape[0],-1)
171
+ dist_ff = metrics.pairwise_distances(df_fake_scaled, Y=None, metric='minkowski', n_jobs=-1)
172
+ rd_dist_ff = dist_ff[~np.eye(dist_ff.shape[0],dtype=bool)].reshape(dist_ff.shape[0],-1)
173
+ smallest_two_indexes_rf = [dist_rf[i].argsort()[:2] for i in range(len(dist_rf))]
174
+ smallest_two_rf = [dist_rf[i][smallest_two_indexes_rf[i]] for i in range(len(dist_rf))]
175
+ smallest_two_indexes_rr = [rd_dist_rr[i].argsort()[:2] for i in range(len(rd_dist_rr))]
176
+ smallest_two_rr = [rd_dist_rr[i][smallest_two_indexes_rr[i]] for i in range(len(rd_dist_rr))]
177
+ smallest_two_indexes_ff = [rd_dist_ff[i].argsort()[:2] for i in range(len(rd_dist_ff))]
178
+ smallest_two_ff = [rd_dist_ff[i][smallest_two_indexes_ff[i]] for i in range(len(rd_dist_ff))]
179
+ nn_ratio_rr = np.array([i[0]/i[1] for i in smallest_two_rr])
180
+ nn_ratio_ff = np.array([i[0]/i[1] for i in smallest_two_ff])
181
+ nn_ratio_rf = np.array([i[0]/i[1] for i in smallest_two_rf])
182
+ nn_fifth_perc_rr = np.percentile(nn_ratio_rr,5)
183
+ nn_fifth_perc_ff = np.percentile(nn_ratio_ff,5)
184
+ nn_fifth_perc_rf = np.percentile(nn_ratio_rf,5)
185
+
186
+ min_dist_rf = np.array([i[0] for i in smallest_two_rf])
187
+ fifth_perc_rf = np.percentile(min_dist_rf,5)
188
+ min_dist_rr = np.array([i[0] for i in smallest_two_rr])
189
+ fifth_perc_rr = np.percentile(min_dist_rr,5)
190
+ min_dist_ff = np.array([i[0] for i in smallest_two_ff])
191
+ fifth_perc_ff = np.percentile(min_dist_ff,5)
192
+
193
+ 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)
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/pipeline/data_preparation.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ from sklearn import preprocessing
4
+ from sklearn import model_selection
5
+
6
+ class DataPrep(object):
7
+
8
+ 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):
9
+
10
+
11
+ self.categorical_columns = categorical
12
+ self.log_columns = log
13
+ self.mixed_columns = mixed
14
+ self.general_columns = general
15
+ self.non_categorical_columns = non_categorical
16
+ self.integer_columns = integer
17
+ self.column_types = dict()
18
+ self.column_types["categorical"] = []
19
+ self.column_types["mixed"] = {}
20
+ self.column_types["general"] = []
21
+ self.column_types["non_categorical"] = []
22
+ self.lower_bounds = {}
23
+ self.label_encoder_list = []
24
+
25
+ target_col = list(type.values())[0]
26
+ if target_col is not None:
27
+ y_real = raw_df[target_col]
28
+ X_real = raw_df.drop(columns=[target_col])
29
+ 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)
30
+
31
+ X_train_real[target_col]= y_train_real
32
+
33
+ self.df = X_train_real
34
+ else:
35
+ self.df = raw_df
36
+
37
+ self.df = self.df.replace(r' ', np.nan)
38
+ self.df = self.df.fillna('empty')
39
+
40
+ all_columns= set(self.df.columns)
41
+ irrelevant_missing_columns = set(self.categorical_columns)
42
+ relevant_missing_columns = list(all_columns - irrelevant_missing_columns)
43
+
44
+ for i in relevant_missing_columns:
45
+ if i in self.log_columns:
46
+ if "empty" in list(self.df[i].values):
47
+ self.df[i] = self.df[i].apply(lambda x: -9999999 if x=="empty" else x)
48
+ self.mixed_columns[i] = [-9999999]
49
+ elif i in list(self.mixed_columns.keys()):
50
+ if "empty" in list(self.df[i].values):
51
+ self.df[i] = self.df[i].apply(lambda x: -9999999 if x=="empty" else x )
52
+ self.mixed_columns[i].append(-9999999)
53
+ else:
54
+ if "empty" in list(self.df[i].values):
55
+ self.df[i] = self.df[i].apply(lambda x: -9999999 if x=="empty" else x)
56
+ self.mixed_columns[i] = [-9999999]
57
+
58
+ if self.log_columns:
59
+ for log_column in self.log_columns:
60
+ valid_indices = []
61
+ for idx,val in enumerate(self.df[log_column].values):
62
+ if val!=-9999999:
63
+ valid_indices.append(idx)
64
+ eps = 1
65
+ lower = np.min(self.df[log_column].iloc[valid_indices].values)
66
+ self.lower_bounds[log_column] = lower
67
+ if lower>0:
68
+ self.df[log_column] = self.df[log_column].apply(lambda x: np.log(x) if x!=-9999999 else -9999999)
69
+ elif lower == 0:
70
+ self.df[log_column] = self.df[log_column].apply(lambda x: np.log(x+eps) if x!=-9999999 else -9999999)
71
+ else:
72
+ self.df[log_column] = self.df[log_column].apply(lambda x: np.log(x-lower+eps) if x!=-9999999 else -9999999)
73
+
74
+ for column_index, column in enumerate(self.df.columns):
75
+ if column in self.categorical_columns:
76
+ label_encoder = preprocessing.LabelEncoder()
77
+ self.df[column] = self.df[column].astype(str)
78
+ label_encoder.fit(self.df[column])
79
+ current_label_encoder = dict()
80
+ current_label_encoder['column'] = column
81
+ current_label_encoder['label_encoder'] = label_encoder
82
+ transformed_column = label_encoder.transform(self.df[column])
83
+ self.df[column] = transformed_column
84
+ self.label_encoder_list.append(current_label_encoder)
85
+ self.column_types["categorical"].append(column_index)
86
+
87
+ if column in self.general_columns:
88
+ self.column_types["general"].append(column_index)
89
+
90
+ if column in self.non_categorical_columns:
91
+ self.column_types["non_categorical"].append(column_index)
92
+
93
+ elif column in self.mixed_columns:
94
+ self.column_types["mixed"][column_index] = self.mixed_columns[column]
95
+
96
+ elif column in self.general_columns:
97
+ self.column_types["general"].append(column_index)
98
+
99
+
100
+ super().__init__()
101
+
102
+ def inverse_prep(self, data, eps=1):
103
+
104
+ df_sample = pd.DataFrame(data,columns=self.df.columns)
105
+
106
+ for i in range(len(self.label_encoder_list)):
107
+ le = self.label_encoder_list[i]["label_encoder"]
108
+ df_sample[self.label_encoder_list[i]["column"]] = df_sample[self.label_encoder_list[i]["column"]].astype(int)
109
+ df_sample[self.label_encoder_list[i]["column"]] = le.inverse_transform(df_sample[self.label_encoder_list[i]["column"]])
110
+
111
+ if self.log_columns:
112
+ for i in df_sample:
113
+ if i in self.log_columns:
114
+ lower_bound = self.lower_bounds[i]
115
+ if lower_bound>0:
116
+ df_sample[i].apply(lambda x: np.exp(x))
117
+ elif lower_bound==0:
118
+ 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))
119
+ else:
120
+ df_sample[i] = df_sample[i].apply(lambda x: np.exp(x)-eps+lower_bound)
121
+
122
+ if self.integer_columns:
123
+ for column in self.integer_columns:
124
+ df_sample[column]= (np.round(df_sample[column].values))
125
+ df_sample[column] = df_sample[column].astype(int)
126
+
127
+ df_sample.replace(-9999999, np.nan,inplace=True)
128
+ df_sample.replace('empty', np.nan,inplace=True)
129
+
130
+ return df_sample
SynthData0523/main/c6/tabddpm/tabddpm-c6-20260510_222430/_tabddpm_runtime/CTAB-GAN-Plus/model copy/privacy_utils/rdp_accountant.py ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import absolute_import
2
+ from __future__ import division
3
+ from __future__ import print_function
4
+
5
+ import math
6
+ import sys
7
+
8
+ import numpy as np
9
+ from scipy import special
10
+ import six
11
+
12
+ ########################
13
+ # LOG-SPACE ARITHMETIC #
14
+ ########################
15
+
16
+
17
+ def _log_add(logx, logy):
18
+ """Add two numbers in the log space."""
19
+ a, b = min(logx, logy), max(logx, logy)
20
+ if a == -np.inf: # adding 0
21
+ return b
22
+ # Use exp(a) + exp(b) = (exp(a - b) + 1) * exp(b)
23
+ return math.log1p(math.exp(a - b)) + b # log1p(x) = log(x + 1)
24
+
25
+
26
+ def _log_sub(logx, logy):
27
+ """Subtract two numbers in the log space. Answer must be non-negative."""
28
+ if logx < logy:
29
+ raise ValueError("The result of subtraction must be non-negative.")
30
+ if logy == -np.inf: # subtracting 0
31
+ return logx
32
+ if logx == logy:
33
+ return -np.inf # 0 is represented as -np.inf in the log space.
34
+
35
+ try:
36
+ # Use exp(x) - exp(y) = (exp(x - y) - 1) * exp(y).
37
+ return math.log(math.expm1(logx - logy)) + logy # expm1(x) = exp(x) - 1
38
+ except OverflowError:
39
+ return logx
40
+
41
+
42
+ def _log_print(logx):
43
+ """Pretty print."""
44
+ if logx < math.log(sys.float_info.max):
45
+ return "{}".format(math.exp(logx))
46
+ else:
47
+ return "exp({})".format(logx)
48
+
49
+
50
+ def _compute_log_a_int(q, sigma, alpha):
51
+ """Compute log(A_alpha) for integer alpha. 0 < q < 1."""
52
+ assert isinstance(alpha, six.integer_types)
53
+
54
+ # Initialize with 0 in the log space.
55
+ log_a = -np.inf
56
+
57
+ for i in range(alpha + 1):
58
+ log_coef_i = (
59
+ math.log(special.binom(alpha, i)) + i * math.log(q) +
60
+ (alpha - i) * math.log(1 - q))
61
+
62
+ s = log_coef_i + (i * i - i) / (2 * (sigma**2))
63
+ log_a = _log_add(log_a, s)
64
+
65
+ return float(log_a)
66
+
67
+
68
+ def _compute_log_a_frac(q, sigma, alpha):
69
+ """Compute log(A_alpha) for fractional alpha. 0 < q < 1."""
70
+ # The two parts of A_alpha, integrals over (-inf,z0] and [z0, +inf), are
71
+ # initialized to 0 in the log space:
72
+ log_a0, log_a1 = -np.inf, -np.inf
73
+ i = 0
74
+
75
+ z0 = sigma**2 * math.log(1 / q - 1) + .5
76
+
77
+ while True: # do ... until loop
78
+ coef = special.binom(alpha, i)
79
+ log_coef = math.log(abs(coef))
80
+ j = alpha - i
81
+
82
+ log_t0 = log_coef + i * math.log(q) + j * math.log(1 - q)
83
+ log_t1 = log_coef + j * math.log(q) + i * math.log(1 - q)
84
+
85
+ log_e0 = math.log(.5) + _log_erfc((i - z0) / (math.sqrt(2) * sigma))
86
+ log_e1 = math.log(.5) + _log_erfc((z0 - j) / (math.sqrt(2) * sigma))
87
+
88
+ log_s0 = log_t0 + (i * i - i) / (2 * (sigma**2)) + log_e0
89
+ log_s1 = log_t1 + (j * j - j) / (2 * (sigma**2)) + log_e1
90
+
91
+ if coef > 0:
92
+ log_a0 = _log_add(log_a0, log_s0)
93
+ log_a1 = _log_add(log_a1, log_s1)
94
+ else:
95
+ log_a0 = _log_sub(log_a0, log_s0)
96
+ log_a1 = _log_sub(log_a1, log_s1)
97
+
98
+ i += 1
99
+ if max(log_s0, log_s1) < -30:
100
+ break
101
+
102
+ return _log_add(log_a0, log_a1)
103
+
104
+
105
+ def _compute_log_a(q, sigma, alpha):
106
+ """Compute log(A_alpha) for any positive finite alpha."""
107
+ if float(alpha).is_integer():
108
+ return _compute_log_a_int(q, sigma, int(alpha))
109
+ else:
110
+ return _compute_log_a_frac(q, sigma, alpha)
111
+
112
+
113
+ def _log_erfc(x):
114
+ """Compute log(erfc(x)) with high accuracy for large x."""
115
+ try:
116
+ return math.log(2) + special.log_ndtr(-x * 2**.5)
117
+ except NameError:
118
+ # If log_ndtr is not available, approximate as follows:
119
+ r = special.erfc(x)
120
+ if r == 0.0:
121
+ # Using the Laurent series at infinity for the tail of the erfc function:
122
+ # erfc(x) ~ exp(-x^2-.5/x^2+.625/x^4)/(x*pi^.5)
123
+ # To verify in Mathematica:
124
+ # Series[Log[Erfc[x]] + Log[x] + Log[Pi]/2 + x^2, {x, Infinity, 6}]
125
+ return (-math.log(math.pi) / 2 - math.log(x) - x**2 - .5 * x**-2 +
126
+ .625 * x**-4 - 37. / 24. * x**-6 + 353. / 64. * x**-8)
127
+ else:
128
+ return math.log(r)
129
+
130
+
131
+ def _compute_delta(orders, rdp, eps):
132
+ """Compute delta given a list of RDP values and target epsilon.
133
+
134
+ Args:
135
+ orders: An array (or a scalar) of orders.
136
+ rdp: A list (or a scalar) of RDP guarantees.
137
+ eps: The target epsilon.
138
+
139
+ Returns:
140
+ Pair of (delta, optimal_order).
141
+
142
+ Raises:
143
+ ValueError: If input is malformed.
144
+
145
+ """
146
+ orders_vec = np.atleast_1d(orders)
147
+ rdp_vec = np.atleast_1d(rdp)
148
+
149
+ if len(orders_vec) != len(rdp_vec):
150
+ raise ValueError("Input lists must have the same length.")
151
+
152
+ deltas = np.exp((rdp_vec - eps) * (orders_vec - 1))
153
+ idx_opt = np.argmin(deltas)
154
+ return min(deltas[idx_opt], 1.), orders_vec[idx_opt]
155
+
156
+
157
+ def _compute_eps(orders, rdp, delta):
158
+ """Compute epsilon given a list of RDP values and target delta.
159
+
160
+ Args:
161
+ orders: An array (or a scalar) of orders.
162
+ rdp: A list (or a scalar) of RDP guarantees.
163
+ delta: The target delta.
164
+
165
+ Returns:
166
+ Pair of (eps, optimal_order).
167
+
168
+ Raises:
169
+ ValueError: If input is malformed.
170
+
171
+ """
172
+ orders_vec = np.atleast_1d(orders)
173
+ rdp_vec = np.atleast_1d(rdp)
174
+
175
+ if len(orders_vec) != len(rdp_vec):
176
+ raise ValueError("Input lists must have the same length.")
177
+
178
+ eps = rdp_vec - math.log(delta) / (orders_vec - 1)
179
+
180
+ idx_opt = np.nanargmin(eps) # Ignore NaNs
181
+ return eps[idx_opt], orders_vec[idx_opt]
182
+
183
+
184
+ def _compute_rdp(q, sigma, alpha):
185
+ """Compute RDP of the Sampled Gaussian mechanism at order alpha.
186
+
187
+ Args:
188
+ q: The sampling rate.
189
+ sigma: The std of the additive Gaussian noise.
190
+ alpha: The order at which RDP is computed.
191
+
192
+ Returns:
193
+ RDP at alpha, can be np.inf.
194
+ """
195
+ if q == 0:
196
+ return 0
197
+
198
+ if q == 1.:
199
+ return alpha / (2 * sigma**2)
200
+
201
+ if np.isinf(alpha):
202
+ return np.inf
203
+
204
+ return _compute_log_a(q, sigma, alpha) / (alpha - 1)
205
+
206
+
207
+ def compute_rdp(q, noise_multiplier, steps, orders):
208
+ """Compute RDP of the Sampled Gaussian Mechanism.
209
+
210
+ Args:
211
+ q: The sampling rate.
212
+ noise_multiplier: The ratio of the standard deviation of the Gaussian noise
213
+ to the l2-sensitivity of the function to which it is added.
214
+ steps: The number of steps.
215
+ orders: An array (or a scalar) of RDP orders.
216
+
217
+ Returns:
218
+ The RDPs at all orders, can be np.inf.
219
+ """
220
+ if np.isscalar(orders):
221
+ rdp = _compute_rdp(q, noise_multiplier, orders)
222
+ else:
223
+ rdp = np.array([_compute_rdp(q, noise_multiplier, order)
224
+ for order in orders])
225
+
226
+ return rdp * steps
227
+
228
+
229
+ def get_privacy_spent(orders, rdp, target_eps=None, target_delta=None):
230
+ """Compute delta (or eps) for given eps (or delta) from RDP values.
231
+
232
+ Args:
233
+ orders: An array (or a scalar) of RDP orders.
234
+ rdp: An array of RDP values. Must be of the same length as the orders list.
235
+ target_eps: If not None, the epsilon for which we compute the corresponding
236
+ delta.
237
+ target_delta: If not None, the delta for which we compute the corresponding
238
+ epsilon. Exactly one of target_eps and target_delta must be None.
239
+
240
+ Returns:
241
+ eps, delta, opt_order.
242
+
243
+ Raises:
244
+ ValueError: If target_eps and target_delta are messed up.
245
+ """
246
+ if target_eps is None and target_delta is None:
247
+ raise ValueError(
248
+ "Exactly one out of eps and delta must be None. (Both are).")
249
+
250
+ if target_eps is not None and target_delta is not None:
251
+ raise ValueError(
252
+ "Exactly one out of eps and delta must be None. (None is).")
253
+
254
+ if target_eps is not None:
255
+ delta, opt_order = _compute_delta(orders, rdp, target_eps)
256
+ return target_eps, delta, opt_order
257
+ else:
258
+ eps, opt_order = _compute_eps(orders, rdp, target_delta)
259
+ return eps, target_delta, opt_order
260
+
261
+
262
+ def compute_rdp_from_ledger(ledger, orders):
263
+ """Compute RDP of Sampled Gaussian Mechanism from ledger.
264
+
265
+ Args:
266
+ ledger: A formatted privacy ledger.
267
+ orders: An array (or a scalar) of RDP orders.
268
+
269
+ Returns:
270
+ RDP at all orders, can be np.inf.
271
+ """
272
+ total_rdp = np.zeros_like(orders, dtype=float)
273
+ for sample in ledger:
274
+ # Compute equivalent z from l2_clip_bounds and noise stddevs in sample.
275
+ # See https://arxiv.org/pdf/1812.06210.pdf for derivation of this formula.
276
+ effective_z = sum([
277
+ (q.noise_stddev / q.l2_norm_bound)**-2 for q in sample.queries])**-0.5
278
+ total_rdp += compute_rdp(
279
+ sample.selection_probability, effective_z, 1, orders)
280
+ return total_rdp