seqtrees 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
seqtrees-0.1.0/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 SeqTrees contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ https://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: seqtrees
3
+ Version: 0.1.0
4
+ Summary: Sequential tree models for tabular synthetic data generation
5
+ Author: SeqTrees contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/EulerLettersAI/seqtrees
8
+ Project-URL: Documentation, https://eulerlettersai.github.io/seqtrees/
9
+ Project-URL: Issues, https://github.com/EulerLettersAI/seqtrees/issues
10
+ Keywords: synthetic-data,tabular-data,decision-tree,privacy,sequential-model
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=8; extra == "dev"
23
+ Provides-Extra: docs
24
+ Requires-Dist: mkdocs<2,>=1.6; extra == "docs"
25
+ Requires-Dist: mkdocstrings[python]<1,>=0.25; extra == "docs"
26
+ Requires-Dist: mkdocs-bibtex<3,>=2; extra == "docs"
27
+ Requires-Dist: pymdown-extensions<11,>=10; extra == "docs"
28
+ Provides-Extra: examples
29
+ Requires-Dist: jupyterlab>=4; extra == "examples"
30
+ Requires-Dist: pandas>=2; extra == "examples"
31
+ Requires-Dist: ifcfill>=0.1; extra == "examples"
32
+ Provides-Extra: pandas
33
+ Requires-Dist: pandas>=2; extra == "pandas"
34
+ Provides-Extra: sklearn
35
+ Requires-Dist: scikit-learn>=1.3; extra == "sklearn"
36
+ Provides-Extra: lightgbm
37
+ Requires-Dist: lightgbm>=4.0; extra == "lightgbm"
38
+ Provides-Extra: fast
39
+ Requires-Dist: pandas>=2; extra == "fast"
40
+ Requires-Dist: scikit-learn>=1.3; extra == "fast"
41
+ Requires-Dist: lightgbm>=4.0; extra == "fast"
42
+ Dynamic: license-file
43
+
44
+ # seqtrees
45
+
46
+ Sequential tree models for tabular synthetic data generation.
47
+
48
+ `seqtrees` is a small open source Python library for generating synthetic tabular
49
+ data with a sequential tree model. Its API follows familiar estimator naming
50
+ conventions:
51
+
52
+ ```python
53
+ from seqtrees import SequentialTreeSynthesizer
54
+
55
+ data = [
56
+ {"age": 24.5, "sex_code": 0, "income_bin": 1, "risk_code": 0},
57
+ {"age": 31.2, "sex_code": 1, "income_bin": 1, "risk_code": 0},
58
+ {"age": 67.4, "sex_code": 0, "income_bin": 3, "risk_code": 2},
59
+ {"age": 73.0, "sex_code": 1, "income_bin": 3, "risk_code": 2},
60
+ ]
61
+
62
+ model = SequentialTreeSynthesizer(
63
+ variable_order=["age", "sex_code", "income_bin", "risk_code"],
64
+ tree_backend="auto",
65
+ continuous_strategy="empirical",
66
+ continuous_columns=["age"],
67
+ discrete_columns=["sex_code", "income_bin", "risk_code"],
68
+ n_jobs=-1,
69
+ random_state=7,
70
+ )
71
+ model.fit(data)
72
+
73
+ synthetic = model.sample(10)
74
+ ```
75
+
76
+ The model factorizes a table into a sequence of conditional distributions:
77
+
78
+ ```text
79
+ P(X1, X2, ..., Xd) = P(X1) P(X2 | X1) ... P(Xd | X1, ..., Xd-1)
80
+ ```
81
+
82
+ The first variable is sampled from its empirical marginal distribution. Each
83
+ later variable is sampled from a conditional decision tree trained on the
84
+ previous variables in the sequence. This mirrors the sequential data synthesis
85
+ workflow shown in Figure 1 of the attached paper (`ocaa249.pdf`).
86
+
87
+ SeqTrees expects model-ready, preprocessed data with no null values. It accepts
88
+ only:
89
+
90
+ - continuous variables as floats;
91
+ - discrete variables as integer category codes, including binary 0/1 variables.
92
+
93
+ It does not encode raw categorical columns, and it is not intended for one-hot
94
+ encoded inputs. Categorical variables should be mapped before `fit`, for
95
+ example by your preprocessing library, and passed as stable integer codes or
96
+ bins such as `sex_code`, `income_bin`, and `risk_code`.
97
+
98
+ By default, all generated values are sampled from observed training values.
99
+ For continuous float columns, you can opt into within-leaf interpolation:
100
+
101
+ ```python
102
+ model = SequentialTreeSynthesizer(
103
+ continuous_strategy="interpolate",
104
+ continuous_columns=["age", "bmi"],
105
+ discrete_columns=["sex_code", "income_bin", "risk_code"],
106
+ )
107
+ ```
108
+
109
+ When type lists are supplied, `continuous_columns` and `discrete_columns` must
110
+ classify every input column exactly once.
111
+
112
+ ## Features
113
+
114
+ - `fit`, `sample`, and `fit_sample` methods.
115
+ - User-specified variable ordering with `variable_order`.
116
+ - Greedy learned ordering with `optimize_order=True`.
117
+ - Parallel fitting and order-search candidates with `n_jobs`.
118
+ - Parallel row synthesis with `sample(..., n_jobs=...)`.
119
+ - Optional LightGBM and scikit-learn backends with `tree_backend="lightgbm"`,
120
+ `tree_backend="sklearn"`, or `tree_backend="auto"`.
121
+ - Optional within-leaf interpolation for continuous float variables.
122
+ - Supports any number of preprocessed variables.
123
+ - Accepts lists of dictionaries, lists of row sequences, and pandas DataFrames
124
+ when pandas is installed.
125
+ - Does not provide encoders, imputers, scalers, or category mapping utilities.
126
+ - Pure-Python core with no mandatory runtime dependencies.
127
+ - PlantUML diagrams in `docs/diagrams`.
128
+
129
+ ## Install For Development
130
+
131
+ ```bash
132
+ python -m venv .venv
133
+ source .venv/bin/activate
134
+ python -m pip install -e ".[dev]"
135
+ ```
136
+
137
+ For faster compiled tree fitting:
138
+
139
+ ```bash
140
+ python -m pip install -e ".[fast]"
141
+ ```
142
+
143
+ For LightGBM only:
144
+
145
+ ```bash
146
+ python -m pip install -e ".[lightgbm]"
147
+ ```
148
+
149
+ To run the notebooks in `examples/`:
150
+
151
+ ```bash
152
+ python -m pip install -e ".[examples]"
153
+ jupyter lab examples
154
+ ```
155
+
156
+ Use all available cores:
157
+
158
+ ```python
159
+ model = SequentialTreeSynthesizer(tree_backend="lightgbm", n_jobs=-1)
160
+ ```
161
+
162
+ ## Documentation
163
+
164
+ Start with [docs/index.md](docs/index.md). The package includes PlantUML source
165
+ files for the training and sampling flow:
166
+
167
+ - [docs/diagrams/sequential_synthesis.puml](docs/diagrams/sequential_synthesis.puml)
168
+ - [docs/diagrams/class_overview.puml](docs/diagrams/class_overview.puml)
169
+
170
+ Build the documentation locally with MkDocs:
171
+
172
+ ```bash
173
+ python -m venv .venv
174
+ source .venv/bin/activate
175
+ python -m pip install -e ".[docs]"
176
+ mkdocs serve
177
+ ```
178
+
179
+ GitHub Pages documentation is published by `.github/workflows/docs.yml` when
180
+ changes land on `main`.
181
+
182
+ ## Release
183
+
184
+ Releases are published to PyPI by `.github/workflows/publish.yml` when a GitHub
185
+ Release is published. The workflow uses PyPI Trusted Publishing, so the PyPI
186
+ project needs a trusted publisher configured for:
187
+
188
+ - repository: `EulerLettersAI/seqtrees`
189
+ - workflow: `.github/workflows/publish.yml`
190
+ - environment: `pypi`
191
+
192
+ ## References
193
+
194
+ - The implementation is based on the sequential synthetic data workflow
195
+ described in the attached paper (`ocaa249.pdf`), especially the Figure 1
196
+ sequential data synthesis process.
197
+ - Breiman, Friedman, Olshen, and Stone. *Classification and Regression Trees*.
198
+ Wadsworth, 1984.
199
+ - Quinlan. "Induction of Decision Trees." *Machine Learning*, 1986.
@@ -0,0 +1,156 @@
1
+ # seqtrees
2
+
3
+ Sequential tree models for tabular synthetic data generation.
4
+
5
+ `seqtrees` is a small open source Python library for generating synthetic tabular
6
+ data with a sequential tree model. Its API follows familiar estimator naming
7
+ conventions:
8
+
9
+ ```python
10
+ from seqtrees import SequentialTreeSynthesizer
11
+
12
+ data = [
13
+ {"age": 24.5, "sex_code": 0, "income_bin": 1, "risk_code": 0},
14
+ {"age": 31.2, "sex_code": 1, "income_bin": 1, "risk_code": 0},
15
+ {"age": 67.4, "sex_code": 0, "income_bin": 3, "risk_code": 2},
16
+ {"age": 73.0, "sex_code": 1, "income_bin": 3, "risk_code": 2},
17
+ ]
18
+
19
+ model = SequentialTreeSynthesizer(
20
+ variable_order=["age", "sex_code", "income_bin", "risk_code"],
21
+ tree_backend="auto",
22
+ continuous_strategy="empirical",
23
+ continuous_columns=["age"],
24
+ discrete_columns=["sex_code", "income_bin", "risk_code"],
25
+ n_jobs=-1,
26
+ random_state=7,
27
+ )
28
+ model.fit(data)
29
+
30
+ synthetic = model.sample(10)
31
+ ```
32
+
33
+ The model factorizes a table into a sequence of conditional distributions:
34
+
35
+ ```text
36
+ P(X1, X2, ..., Xd) = P(X1) P(X2 | X1) ... P(Xd | X1, ..., Xd-1)
37
+ ```
38
+
39
+ The first variable is sampled from its empirical marginal distribution. Each
40
+ later variable is sampled from a conditional decision tree trained on the
41
+ previous variables in the sequence. This mirrors the sequential data synthesis
42
+ workflow shown in Figure 1 of the attached paper (`ocaa249.pdf`).
43
+
44
+ SeqTrees expects model-ready, preprocessed data with no null values. It accepts
45
+ only:
46
+
47
+ - continuous variables as floats;
48
+ - discrete variables as integer category codes, including binary 0/1 variables.
49
+
50
+ It does not encode raw categorical columns, and it is not intended for one-hot
51
+ encoded inputs. Categorical variables should be mapped before `fit`, for
52
+ example by your preprocessing library, and passed as stable integer codes or
53
+ bins such as `sex_code`, `income_bin`, and `risk_code`.
54
+
55
+ By default, all generated values are sampled from observed training values.
56
+ For continuous float columns, you can opt into within-leaf interpolation:
57
+
58
+ ```python
59
+ model = SequentialTreeSynthesizer(
60
+ continuous_strategy="interpolate",
61
+ continuous_columns=["age", "bmi"],
62
+ discrete_columns=["sex_code", "income_bin", "risk_code"],
63
+ )
64
+ ```
65
+
66
+ When type lists are supplied, `continuous_columns` and `discrete_columns` must
67
+ classify every input column exactly once.
68
+
69
+ ## Features
70
+
71
+ - `fit`, `sample`, and `fit_sample` methods.
72
+ - User-specified variable ordering with `variable_order`.
73
+ - Greedy learned ordering with `optimize_order=True`.
74
+ - Parallel fitting and order-search candidates with `n_jobs`.
75
+ - Parallel row synthesis with `sample(..., n_jobs=...)`.
76
+ - Optional LightGBM and scikit-learn backends with `tree_backend="lightgbm"`,
77
+ `tree_backend="sklearn"`, or `tree_backend="auto"`.
78
+ - Optional within-leaf interpolation for continuous float variables.
79
+ - Supports any number of preprocessed variables.
80
+ - Accepts lists of dictionaries, lists of row sequences, and pandas DataFrames
81
+ when pandas is installed.
82
+ - Does not provide encoders, imputers, scalers, or category mapping utilities.
83
+ - Pure-Python core with no mandatory runtime dependencies.
84
+ - PlantUML diagrams in `docs/diagrams`.
85
+
86
+ ## Install For Development
87
+
88
+ ```bash
89
+ python -m venv .venv
90
+ source .venv/bin/activate
91
+ python -m pip install -e ".[dev]"
92
+ ```
93
+
94
+ For faster compiled tree fitting:
95
+
96
+ ```bash
97
+ python -m pip install -e ".[fast]"
98
+ ```
99
+
100
+ For LightGBM only:
101
+
102
+ ```bash
103
+ python -m pip install -e ".[lightgbm]"
104
+ ```
105
+
106
+ To run the notebooks in `examples/`:
107
+
108
+ ```bash
109
+ python -m pip install -e ".[examples]"
110
+ jupyter lab examples
111
+ ```
112
+
113
+ Use all available cores:
114
+
115
+ ```python
116
+ model = SequentialTreeSynthesizer(tree_backend="lightgbm", n_jobs=-1)
117
+ ```
118
+
119
+ ## Documentation
120
+
121
+ Start with [docs/index.md](docs/index.md). The package includes PlantUML source
122
+ files for the training and sampling flow:
123
+
124
+ - [docs/diagrams/sequential_synthesis.puml](docs/diagrams/sequential_synthesis.puml)
125
+ - [docs/diagrams/class_overview.puml](docs/diagrams/class_overview.puml)
126
+
127
+ Build the documentation locally with MkDocs:
128
+
129
+ ```bash
130
+ python -m venv .venv
131
+ source .venv/bin/activate
132
+ python -m pip install -e ".[docs]"
133
+ mkdocs serve
134
+ ```
135
+
136
+ GitHub Pages documentation is published by `.github/workflows/docs.yml` when
137
+ changes land on `main`.
138
+
139
+ ## Release
140
+
141
+ Releases are published to PyPI by `.github/workflows/publish.yml` when a GitHub
142
+ Release is published. The workflow uses PyPI Trusted Publishing, so the PyPI
143
+ project needs a trusted publisher configured for:
144
+
145
+ - repository: `EulerLettersAI/seqtrees`
146
+ - workflow: `.github/workflows/publish.yml`
147
+ - environment: `pypi`
148
+
149
+ ## References
150
+
151
+ - The implementation is based on the sequential synthetic data workflow
152
+ described in the attached paper (`ocaa249.pdf`), especially the Figure 1
153
+ sequential data synthesis process.
154
+ - Breiman, Friedman, Olshen, and Stone. *Classification and Regression Trees*.
155
+ Wadsworth, 1984.
156
+ - Quinlan. "Induction of Decision Trees." *Machine Learning*, 1986.
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "seqtrees"
7
+ version = "0.1.0"
8
+ description = "Sequential tree models for tabular synthetic data generation"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [
13
+ { name = "SeqTrees contributors" }
14
+ ]
15
+ keywords = ["synthetic-data", "tabular-data", "decision-tree", "privacy", "sequential-model"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: Science/Research",
20
+ "License :: OSI Approved :: Apache Software License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
24
+ ]
25
+ dependencies = []
26
+
27
+ [project.optional-dependencies]
28
+ dev = ["pytest>=8"]
29
+ docs = [
30
+ "mkdocs>=1.6,<2",
31
+ "mkdocstrings[python]>=0.25,<1",
32
+ "mkdocs-bibtex>=2,<3",
33
+ "pymdown-extensions>=10,<11",
34
+ ]
35
+ examples = ["jupyterlab>=4", "pandas>=2", "ifcfill>=0.1"]
36
+ pandas = ["pandas>=2"]
37
+ sklearn = ["scikit-learn>=1.3"]
38
+ lightgbm = ["lightgbm>=4.0"]
39
+ fast = ["pandas>=2", "scikit-learn>=1.3", "lightgbm>=4.0"]
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/EulerLettersAI/seqtrees"
43
+ Documentation = "https://eulerlettersai.github.io/seqtrees/"
44
+ Issues = "https://github.com/EulerLettersAI/seqtrees/issues"
45
+
46
+ [tool.setuptools.packages.find]
47
+ where = ["src"]
48
+
49
+ [tool.pytest.ini_options]
50
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ """Sequential tree models for tabular synthetic data generation."""
2
+
3
+ from .synthesizer import SequentialTreeSynthesizer
4
+
5
+ __all__ = ["SequentialTreeSynthesizer"]
6
+ __version__ = "0.1.0"
@@ -0,0 +1,81 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from ._tree import ConditionalTree
6
+
7
+
8
+ SUPPORTED_TREE_BACKENDS = {"native", "sklearn", "lightgbm", "auto"}
9
+
10
+
11
+ def create_tree_backend(
12
+ backend: str,
13
+ *,
14
+ max_depth: int,
15
+ min_samples_leaf: int,
16
+ min_impurity_decrease: float,
17
+ max_thresholds: int,
18
+ random_state: int | None = None,
19
+ n_jobs: int | None = None,
20
+ ) -> Any:
21
+ if backend not in SUPPORTED_TREE_BACKENDS:
22
+ raise ValueError(f"tree_backend must be one of {sorted(SUPPORTED_TREE_BACKENDS)}.")
23
+
24
+ if backend == "sklearn":
25
+ from ._sklearn_tree import SklearnConditionalTree
26
+
27
+ return SklearnConditionalTree(
28
+ max_depth=max_depth,
29
+ min_samples_leaf=min_samples_leaf,
30
+ min_impurity_decrease=min_impurity_decrease,
31
+ max_thresholds=max_thresholds,
32
+ random_state=random_state,
33
+ )
34
+
35
+ if backend == "lightgbm":
36
+ from ._lightgbm_tree import LightGBMConditionalTree
37
+
38
+ return LightGBMConditionalTree(
39
+ max_depth=max_depth,
40
+ min_samples_leaf=min_samples_leaf,
41
+ min_impurity_decrease=min_impurity_decrease,
42
+ max_thresholds=max_thresholds,
43
+ random_state=random_state,
44
+ n_jobs=n_jobs,
45
+ )
46
+
47
+ if backend == "auto":
48
+ try:
49
+ from ._lightgbm_tree import LightGBMConditionalTree
50
+ import lightgbm # noqa: F401
51
+
52
+ return LightGBMConditionalTree(
53
+ max_depth=max_depth,
54
+ min_samples_leaf=min_samples_leaf,
55
+ min_impurity_decrease=min_impurity_decrease,
56
+ max_thresholds=max_thresholds,
57
+ random_state=random_state,
58
+ n_jobs=n_jobs,
59
+ )
60
+ except ImportError:
61
+ pass
62
+ try:
63
+ from ._sklearn_tree import SklearnConditionalTree
64
+ import sklearn # noqa: F401
65
+
66
+ return SklearnConditionalTree(
67
+ max_depth=max_depth,
68
+ min_samples_leaf=min_samples_leaf,
69
+ min_impurity_decrease=min_impurity_decrease,
70
+ max_thresholds=max_thresholds,
71
+ random_state=random_state,
72
+ )
73
+ except ImportError:
74
+ pass
75
+
76
+ return ConditionalTree(
77
+ max_depth=max_depth,
78
+ min_samples_leaf=min_samples_leaf,
79
+ min_impurity_decrease=min_impurity_decrease,
80
+ max_thresholds=max_thresholds,
81
+ )