cultivars-engine 0.0.1__py3-none-any.whl

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.
Files changed (66) hide show
  1. cultivars_engine/__about__.py +33 -0
  2. cultivars_engine/__init__.py +119 -0
  3. cultivars_engine/engine/__init__.py +5 -0
  4. cultivars_engine/engine/_core/__init__.py +78 -0
  5. cultivars_engine/engine/_core/_containers.py +548 -0
  6. cultivars_engine/engine/_core/_converters.py +353 -0
  7. cultivars_engine/engine/_core/_defaults.py +419 -0
  8. cultivars_engine/engine/_core/_estimators.py +3454 -0
  9. cultivars_engine/engine/_core/_loaders.py +55 -0
  10. cultivars_engine/engine/_core/_mappings.py +171 -0
  11. cultivars_engine/engine/_core/_matrices.py +997 -0
  12. cultivars_engine/engine/_core/_notes.py +152 -0
  13. cultivars_engine/engine/_core/_polynomials.py +324 -0
  14. cultivars_engine/engine/_core/_protocols.py +212 -0
  15. cultivars_engine/engine/_core/_recursions.py +229 -0
  16. cultivars_engine/engine/_core/_reparams.py +158 -0
  17. cultivars_engine/engine/_core/_rotations.py +229 -0
  18. cultivars_engine/engine/_core/_samplers.py +1168 -0
  19. cultivars_engine/engine/_core/_scales.py +37 -0
  20. cultivars_engine/engine/_core/_scores.py +278 -0
  21. cultivars_engine/engine/_core/_spectra.py +406 -0
  22. cultivars_engine/engine/_core/_transforms.py +438 -0
  23. cultivars_engine/engine/_core/_types.py +171 -0
  24. cultivars_engine/engine/_core/_validators.py +1511 -0
  25. cultivars_engine/engine/_core/_wavelets.py +389 -0
  26. cultivars_engine/engine/_internals/__init__.py +161 -0
  27. cultivars_engine/engine/_internals/_assessments.py +534 -0
  28. cultivars_engine/engine/_internals/_chains.py +498 -0
  29. cultivars_engine/engine/_internals/_coefficients.py +77 -0
  30. cultivars_engine/engine/_internals/_covariances.py +509 -0
  31. cultivars_engine/engine/_internals/_emitters.py +533 -0
  32. cultivars_engine/engine/_internals/_engines.py +275 -0
  33. cultivars_engine/engine/_internals/_filters.py +162 -0
  34. cultivars_engine/engine/_internals/_fits.py +1987 -0
  35. cultivars_engine/engine/_internals/_inferences.py +149 -0
  36. cultivars_engine/engine/_internals/_layouts.py +135 -0
  37. cultivars_engine/engine/_internals/_levels.py +120 -0
  38. cultivars_engine/engine/_internals/_means.py +427 -0
  39. cultivars_engine/engine/_internals/_mixins.py +1878 -0
  40. cultivars_engine/engine/_internals/_models.py +8188 -0
  41. cultivars_engine/engine/_internals/_moments.py +143 -0
  42. cultivars_engine/engine/_internals/_objectives.py +2237 -0
  43. cultivars_engine/engine/_internals/_parameters.py +647 -0
  44. cultivars_engine/engine/_internals/_posteriors.py +1465 -0
  45. cultivars_engine/engine/_internals/_predictors.py +341 -0
  46. cultivars_engine/engine/_internals/_priors.py +1058 -0
  47. cultivars_engine/engine/_internals/_results.py +2231 -0
  48. cultivars_engine/engine/_internals/_selections.py +764 -0
  49. cultivars_engine/engine/_internals/_simulators.py +646 -0
  50. cultivars_engine/engine/_internals/_smoothers.py +124 -0
  51. cultivars_engine/engine/_internals/_solutions.py +139 -0
  52. cultivars_engine/engine/_internals/_solvers.py +611 -0
  53. cultivars_engine/engine/_internals/_specifications.py +222 -0
  54. cultivars_engine/engine/_internals/_states.py +105 -0
  55. cultivars_engine/engine/_internals/_substrates.py +2450 -0
  56. cultivars_engine/engine/_internals/_systems.py +220 -0
  57. cultivars_engine/engine/_internals/_tests.py +997 -0
  58. cultivars_engine/exceptions.py +280 -0
  59. cultivars_engine/py.typed +0 -0
  60. cultivars_engine/summary.py +86 -0
  61. cultivars_engine/typing/__init__.py +133 -0
  62. cultivars_engine-0.0.1.dist-info/METADATA +34 -0
  63. cultivars_engine-0.0.1.dist-info/RECORD +66 -0
  64. cultivars_engine-0.0.1.dist-info/WHEEL +4 -0
  65. cultivars_engine-0.0.1.dist-info/licenses/AUTHORS.md +14 -0
  66. cultivars_engine-0.0.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,33 @@
