industrialstats 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.
- industrialstats-0.1.0/LICENSE +21 -0
- industrialstats-0.1.0/PKG-INFO +268 -0
- industrialstats-0.1.0/README.md +228 -0
- industrialstats-0.1.0/pyproject.toml +82 -0
- industrialstats-0.1.0/src/industrialstats/__init__.py +39 -0
- industrialstats-0.1.0/src/industrialstats/analysis/README.md +113 -0
- industrialstats-0.1.0/src/industrialstats/analysis/__init__.py +15 -0
- industrialstats-0.1.0/src/industrialstats/analysis/anova.py +719 -0
- industrialstats-0.1.0/src/industrialstats/analysis/diagnostics.py +468 -0
- industrialstats-0.1.0/src/industrialstats/analysis/effects.py +756 -0
- industrialstats-0.1.0/src/industrialstats/analysis/model_fitting.py +1083 -0
- industrialstats-0.1.0/src/industrialstats/analysis/power_analysis.py +927 -0
- industrialstats-0.1.0/src/industrialstats/cli.py +412 -0
- industrialstats-0.1.0/src/industrialstats/config.py +98 -0
- industrialstats-0.1.0/src/industrialstats/datasets/README.md +24 -0
- industrialstats-0.1.0/src/industrialstats/datasets/__init__.py +5 -0
- industrialstats-0.1.0/src/industrialstats/datasets/sample_data.py +25 -0
- industrialstats-0.1.0/src/industrialstats/designs/README.md +99 -0
- industrialstats-0.1.0/src/industrialstats/designs/__init__.py +20 -0
- industrialstats-0.1.0/src/industrialstats/designs/advanced.py +278 -0
- industrialstats-0.1.0/src/industrialstats/designs/base.py +745 -0
- industrialstats-0.1.0/src/industrialstats/designs/crd.py +294 -0
- industrialstats-0.1.0/src/industrialstats/designs/factorial.py +573 -0
- industrialstats-0.1.0/src/industrialstats/designs/fractional_factorial.py +605 -0
- industrialstats-0.1.0/src/industrialstats/designs/optimal.py +699 -0
- industrialstats-0.1.0/src/industrialstats/designs/rcbd.py +181 -0
- industrialstats-0.1.0/src/industrialstats/designs/response_surface.py +1303 -0
- industrialstats-0.1.0/src/industrialstats/designs/screening.py +233 -0
- industrialstats-0.1.0/src/industrialstats/utils/README.md +80 -0
- industrialstats-0.1.0/src/industrialstats/utils/__init__.py +39 -0
- industrialstats-0.1.0/src/industrialstats/utils/data_generation.py +802 -0
- industrialstats-0.1.0/src/industrialstats/utils/efficiency.py +259 -0
- industrialstats-0.1.0/src/industrialstats/utils/export.py +98 -0
- industrialstats-0.1.0/src/industrialstats/utils/io.py +35 -0
- industrialstats-0.1.0/src/industrialstats/utils/performance.py +35 -0
- industrialstats-0.1.0/src/industrialstats/utils/transforms.py +67 -0
- industrialstats-0.1.0/src/industrialstats/utils/validation.py +177 -0
- industrialstats-0.1.0/src/industrialstats/visualizations/README.md +93 -0
- industrialstats-0.1.0/src/industrialstats/visualizations/__init__.py +6 -0
- industrialstats-0.1.0/src/industrialstats/visualizations/plots.py +838 -0
- industrialstats-0.1.0/src/industrialstats/visualizations/response_surface_plots.py +198 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Diogo Ribeiro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: industrialstats
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Industrial statistics and design of experiments for Python
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: design of experiments,industrial statistics,DOE,ANOVA,factorial design,response surface methodology
|
|
8
|
+
Author: Diogo Ribeiro
|
|
9
|
+
Author-email: diogo.debastos.ribeiro@gmail.com
|
|
10
|
+
Maintainer: Diogo Ribeiro
|
|
11
|
+
Maintainer-email: dfr@esmad.ipp.pt
|
|
12
|
+
Requires-Python: >=3.11,<3.15
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Manufacturing
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
26
|
+
Requires-Dist: DataExcept (>=1.3.0,<2.0.0)
|
|
27
|
+
Requires-Dist: matplotlib (>=3.10,<4.0)
|
|
28
|
+
Requires-Dist: numpy (>=2.3,<3.0)
|
|
29
|
+
Requires-Dist: openpyxl (>=3.1,<4.0)
|
|
30
|
+
Requires-Dist: pandas (>=2.3,<3.0)
|
|
31
|
+
Requires-Dist: plotly (>=6.3,<7.0)
|
|
32
|
+
Requires-Dist: scikit-learn (>=1.5,<1.9)
|
|
33
|
+
Requires-Dist: scipy (>=1.16,<2.0)
|
|
34
|
+
Requires-Dist: seaborn (>=0.13,<0.14)
|
|
35
|
+
Requires-Dist: statsmodels (>=0.14,<0.15)
|
|
36
|
+
Project-URL: Homepage, https://github.com/DiogoRibeiro7/industrialstats
|
|
37
|
+
Project-URL: Repository, https://github.com/DiogoRibeiro7/industrialstats
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# industrialstats
|
|
41
|
+
|
|
42
|
+
**Industrial statistics and design of experiments for Python.**
|
|
43
|
+
|
|
44
|
+
`industrialstats` provides reproducible experimental-design generators, statistical analysis tools, diagnostics, power calculations, optimization methods, and visualizations for manufacturing, engineering, research, and other designed experiments.
|
|
45
|
+
|
|
46
|
+
The project is currently pre-1.0. Its development priority is statistical correctness and validation against established DOE references before expanding the catalogue of design families.
|
|
47
|
+
|
|
48
|
+
## Project principles
|
|
49
|
+
|
|
50
|
+
- **Statistical correctness first**: implementations should be validated against textbook results, trusted reference software, or independently derived properties.
|
|
51
|
+
- **Reproducible experiments**: randomization must be seedable and design matrices must remain inspectable.
|
|
52
|
+
- **Transparent methods**: prefer explicit statistical calculations and documented assumptions over opaque abstractions.
|
|
53
|
+
- **Clear design semantics**: terms such as effect, block, alias, resolution, whole plot, and optimality criterion must have precise DOE meanings.
|
|
54
|
+
- **Structured operational failures**: DataExcept is the standard exception layer for data-loading, file-export, and other operational boundaries, with further schema and transformation coverage planned.
|
|
55
|
+
- **No false completeness**: partially implemented or statistically provisional methods are labelled as such.
|
|
56
|
+
|
|
57
|
+
## Current capabilities
|
|
58
|
+
|
|
59
|
+
### Experimental designs
|
|
60
|
+
|
|
61
|
+
| Design family | Status | Current capability |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| Full factorial | Implemented | Two-level, three-level, and mixed-level designs; replication; centre points; randomization; basic blocking; foldover and star-point augmentation |
|
|
64
|
+
| Fractional factorial | Implemented | Regular two-level fractions; generator parsing; automatic minimum-aberration generators; defining relations; resolution; alias chains; foldover options |
|
|
65
|
+
| Completely randomized design | Implemented | Treatment randomization, replication, multiple responses, sample-size calculation, summary statistics, and data-collection sheets |
|
|
66
|
+
| Randomized complete block design | Implemented | Within-block randomization, efficiency comparison, missing-plot inspection, and a Latin-square option |
|
|
67
|
+
| Plackett-Burman | Implemented with limited catalogue | Hadamard-based screening designs, reproducible randomization, and foldover |
|
|
68
|
+
| Definitive screening design | Experimental | Public API exists, but the construction is scheduled for statistical correction and stronger property-based validation |
|
|
69
|
+
| Response surface methodology | Implemented | Central composite and Box-Behnken designs, quadratic response-surface analysis, steepest ascent, ridge analysis, canonical analysis, and multiple-response optimization |
|
|
70
|
+
| Optimal designs | Implemented | Coordinate-exchange search with D-, A-, G-, and I-optimal criteria |
|
|
71
|
+
| Split-plot | Basic implementation | Restricted randomization and whole-plot/subplot layout generation; dedicated error-stratum analysis remains to be completed |
|
|
72
|
+
| Mixture | Basic implementation | Simplex-lattice designs, constraints, randomization, and three-component simplex plotting |
|
|
73
|
+
|
|
74
|
+
### Analysis
|
|
75
|
+
|
|
76
|
+
`industrialstats` currently includes:
|
|
77
|
+
|
|
78
|
+
- ANOVA with Type I, II, and III sums of squares;
|
|
79
|
+
- effect-size calculations;
|
|
80
|
+
- multiple comparisons and planned expansion of correction methods;
|
|
81
|
+
- contrasts;
|
|
82
|
+
- mixed-effects modelling;
|
|
83
|
+
- factorial main-effect and interaction analysis;
|
|
84
|
+
- residual, leverage, influence, and assumption diagnostics;
|
|
85
|
+
- power and sample-size calculations;
|
|
86
|
+
- stepwise and hierarchical model-fitting utilities;
|
|
87
|
+
- response-surface optimization;
|
|
88
|
+
- design-efficiency and prediction-variance utilities.
|
|
89
|
+
|
|
90
|
+
### Visualization
|
|
91
|
+
|
|
92
|
+
The visualization layer includes design-space plots, effects plots, diagnostic plots, response-surface plots, contour views, prediction-variance views, and related plotting helpers.
|
|
93
|
+
|
|
94
|
+
### Validation
|
|
95
|
+
|
|
96
|
+
The repository already contains statistical-validation tests in addition to ordinary unit tests. Examples include comparisons with `statsmodels`, hand-computed factorial effects, Monte Carlo effect recovery, and fractional-factorial alias checks against the R `FrF2` catalogue.
|
|
97
|
+
|
|
98
|
+
The long-term standard is stronger: every major design family should have algebraic property tests and at least one independent reference implementation or published example.
|
|
99
|
+
|
|
100
|
+
## Current correctness priorities
|
|
101
|
+
|
|
102
|
+
Before adding many new DOE families, the package is being hardened around several known issues:
|
|
103
|
+
|
|
104
|
+
1. replace the provisional definitive-screening construction with a genuine DSD algorithm and tests of its defining properties;
|
|
105
|
+
2. replace index-based factorial blocking with deliberate block generators and explicit confounding rules;
|
|
106
|
+
3. unify factorial-effect semantics around one canonical contrast-based implementation;
|
|
107
|
+
4. generalize factorial degrees of freedom and interaction generation beyond three-way terms;
|
|
108
|
+
5. correct split-plot replication semantics and add whole-plot/subplot error-stratum analysis;
|
|
109
|
+
6. expand Plackett-Burman coverage and document the supported run catalogue;
|
|
110
|
+
7. strengthen optimal-design and mixture-design validation.
|
|
111
|
+
|
|
112
|
+
See [`ROADMAP.md`](ROADMAP.md) for the full development sequence.
|
|
113
|
+
|
|
114
|
+
## DataExcept integration
|
|
115
|
+
|
|
116
|
+
`industrialstats` uses [DataExcept](https://github.com/DiogoRibeiro7/DataExcept) as its structured exception layer at data and operational boundaries.
|
|
117
|
+
|
|
118
|
+
The current boundary layer covers external CSV loading and shared CSV, Excel, and JSON export failures. The intended policy is:
|
|
119
|
+
|
|
120
|
+
- use DataExcept for file loading, tabular schema, missing columns, dtype mismatches, data transformations, import/export, and wrapped lower-level operational failures;
|
|
121
|
+
- preserve the original exception as context when wrapping an external failure;
|
|
122
|
+
- use specific exception types rather than a generic package-wide catch-all;
|
|
123
|
+
- do **not** mechanically replace every `ValueError` or numerical exception: mathematical precondition failures should remain explicit unless a DataExcept type gives genuinely better semantics.
|
|
124
|
+
|
|
125
|
+
DataExcept `^1.3.0` is a runtime dependency. Broader schema and transformation integration remains planned work.
|
|
126
|
+
|
|
127
|
+
## Installation
|
|
128
|
+
|
|
129
|
+
Install a released version from PyPI:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
python -m pip install industrialstats
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The supported Python range is 3.11 through 3.14.
|
|
136
|
+
|
|
137
|
+
For development from source:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
git clone https://github.com/DiogoRibeiro7/industrialstats.git
|
|
141
|
+
cd industrialstats
|
|
142
|
+
python -m pip install -e . pytest hypothesis pre-commit
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Core dependencies include NumPy, pandas, SciPy, statsmodels, scikit-learn, Matplotlib, seaborn, Plotly, openpyxl, and DataExcept.
|
|
146
|
+
|
|
147
|
+
## Quick start
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from industrialstats.designs.base import Factor
|
|
151
|
+
from industrialstats.designs.factorial import FactorialDesign
|
|
152
|
+
|
|
153
|
+
factors = [
|
|
154
|
+
Factor("temperature", [180, 220], factor_type="continuous"),
|
|
155
|
+
Factor("pressure", [10, 20], factor_type="continuous"),
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
design = FactorialDesign(
|
|
159
|
+
factors=factors,
|
|
160
|
+
replicates=2,
|
|
161
|
+
randomize=True,
|
|
162
|
+
seed=42,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
matrix = design.generate_design()
|
|
166
|
+
print(matrix)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
For a regular fractional factorial:
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from industrialstats.designs.base import Factor
|
|
173
|
+
from industrialstats.designs.fractional_factorial import FractionalFactorialDesign
|
|
174
|
+
|
|
175
|
+
factors = [Factor(name, [-1, 1]) for name in "ABCDEFG"]
|
|
176
|
+
|
|
177
|
+
design = FractionalFactorialDesign(
|
|
178
|
+
factors,
|
|
179
|
+
fraction="1/8",
|
|
180
|
+
randomize=False,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
matrix = design.generate_design()
|
|
184
|
+
print(design.resolution_analysis())
|
|
185
|
+
print(design.alias_structure()["A"])
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
For response-surface methodology:
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from industrialstats.designs.base import Factor
|
|
192
|
+
from industrialstats.designs.response_surface import ResponseSurfaceDesign
|
|
193
|
+
|
|
194
|
+
factors = [
|
|
195
|
+
Factor("temperature", [180, 220], factor_type="continuous"),
|
|
196
|
+
Factor("pressure", [10, 20], factor_type="continuous"),
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
design = ResponseSurfaceDesign(
|
|
200
|
+
factors,
|
|
201
|
+
design_type="CCD",
|
|
202
|
+
center_points=4,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
matrix = design.generate_design()
|
|
206
|
+
print(matrix)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Command-line interface
|
|
210
|
+
|
|
211
|
+
`industrialstats` exposes a command-line interface for selected analysis workflows.
|
|
212
|
+
|
|
213
|
+
### Power analysis
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
industrialstats power --analysis t-test --effect-size 0.5 --power 0.8
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Stepwise model fitting
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
printf 'y,A,B\n1,0,0\n2,0,1\n3,1,0\n4,1,1\n' > model.csv
|
|
223
|
+
industrialstats model --data model.csv --response y --entry-threshold 0.01 --removal-threshold 0.2
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Examples
|
|
227
|
+
|
|
228
|
+
The repository contains executable examples for:
|
|
229
|
+
|
|
230
|
+
- manufacturing optimization;
|
|
231
|
+
- pharmaceutical development;
|
|
232
|
+
- fractional-factorial analysis;
|
|
233
|
+
- response-surface optimization;
|
|
234
|
+
- simulation studies;
|
|
235
|
+
- advanced end-to-end DOE workflows.
|
|
236
|
+
|
|
237
|
+
Jupyter notebooks cover introductory DOE, response-surface optimization, and model diagnostics.
|
|
238
|
+
|
|
239
|
+
## Development
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
git clone https://github.com/DiogoRibeiro7/industrialstats.git
|
|
243
|
+
cd industrialstats
|
|
244
|
+
python -m pip install -e . pytest hypothesis pre-commit
|
|
245
|
+
pre-commit install
|
|
246
|
+
pytest
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
When implementing or changing a statistical method, add tests that verify mathematical properties or compare against an independent reference. Passing shape and run-count tests alone is not sufficient for statistical algorithms.
|
|
250
|
+
|
|
251
|
+
## Releases
|
|
252
|
+
|
|
253
|
+
Release preparation and the PyPI/Zenodo publication workflow are documented in [`RELEASE.md`](RELEASE.md). GitHub Releases are the canonical release event for both destinations.
|
|
254
|
+
|
|
255
|
+
## Package status
|
|
256
|
+
|
|
257
|
+
Current package version: `0.1.0`.
|
|
258
|
+
|
|
259
|
+
The public API is still evolving. Design and analysis objects that are not exported from `industrialstats` directly can currently be imported from their submodules. API cleanup is part of the pre-1.0 roadmap.
|
|
260
|
+
|
|
261
|
+
## Citation
|
|
262
|
+
|
|
263
|
+
Citation metadata is provided in [`CITATION.cff`](CITATION.cff). The real Zenodo DOI is minted from the first archived GitHub Release; placeholder DOIs are intentionally not stored in the citation metadata.
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
Licensed under the MIT License. See [`LICENSE`](LICENSE) for details.
|
|
268
|
+
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# industrialstats
|
|
2
|
+
|
|
3
|
+
**Industrial statistics and design of experiments for Python.**
|
|
4
|
+
|
|
5
|
+
`industrialstats` provides reproducible experimental-design generators, statistical analysis tools, diagnostics, power calculations, optimization methods, and visualizations for manufacturing, engineering, research, and other designed experiments.
|
|
6
|
+
|
|
7
|
+
The project is currently pre-1.0. Its development priority is statistical correctness and validation against established DOE references before expanding the catalogue of design families.
|
|
8
|
+
|
|
9
|
+
## Project principles
|
|
10
|
+
|
|
11
|
+
- **Statistical correctness first**: implementations should be validated against textbook results, trusted reference software, or independently derived properties.
|
|
12
|
+
- **Reproducible experiments**: randomization must be seedable and design matrices must remain inspectable.
|
|
13
|
+
- **Transparent methods**: prefer explicit statistical calculations and documented assumptions over opaque abstractions.
|
|
14
|
+
- **Clear design semantics**: terms such as effect, block, alias, resolution, whole plot, and optimality criterion must have precise DOE meanings.
|
|
15
|
+
- **Structured operational failures**: DataExcept is the standard exception layer for data-loading, file-export, and other operational boundaries, with further schema and transformation coverage planned.
|
|
16
|
+
- **No false completeness**: partially implemented or statistically provisional methods are labelled as such.
|
|
17
|
+
|
|
18
|
+
## Current capabilities
|
|
19
|
+
|
|
20
|
+
### Experimental designs
|
|
21
|
+
|
|
22
|
+
| Design family | Status | Current capability |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| Full factorial | Implemented | Two-level, three-level, and mixed-level designs; replication; centre points; randomization; basic blocking; foldover and star-point augmentation |
|
|
25
|
+
| Fractional factorial | Implemented | Regular two-level fractions; generator parsing; automatic minimum-aberration generators; defining relations; resolution; alias chains; foldover options |
|
|
26
|
+
| Completely randomized design | Implemented | Treatment randomization, replication, multiple responses, sample-size calculation, summary statistics, and data-collection sheets |
|
|
27
|
+
| Randomized complete block design | Implemented | Within-block randomization, efficiency comparison, missing-plot inspection, and a Latin-square option |
|
|
28
|
+
| Plackett-Burman | Implemented with limited catalogue | Hadamard-based screening designs, reproducible randomization, and foldover |
|
|
29
|
+
| Definitive screening design | Experimental | Public API exists, but the construction is scheduled for statistical correction and stronger property-based validation |
|
|
30
|
+
| Response surface methodology | Implemented | Central composite and Box-Behnken designs, quadratic response-surface analysis, steepest ascent, ridge analysis, canonical analysis, and multiple-response optimization |
|
|
31
|
+
| Optimal designs | Implemented | Coordinate-exchange search with D-, A-, G-, and I-optimal criteria |
|
|
32
|
+
| Split-plot | Basic implementation | Restricted randomization and whole-plot/subplot layout generation; dedicated error-stratum analysis remains to be completed |
|
|
33
|
+
| Mixture | Basic implementation | Simplex-lattice designs, constraints, randomization, and three-component simplex plotting |
|
|
34
|
+
|
|
35
|
+
### Analysis
|
|
36
|
+
|
|
37
|
+
`industrialstats` currently includes:
|
|
38
|
+
|
|
39
|
+
- ANOVA with Type I, II, and III sums of squares;
|
|
40
|
+
- effect-size calculations;
|
|
41
|
+
- multiple comparisons and planned expansion of correction methods;
|
|
42
|
+
- contrasts;
|
|
43
|
+
- mixed-effects modelling;
|
|
44
|
+
- factorial main-effect and interaction analysis;
|
|
45
|
+
- residual, leverage, influence, and assumption diagnostics;
|
|
46
|
+
- power and sample-size calculations;
|
|
47
|
+
- stepwise and hierarchical model-fitting utilities;
|
|
48
|
+
- response-surface optimization;
|
|
49
|
+
- design-efficiency and prediction-variance utilities.
|
|
50
|
+
|
|
51
|
+
### Visualization
|
|
52
|
+
|
|
53
|
+
The visualization layer includes design-space plots, effects plots, diagnostic plots, response-surface plots, contour views, prediction-variance views, and related plotting helpers.
|
|
54
|
+
|
|
55
|
+
### Validation
|
|
56
|
+
|
|
57
|
+
The repository already contains statistical-validation tests in addition to ordinary unit tests. Examples include comparisons with `statsmodels`, hand-computed factorial effects, Monte Carlo effect recovery, and fractional-factorial alias checks against the R `FrF2` catalogue.
|
|
58
|
+
|
|
59
|
+
The long-term standard is stronger: every major design family should have algebraic property tests and at least one independent reference implementation or published example.
|
|
60
|
+
|
|
61
|
+
## Current correctness priorities
|
|
62
|
+
|
|
63
|
+
Before adding many new DOE families, the package is being hardened around several known issues:
|
|
64
|
+
|
|
65
|
+
1. replace the provisional definitive-screening construction with a genuine DSD algorithm and tests of its defining properties;
|
|
66
|
+
2. replace index-based factorial blocking with deliberate block generators and explicit confounding rules;
|
|
67
|
+
3. unify factorial-effect semantics around one canonical contrast-based implementation;
|
|
68
|
+
4. generalize factorial degrees of freedom and interaction generation beyond three-way terms;
|
|
69
|
+
5. correct split-plot replication semantics and add whole-plot/subplot error-stratum analysis;
|
|
70
|
+
6. expand Plackett-Burman coverage and document the supported run catalogue;
|
|
71
|
+
7. strengthen optimal-design and mixture-design validation.
|
|
72
|
+
|
|
73
|
+
See [`ROADMAP.md`](ROADMAP.md) for the full development sequence.
|
|
74
|
+
|
|
75
|
+
## DataExcept integration
|
|
76
|
+
|
|
77
|
+
`industrialstats` uses [DataExcept](https://github.com/DiogoRibeiro7/DataExcept) as its structured exception layer at data and operational boundaries.
|
|
78
|
+
|
|
79
|
+
The current boundary layer covers external CSV loading and shared CSV, Excel, and JSON export failures. The intended policy is:
|
|
80
|
+
|
|
81
|
+
- use DataExcept for file loading, tabular schema, missing columns, dtype mismatches, data transformations, import/export, and wrapped lower-level operational failures;
|
|
82
|
+
- preserve the original exception as context when wrapping an external failure;
|
|
83
|
+
- use specific exception types rather than a generic package-wide catch-all;
|
|
84
|
+
- do **not** mechanically replace every `ValueError` or numerical exception: mathematical precondition failures should remain explicit unless a DataExcept type gives genuinely better semantics.
|
|
85
|
+
|
|
86
|
+
DataExcept `^1.3.0` is a runtime dependency. Broader schema and transformation integration remains planned work.
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
Install a released version from PyPI:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
python -m pip install industrialstats
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The supported Python range is 3.11 through 3.14.
|
|
97
|
+
|
|
98
|
+
For development from source:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git clone https://github.com/DiogoRibeiro7/industrialstats.git
|
|
102
|
+
cd industrialstats
|
|
103
|
+
python -m pip install -e . pytest hypothesis pre-commit
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Core dependencies include NumPy, pandas, SciPy, statsmodels, scikit-learn, Matplotlib, seaborn, Plotly, openpyxl, and DataExcept.
|
|
107
|
+
|
|
108
|
+
## Quick start
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from industrialstats.designs.base import Factor
|
|
112
|
+
from industrialstats.designs.factorial import FactorialDesign
|
|
113
|
+
|
|
114
|
+
factors = [
|
|
115
|
+
Factor("temperature", [180, 220], factor_type="continuous"),
|
|
116
|
+
Factor("pressure", [10, 20], factor_type="continuous"),
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
design = FactorialDesign(
|
|
120
|
+
factors=factors,
|
|
121
|
+
replicates=2,
|
|
122
|
+
randomize=True,
|
|
123
|
+
seed=42,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
matrix = design.generate_design()
|
|
127
|
+
print(matrix)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
For a regular fractional factorial:
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from industrialstats.designs.base import Factor
|
|
134
|
+
from industrialstats.designs.fractional_factorial import FractionalFactorialDesign
|
|
135
|
+
|
|
136
|
+
factors = [Factor(name, [-1, 1]) for name in "ABCDEFG"]
|
|
137
|
+
|
|
138
|
+
design = FractionalFactorialDesign(
|
|
139
|
+
factors,
|
|
140
|
+
fraction="1/8",
|
|
141
|
+
randomize=False,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
matrix = design.generate_design()
|
|
145
|
+
print(design.resolution_analysis())
|
|
146
|
+
print(design.alias_structure()["A"])
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
For response-surface methodology:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from industrialstats.designs.base import Factor
|
|
153
|
+
from industrialstats.designs.response_surface import ResponseSurfaceDesign
|
|
154
|
+
|
|
155
|
+
factors = [
|
|
156
|
+
Factor("temperature", [180, 220], factor_type="continuous"),
|
|
157
|
+
Factor("pressure", [10, 20], factor_type="continuous"),
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
design = ResponseSurfaceDesign(
|
|
161
|
+
factors,
|
|
162
|
+
design_type="CCD",
|
|
163
|
+
center_points=4,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
matrix = design.generate_design()
|
|
167
|
+
print(matrix)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Command-line interface
|
|
171
|
+
|
|
172
|
+
`industrialstats` exposes a command-line interface for selected analysis workflows.
|
|
173
|
+
|
|
174
|
+
### Power analysis
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
industrialstats power --analysis t-test --effect-size 0.5 --power 0.8
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Stepwise model fitting
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
printf 'y,A,B\n1,0,0\n2,0,1\n3,1,0\n4,1,1\n' > model.csv
|
|
184
|
+
industrialstats model --data model.csv --response y --entry-threshold 0.01 --removal-threshold 0.2
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Examples
|
|
188
|
+
|
|
189
|
+
The repository contains executable examples for:
|
|
190
|
+
|
|
191
|
+
- manufacturing optimization;
|
|
192
|
+
- pharmaceutical development;
|
|
193
|
+
- fractional-factorial analysis;
|
|
194
|
+
- response-surface optimization;
|
|
195
|
+
- simulation studies;
|
|
196
|
+
- advanced end-to-end DOE workflows.
|
|
197
|
+
|
|
198
|
+
Jupyter notebooks cover introductory DOE, response-surface optimization, and model diagnostics.
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
git clone https://github.com/DiogoRibeiro7/industrialstats.git
|
|
204
|
+
cd industrialstats
|
|
205
|
+
python -m pip install -e . pytest hypothesis pre-commit
|
|
206
|
+
pre-commit install
|
|
207
|
+
pytest
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
When implementing or changing a statistical method, add tests that verify mathematical properties or compare against an independent reference. Passing shape and run-count tests alone is not sufficient for statistical algorithms.
|
|
211
|
+
|
|
212
|
+
## Releases
|
|
213
|
+
|
|
214
|
+
Release preparation and the PyPI/Zenodo publication workflow are documented in [`RELEASE.md`](RELEASE.md). GitHub Releases are the canonical release event for both destinations.
|
|
215
|
+
|
|
216
|
+
## Package status
|
|
217
|
+
|
|
218
|
+
Current package version: `0.1.0`.
|
|
219
|
+
|
|
220
|
+
The public API is still evolving. Design and analysis objects that are not exported from `industrialstats` directly can currently be imported from their submodules. API cleanup is part of the pre-1.0 roadmap.
|
|
221
|
+
|
|
222
|
+
## Citation
|
|
223
|
+
|
|
224
|
+
Citation metadata is provided in [`CITATION.cff`](CITATION.cff). The real Zenodo DOI is minted from the first archived GitHub Release; placeholder DOIs are intentionally not stored in the citation metadata.
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
Licensed under the MIT License. See [`LICENSE`](LICENSE) for details.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "industrialstats"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Industrial statistics and design of experiments for Python"
|
|
5
|
+
authors = ["Diogo Ribeiro <diogo.debastos.ribeiro@gmail.com>"]
|
|
6
|
+
maintainers = ["Diogo Ribeiro <dfr@esmad.ipp.pt>"]
|
|
7
|
+
license = "MIT"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
packages = [{ include = "industrialstats", from = "src" }]
|
|
10
|
+
homepage = "https://github.com/DiogoRibeiro7/industrialstats"
|
|
11
|
+
repository = "https://github.com/DiogoRibeiro7/industrialstats"
|
|
12
|
+
keywords = [
|
|
13
|
+
"design of experiments",
|
|
14
|
+
"industrial statistics",
|
|
15
|
+
"DOE",
|
|
16
|
+
"ANOVA",
|
|
17
|
+
"factorial design",
|
|
18
|
+
"response surface methodology",
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 3 - Alpha",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Intended Audience :: Manufacturing",
|
|
24
|
+
"Intended Audience :: Science/Research",
|
|
25
|
+
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Programming Language :: Python :: 3.14",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[tool.poetry.dependencies]
|
|
37
|
+
python = ">=3.11,<3.15"
|
|
38
|
+
numpy = "^2.3"
|
|
39
|
+
pandas = "^2.3"
|
|
40
|
+
scipy = "^1.16"
|
|
41
|
+
matplotlib = "^3.10"
|
|
42
|
+
seaborn = "^0.13"
|
|
43
|
+
statsmodels = "^0.14"
|
|
44
|
+
scikit-learn = ">=1.5,<1.9"
|
|
45
|
+
openpyxl = "^3.1"
|
|
46
|
+
plotly = "^6.3"
|
|
47
|
+
DataExcept = "^1.3.0"
|
|
48
|
+
|
|
49
|
+
[tool.poetry.group.dev.dependencies]
|
|
50
|
+
pytest = "^8.0.0"
|
|
51
|
+
hypothesis = "^6.99"
|
|
52
|
+
black = "^25.9"
|
|
53
|
+
isort = "^7.0"
|
|
54
|
+
flake8 = "^7.0"
|
|
55
|
+
mypy = "^1.9"
|
|
56
|
+
pre-commit = "^4.3"
|
|
57
|
+
|
|
58
|
+
[tool.poetry.scripts]
|
|
59
|
+
industrialstats = "industrialstats.cli:main"
|
|
60
|
+
|
|
61
|
+
[build-system]
|
|
62
|
+
requires = ["poetry-core"]
|
|
63
|
+
build-backend = "poetry.core.masonry.api"
|
|
64
|
+
|
|
65
|
+
[tool.black]
|
|
66
|
+
line-length = 88
|
|
67
|
+
target-version = ['py311']
|
|
68
|
+
|
|
69
|
+
[tool.isort]
|
|
70
|
+
profile = "black"
|
|
71
|
+
line_length = 88
|
|
72
|
+
|
|
73
|
+
[tool.flake8]
|
|
74
|
+
max-line-length = 88
|
|
75
|
+
extend-ignore = ["E203", "W503", "E501", "F401", "E402", "F841"]
|
|
76
|
+
|
|
77
|
+
[tool.mypy]
|
|
78
|
+
python_version = "3.11"
|
|
79
|
+
ignore_missing_imports = true
|
|
80
|
+
show_error_codes = true
|
|
81
|
+
pretty = true
|
|
82
|
+
ignore_errors = true
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""industrialstats package."""
|
|
2
|
+
|
|
3
|
+
from .config import config, load_config
|
|
4
|
+
from .datasets.sample_data import load_manufacturing
|
|
5
|
+
from .designs.factorial import FactorialDesign
|
|
6
|
+
from .designs.fractional_factorial import FractionalFactorialDesign
|
|
7
|
+
from .designs.rcbd import RandomizedCompleteBlockDesign
|
|
8
|
+
from .designs.screening import DefinitiveScreeningDesign, PlackettBurmanDesign
|
|
9
|
+
from .utils.data_generation import DataSimulator
|
|
10
|
+
from .utils.export import export_to_csv, export_to_excel, export_to_json
|
|
11
|
+
from .utils.transforms import center, log_transform, standardize
|
|
12
|
+
from .utils.validation import DesignValidator
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"__version__",
|
|
16
|
+
"PlackettBurmanDesign",
|
|
17
|
+
"FactorialDesign",
|
|
18
|
+
"RandomizedCompleteBlockDesign",
|
|
19
|
+
"FractionalFactorialDesign",
|
|
20
|
+
"DefinitiveScreeningDesign",
|
|
21
|
+
"DataSimulator",
|
|
22
|
+
"DesignValidator",
|
|
23
|
+
"config",
|
|
24
|
+
"load_config",
|
|
25
|
+
"export_to_csv",
|
|
26
|
+
"export_to_excel",
|
|
27
|
+
"export_to_json",
|
|
28
|
+
"center",
|
|
29
|
+
"standardize",
|
|
30
|
+
"log_transform",
|
|
31
|
+
"load_manufacturing",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
__version__ = "0.1.0" # x-release-please-version
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_version() -> str:
|
|
38
|
+
"""Return the current package version."""
|
|
39
|
+
return __version__
|