GreyTheory
Grey forecasting, feature comparison, and PCA for Python.
Documentation · Getting started · Workbench · Benchmarks
Forecast a short sequence, rank features against a target, or explore spectra and process measurements. Start with a few lines of Python, or use the bundled HTML workbench.
What you can do
- Combine Grey + PCA:
GreyPCAbrings six PCA backends together with GRA component selection. PCA summarizes sample differences; with a reference target, GRA scores and selects related components. For spectra, images, and paths, add Grey-window features before PCA to include local patterns. - Forecast: GM11 and two-level Convolution; GM0N / GM1N for ordered multivariate data.
- Compare: GRA feature ranking and mixed larger / smaller / target quality preferences.
- Explore: six PCA backends, raw-count PoissonPCA, Grey windows, images, and multidimensional paths.
Quick start
Requires Python 3.11+. Download or clone the repository, then run:
python3 run.py
Use the library
Install into the Python environment used by your own program:
python -m pip install .
from greytheory import GM11
series = [223.3, 227.3, 230.5, 238.1, 242.9, 251.1]
model = GM11(background_mode="corrected").fit(series)
print(model.predict(2))
Choose a PCA method
Set method on GreyPCA. The same choices are available in the workbench.
from greytheory.analysis import GreyPCA
features = [[1.0, 2.0, 0.8], [1.5, 2.4, 1.2],
[2.0, 3.1, 1.1], [2.5, 3.4, 1.8]]
model = GreyPCA(n_components=2, method="pca", standardize=True)
components = model.fit_transform(features)
print(components)
| Method | When to try it |
|---|---|
"pca" |
A standard linear projection; start here. |
"sparse" |
Sparse component coefficients. |
"kernel" |
Nonlinear structure through a kernel. |
"robust" |
PCP low-rank decomposition followed by PCA. |
"robust_sparse" |
Joint robust and sparse projection. |
"adv" |
Projection under a configurable perturbation model. |
For nonnegative raw counts, use the PoissonPCA adapter. Component selection, parameters, and the distinction between GRA and PCA rankings are in the usage guide. → GreyPCA
Explore with the workbench
workbench opens the GreyTheory graphical analysis interface. Load spectra, DOE data, or handwriting images, choose methods and parameters, then inspect charts and feature rankings:
python3 run.py workbench
The first launch creates .venv and installs the analysis and desktop dependencies; later launches reuse it. Analysis runs locally without a server.
You can also open the bundled HTML directly for offline previews of precomputed results. New settings require the command above or request/result JSON exchange.
HTML · Read the illustrated walkthrough
PVD demo: 15 synthetic runs. The projection shows sample differences; the ranking compares process inputs with the selected target.
All demo inputs and results are in data/demo/. Open the demo data browser to choose files and find the matching workbench actions.
More demos
Try delivery routes, driver assignment, artwork spectral differences, order forecasting, 2D–4D trajectories, spectroscopy, and semiconductor tools. The image tab also compares AI-generated or uploaded handwriting images.
Read the illustrated walkthrough · PVD CSV · CVD CSV
Documentation
| Guide | Contents |
|---|---|
| Read the illustrated walkthrough | Installation, previews, live analysis, and result files |
| GreyPCA | All six PCA backends, parameters, and component selection |
| Images / trajectories | Loading images, feature extraction, and comparison |
| Bruker | SPX / BCF support and detector calibration |
| Usage guide | Forecasting, GRA, quality scores, batch jobs, and references |
Development
python -m pip install -e . -r requirements-dev.txt
python -m pytest -q
python -m build
License
References
Core Grey and PCA papers
Core references for Grey modelling, PCA, and the implemented robust solvers. Spectral and process-analysis references are in the usage guide.
- Deng, J. L. (1982). Control problems of grey systems. Systems & Control Letters, 1(5), 288–294.
- Liu, S. & Lin, Y. (2011). Grey Systems: Theory and Applications. Springer. Grey modelling and relational analysis.
- Kayacan, E., Ulutas, B. & Kaynak, O. (2010). Grey system theory-based models in time series prediction. Expert Systems with Applications, 37(2), 1784–1789.
- Jolliffe, I. T. & Cadima, J. (2016). Principal component analysis: a review and recent developments. Philosophical Transactions A, 374, 20150202.
- Candès, E. J., Li, X., Ma, Y. & Wright, J. (2011). Robust Principal Component Analysis?. Journal of the ACM, 58(3), Article 11. Principal Component Pursuit.
- Lin, Z., Chen, M. & Ma, Y. (2010). The Augmented Lagrange Multiplier Method for Exact Recovery of Corrupted Low-Rank Matrices. Inexact ALM solver for PCP.
- Erichson, N. B. et al. (2020). Sparse Principal Component Analysis via Variable Projection, author manuscript. SIAM Journal on Applied Mathematics, 80(2), 977–1002. Robust sparse model: equation (17), Algorithm 2.
- Vävinggren, D. et al. (2026). A Robust Optimization Approach to Sparse Principal Component Analysis. AdvPCA: Algorithms 1–2 and Appendix A.3.
Metadata
Release files for greytheory 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| greytheory-2.0.3.tar.gz | 5.7 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| greytheory-2.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 MB
Release files / greytheory-2.0.3.tar.gz
| Download URL | greytheory-2.0.3.tar.gz |
|---|---|
| Size | 5.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d1bc918d7a518ab01400af4086f9e06d762fefb2ae9478332872406be9d4a35
|
|
BLAKE2b-256 checksum How to use checksums |
877f4e33e2af9460c6921727f5ca88af73c521e37c4f73ca9a4bc56daaf4214a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / greytheory-2.0.3-py3-none-any.whl
| Download URL | greytheory-2.0.3-py3-none-any.whl |
|---|---|
| Size | 62.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c4795e6ab7b9967822b27f713f00d724d5e6ed96bda48414248b923d0def691
|
|
BLAKE2b-256 checksum How to use checksums |
bd9c1fdcb7e518b6accab5090145c279db06a9107b1dac98bf1e213b48bbeb9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for greytheory 2.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for greytheory-2.0.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.