1
+ # filepath: /src/cultivars/__about__.py
2
+ #
3
+ # Copyright (c) 2026 Nikhil Sunder
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.
22
+ r"""Package metadata for cultivars-engine."""
23
+
24
+ __title__ = "cultivars-engine"
25
+ __description__ = ""
26
+ __summary__ = ""
27
+ __version__ = "0.0.1"
28
+ __copyright__ = "Copyright (c) 2026 Nikhil Sunder"
29
+ __author__ = "Nikhil Sunder"
30
+ __email__ = "nsunder724@gmail.com"
31
+ __license__ = "MIT"
32
+ __repository__ = "https://github.com/nikhilxsunder/cultivars-engine"
33
+ __docs__ = "https://nikhilxsunder.github.io/cultivars-engine"
@@ -0,0 +1,119 @@
1
+ # filepath: /src/cultivars/__init__.py
2
+ #
3
+ # Copyright (c) 2026 Nikhil Sunder
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.
22
+ """Cultivars: research-grade time series econometrics, from ARIMA to state space.
23
+
24
+ The package covers the working range of applied macroeconometrics and
25
+ financial time series: univariate conditional-mean and
26
+ conditional-variance models, vector autoregressions in reduced,
27
+ structural, Bayesian, large-dimensional and nonlinear forms, the
28
+ state-space engines beneath them, the diagnostics that precede a fit
29
+ and the forecast evaluation that follows one, frequency-domain and
30
+ wavelet views of both data and fitted systems, and the Bayesian
31
+ workflow around any sampler. The workflow the layout follows runs in
32
+ the order an analysis does. Diagnose the series -- unit roots,
33
+ cointegration, breaks, seasonality, nonlinearity -- before choosing a
34
+ model; fit the model and read its result, whose summary states its own
35
+ caveats; evaluate the forecast against outcomes and against rivals;
36
+ and, where the question is one of frequency or of a hidden state, read
37
+ the same fitted object through the spectral and state-space views
38
+ rather than fitting something else.
39
+
40
+ The package has one rule that every subpackage keeps: a fitted result
41
+ is a record, not a handle. Every ``fit`` returns a frozen dataclass
42
+ carrying the estimates, the data needed to forecast or simulate from
43
+ them, and a ``summary`` whose notes say what the numbers assume; the
44
+ model object that produced it holds only the specification. That is
45
+ what lets a result be handed to any consumer that reads its surface --
46
+ a backtest, a spectral density, a structural identification, a model
47
+ comparison -- without the consumer knowing which model fitted it, and
48
+ what keeps a number from a model and a number from the data as
49
+ distinct types wherever the two could be confused.
50
+
51
+ Each subpackage is a namespace of leaf modules, and names are imported
52
+ from the leaf: ``from cultivars.univariate.box_jenkins import ARIMA``,
53
+ ``from cultivars.multivariate.reduced_form.vector_autoregression import
54
+ VAR``. Nothing below the subpackage level is re-exported here or in the
55
+ subpackage inits, so an import path names the model family, the
56
+ specification, and the class, and reads as the specification it is.
57
+
58
+ Layout. :mod:`~cultivars.univariate` holds the single-series models,
59
+ :mod:`~cultivars.multivariate` the vector models in five families
60
+ (``reduced_form``, ``structural``, ``large_dim``, ``nonlinear``,
61
+ ``regime_switching``), and :mod:`~cultivars.state_space` the
62
+ linear-Gaussian, switching and nonlinear engines both build on.
63
+ :mod:`~cultivars.diagnostics` is what to check before and after a fit,
64
+ :mod:`~cultivars.forecast` how to grade a forecast,
65
+ :mod:`~cultivars.spectral` the frequency-domain views and filters, and
66
+ :mod:`~cultivars.bayes` the priors, chain diagnostics, posterior checks,
67
+ evidence and combination that surround a sampler.
68
+ :mod:`~cultivars.typing` holds the categorical option aliases,
69
+ :mod:`~cultivars.exceptions` the error hierarchy every module raises
70
+ from, and :mod:`~cultivars.engine` exposes the private ``_core`` and
71
+ ``_internals`` layers for anyone extending the package.
72
+
73
+ Example:
74
+ Diagnose, difference, fit, and evaluate, each step from its leaf
75
+ module:
76
+
77
+ >>> import numpy as np
78
+ >>> from cultivars.diagnostics.unit_roots import adf
79
+ >>> from cultivars.univariate.box_jenkins import ARIMA
80
+ >>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
81
+ >>> from cultivars.forecast.backtest import Backtest
82
+ >>> rng = np.random.default_rng(0)
83
+ >>> level = np.cumsum(0.1 + rng.standard_normal(200))
84
+ >>> bool(adf(level).reject(alpha=0.05)), bool(adf(np.diff(level)).reject(alpha=0.05))
85
+ (False, True)
86
+ >>> arima = ARIMA(level, order=(1, 1, 0)).fit()
87
+ >>> arima.order, bool(0.0 < arima.beta[0] < 0.2)
88
+ ((1, 1, 0), True)
89
+ >>> panel = np.column_stack([np.diff(level), rng.standard_normal(199)])
90
+ >>> VAR(panel, order=1).fit().forecast(4).shape
91
+ (4, 2)
92
+ >>> Backtest(panel, lambda w: VAR(w, order=1).fit(), start=150).run().n_origins
93
+ 49
94
+ """
95
+
96
+ from __future__ import annotations
97
+
98
+ from . import (
99
+ engine,
100
+ exceptions,
101
+ summary,
102
+ typing,
103
+ )
104
+
105
+ __all__ = [
106
+ "bayes",
107
+ "data",
108
+ "diagnostics",
109
+ "engine",
110
+ "exceptions",
111
+ "experimental",
112
+ "forecast",
113
+ "multivariate",
114
+ "spectral",
115
+ "state_space",
116
+ "summary",
117
+ "typing",
118
+ "univariate",
119
+ ]
@@ -0,0 +1,5 @@
1
+ """Engine subpackage for cultivars."""
2
+
3
+ from . import _core, _internals
4
+
5
+ __all__ = ["_core", "_internals"]
@@ -0,0 +1,78 @@
1
+ # filepath: /src/cultivars/core/__init__.py
2
+ #
3
+ # Copyright (c) 2026 Nikhil Sunder
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.
22
+
23
+ """Primitive layer: constants, value objects, contracts, and pure functions.
24
+
25
+ Nothing in this subpackage knows what a model is. Every symbol here has more
26
+ than one consumer -- that is the test for belonging in ``_core`` rather than
27
+ in ``_internals``, which houses mono-consumer mechanism plumbing.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ from . import (
33
+ _containers,
34
+ _converters,
35
+ _defaults,
36
+ _estimators,
37
+ _loaders,
38
+ _mappings,
39
+ _matrices,
40
+ _notes,
41
+ _polynomials,
42
+ _protocols,
43
+ _recursions,
44
+ _reparams,
45
+ _rotations,
46
+ _samplers,
47
+ _scales,
48
+ _scores,
49
+ _spectra,
50
+ _transforms,
51
+ _types,
52
+ _validators,
53
+ _wavelets,
54
+ )
55
+
56
+ __all__ = [
57
+ "_containers",
58
+ "_converters",
59
+ "_defaults",
60
+ "_estimators",
61
+ "_loaders",
62
+ "_mappings",
63
+ "_matrices",
64
+ "_notes",
65
+ "_polynomials",
66
+ "_protocols",
67
+ "_recursions",
68
+ "_reparams",
69
+ "_rotations",
70
+ "_samplers",
71
+ "_scales",
72
+ "_scores",
73
+ "_spectra",
74
+ "_transforms",
75
+ "_types",
76
+ "_validators",
77
+ "_wavelets",
78
+ ]