yhatmodels 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.
- yhatmodels-0.1.0/.github/workflows/ci.yml +26 -0
- yhatmodels-0.1.0/.github/workflows/release.yml +28 -0
- yhatmodels-0.1.0/.gitignore +11 -0
- yhatmodels-0.1.0/CHANGELOG.md +37 -0
- yhatmodels-0.1.0/LICENSE +175 -0
- yhatmodels-0.1.0/NOTICE +8 -0
- yhatmodels-0.1.0/PKG-INFO +284 -0
- yhatmodels-0.1.0/README.md +248 -0
- yhatmodels-0.1.0/docs/assets/backtest_dark.png +0 -0
- yhatmodels-0.1.0/docs/assets/backtest_light.png +0 -0
- yhatmodels-0.1.0/docs/assets/covariates_dark.png +0 -0
- yhatmodels-0.1.0/docs/assets/covariates_light.png +0 -0
- yhatmodels-0.1.0/docs/assets/forecast_dark.png +0 -0
- yhatmodels-0.1.0/docs/assets/forecast_light.png +0 -0
- yhatmodels-0.1.0/docs/assets/results_dark.png +0 -0
- yhatmodels-0.1.0/docs/assets/results_light.png +0 -0
- yhatmodels-0.1.0/docs/assets/tables_dark.png +0 -0
- yhatmodels-0.1.0/docs/assets/tables_light.png +0 -0
- yhatmodels-0.1.0/docs/benchmarks.csv +32 -0
- yhatmodels-0.1.0/docs/make_chart.py +62 -0
- yhatmodels-0.1.0/docs/make_figures.py +160 -0
- yhatmodels-0.1.0/docs/usage.md +117 -0
- yhatmodels-0.1.0/pyproject.toml +58 -0
- yhatmodels-0.1.0/scripts/stamp_release.py +26 -0
- yhatmodels-0.1.0/src/yhatmodels/__init__.py +22 -0
- yhatmodels-0.1.0/src/yhatmodels/account.py +212 -0
- yhatmodels-0.1.0/src/yhatmodels/catalog.py +28 -0
- yhatmodels-0.1.0/src/yhatmodels/cli.py +152 -0
- yhatmodels-0.1.0/src/yhatmodels/errors.py +13 -0
- yhatmodels-0.1.0/src/yhatmodels/hub.py +124 -0
- yhatmodels-0.1.0/src/yhatmodels/licensing.py +79 -0
- yhatmodels-0.1.0/src/yhatmodels/loading.py +31 -0
- yhatmodels-0.1.0/src/yhatmodels/py.typed +0 -0
- yhatmodels-0.1.0/src/yhatmodels/registry.py +44 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/__init__.py +7 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/architectures/__init__.py +7 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/architectures/chakrats_v1.py +331 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/covariates.py +76 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/evaluate.py +360 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/forecaster.py +650 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/plotting.py +218 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/predictor.py +205 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/scaling.py +68 -0
- yhatmodels-0.1.0/src/yhatmodels/ts/tune.py +288 -0
- yhatmodels-0.1.0/tests/conftest.py +26 -0
- yhatmodels-0.1.0/tests/golden/ChakraTS-OS-10M.npz +0 -0
- yhatmodels-0.1.0/tests/golden/cases.py +38 -0
- yhatmodels-0.1.0/tests/golden/make_golden.py +26 -0
- yhatmodels-0.1.0/tests/test_account.py +170 -0
- yhatmodels-0.1.0/tests/test_cli.py +46 -0
- yhatmodels-0.1.0/tests/test_errors.py +46 -0
- yhatmodels-0.1.0/tests/test_evaluate.py +90 -0
- yhatmodels-0.1.0/tests/test_forecast.py +106 -0
- yhatmodels-0.1.0/tests/test_golden.py +33 -0
- yhatmodels-0.1.0/tests/test_inputs.py +194 -0
- yhatmodels-0.1.0/tests/test_loading.py +143 -0
- yhatmodels-0.1.0/tests/test_plotting.py +70 -0
- yhatmodels-0.1.0/tests/test_tune.py +73 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
strategy:
|
|
10
|
+
matrix:
|
|
11
|
+
python: ["3.10", "3.12", "3.13"]
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v7
|
|
14
|
+
- uses: astral-sh/setup-uv@v7
|
|
15
|
+
# CPU wheels of torch: the tests run a tiny randomly initialised model, no GPU and no download
|
|
16
|
+
- run: uv venv -p ${{ matrix.python }} && uv pip install torch --index-url https://download.pytorch.org/whl/cpu && uv pip install -e ".[dev]"
|
|
17
|
+
- run: uv run --no-sync ruff check src tests && uv run --no-sync ruff format --check src tests
|
|
18
|
+
- run: uv run --no-sync pytest -q
|
|
19
|
+
bare-install:
|
|
20
|
+
# the package as `pip install yhatmodels` gives it: no matplotlib (the plot tests skip themselves)
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v7
|
|
24
|
+
- uses: astral-sh/setup-uv@v7
|
|
25
|
+
- run: uv venv -p 3.11 && uv pip install torch --index-url https://download.pytorch.org/whl/cpu && uv pip install -e . pytest
|
|
26
|
+
- run: uv run --no-sync pytest -q
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
# Publishes to PyPI when a version tag is pushed (git tag v0.1.0 && git push origin v0.1.0). No token: PyPI trusted publishing
|
|
3
|
+
# (pending publisher: project yhatmodels, repo yhatlabs/yhatmodels, workflow release.yml, environment pypi).
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
tags: ["v*"]
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v7
|
|
12
|
+
- uses: astral-sh/setup-uv@v7
|
|
13
|
+
- name: Tag matches the package version
|
|
14
|
+
run: test "v$(grep -oP '__version__ = "\K[^"]+' src/yhatmodels/__init__.py)" = "${GITHUB_REF_NAME}"
|
|
15
|
+
- run: uv venv && uv pip install torch --index-url https://download.pytorch.org/whl/cpu && uv pip install -e ".[dev]" && uv run --no-sync pytest -q
|
|
16
|
+
- run: uv build
|
|
17
|
+
- uses: actions/upload-artifact@v7
|
|
18
|
+
with: { name: dist, path: dist/ }
|
|
19
|
+
publish:
|
|
20
|
+
needs: build
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
environment: pypi
|
|
23
|
+
permissions:
|
|
24
|
+
id-token: write
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/download-artifact@v8
|
|
27
|
+
with: { name: dist, path: dist/ }
|
|
28
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (unreleased)
|
|
4
|
+
|
|
5
|
+
- First release: `ChakraTS` for time-series forecasting with ChakraTS-OS-10M.
|
|
6
|
+
- `forecast(data, h, ...)` with the YHat Labs SDK's arguments: arrays in, arrays out (univariate, multivariate, past and
|
|
7
|
+
known covariates, categorical covariates), or a long-format pandas DataFrame in, a DataFrame out (`id_col`,
|
|
8
|
+
`time_col`, `target_col`, `known` + `future`, `past`, `freq`; columns `median`, `q10`, ...). One series can be a numpy
|
|
9
|
+
array, a torch tensor, a pandas Series or a plain list of numbers; `(N, V, T)` arrays are several multivariate series.
|
|
10
|
+
- `quantiles` (default 0.1, 0.5, 0.9; any levels in (0, 1), or "all") or `level` (central intervals in percent).
|
|
11
|
+
- Presets `fast` (the model's own patch size) and `pro` (every patch size the model reads, averaged); cross-series
|
|
12
|
+
grouping with `cross_series`.
|
|
13
|
+
- Runs on NVIDIA GPUs (bf16), Apple GPUs and CPU, picked in that order; a pass that runs out of GPU memory is retried
|
|
14
|
+
in halves, and passes are sized by rows and history length.
|
|
15
|
+
- Clear errors for bad horizons, quantile levels, empty series and covariates of the wrong length; a series with no
|
|
16
|
+
observed value is forecast uninformed, with a warning.
|
|
17
|
+
- Plots (with `yhatmodels[plot]`), as the SDK draws them: `plot_forecast()` for arrays or a forecast DataFrame (one
|
|
18
|
+
panel per series, after its history), `EvaluationResult.plot()` (each window's forecast against the actuals) and
|
|
19
|
+
`EvaluationResult.plot_calibration()`.
|
|
20
|
+
- Models: `yhatmodels.list_models()`; architectures registered per task; strict model settings (a model made for a newer
|
|
21
|
+
yhatmodels asks for an upgrade); sha256-checked and sharded weights.
|
|
22
|
+
- Model licenses: YHat Labs' models under a non-open license (ChakraTS-OS-10M) are accepted once per person with a
|
|
23
|
+
yhatlabs.com account before the first download (the browser opens and hands a token back; pasted over SSH;
|
|
24
|
+
`YHAT_MODELS_TOKEN` or an API key in CI); weights already downloaded are never checked. Other repositories under a
|
|
25
|
+
non-open license are accepted once on the machine with `yhatmodels.accept_license()`.
|
|
26
|
+
- `evaluate()`: rolling-origin backtests with the SDK's windows, metrics (mase, sql, wql, mae, rmse, coverage@w),
|
|
27
|
+
baselines (seasonal_naive, naive), skill scores, calibration and `compare=` for your own forecasts.
|
|
28
|
+
- `tune()`: fine-tuning on your own series (LoRA on every linear layer, holdout-checked against the pretrained model,
|
|
29
|
+
merged into a copy of the weights), `report`, and `save()` to a loadable folder with the license files.
|
|
30
|
+
- The `yhatmodels` command line: `forecast`, `evaluate`, `tune`, `models`, `accept-license`.
|
|
31
|
+
- pandas is a dependency (DataFrames, backtests and the command line work on a plain install); `[plot]` adds matplotlib.
|
|
32
|
+
- A list of series gives each forecast in its series' own shape: `(h, Q)` for `(T,)`, `(V, h, Q)` for `(V, T)`.
|
|
33
|
+
- DataFrames: missing timestamps filled as missing values, duplicates refused, rows after the last observed target used
|
|
34
|
+
as the future; a dated pandas Series keeps its dates.
|
|
35
|
+
- Levels off the model's grid keep the non-negative / integer guarantees; numbers with gaps are numeric covariates.
|
|
36
|
+
- Loading for every task: an architecture may serve several tasks (forecasting, tabular, anomaly); config.json may list
|
|
37
|
+
extra files; `model.info` for model lists; presets and the default preset per model in config.json.
|
yhatmodels-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
yhatmodels-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
yhatmodels
|
|
2
|
+
Copyright (c) 2026 Forum Software, Inc. (YHat Labs)
|
|
3
|
+
|
|
4
|
+
The yhatmodels source code is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
Model weights loaded by yhatmodels are not part of this repository and are released under their own licences, named in
|
|
7
|
+
each model's config.json and model card (for example, ChakraTS-OS-10M is released under the Chakra Non-Commercial
|
|
8
|
+
Model License). Using yhatmodels does not grant any rights to a model's weights.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: yhatmodels
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: YHatModels: open models from YHat Labs, run locally (time-series forecasting with ChakraTS first)
|
|
5
|
+
Project-URL: Homepage, https://yhatlabs.com
|
|
6
|
+
Project-URL: Repository, https://github.com/yhatlabs/yhatmodels
|
|
7
|
+
Author: YHat Labs
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
11
|
+
Keywords: forecasting,foundation model,probabilistic forecasting,time series
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: huggingface-hub>=0.23
|
|
25
|
+
Requires-Dist: numpy>=1.24
|
|
26
|
+
Requires-Dist: pandas>=2.0
|
|
27
|
+
Requires-Dist: safetensors>=0.4
|
|
28
|
+
Requires-Dist: torch>=2.4
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: matplotlib>=3.7; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
33
|
+
Provides-Extra: plot
|
|
34
|
+
Requires-Dist: matplotlib>=3.7; extra == 'plot'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
<h1 align="center">yhatmodels</h1>
|
|
38
|
+
|
|
39
|
+
<p align="center">Open foundation models from YHat Labs that run on your own computer.</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="#quick-start"><b>Install</b></a> ·
|
|
43
|
+
<a href="#what-you-can-do">What you can do</a> ·
|
|
44
|
+
<a href="#results">Results</a> ·
|
|
45
|
+
<a href="docs/usage.md">Usage guide</a> ·
|
|
46
|
+
<a href="https://huggingface.co/yhatlabs/ChakraTS-OS-10M">Model card</a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<picture>
|
|
51
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/forecast_dark.png">
|
|
52
|
+
<img src="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/forecast_light.png" alt="ChakraTS-OS-10M forecasting a week of hourly electricity demand on the Texas Gulf Coast, next to what happened" width="100%">
|
|
53
|
+
</picture>
|
|
54
|
+
<br>
|
|
55
|
+
<sub>A week of hourly electricity demand on the Texas Gulf Coast, forecast from two weeks of history, with no training.
|
|
56
|
+
Data: <a href="https://www.ercot.com">ERCOT</a>.</sub>
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
> Forecasting in production? Use ChakraTS, our flagship model, through the [YHat Labs API](https://yhatlabs.com).
|
|
60
|
+
|
|
61
|
+
yhatmodels is the Python library and command line to run YHat Labs' open foundation models for time-series forecasting
|
|
62
|
+
and tabular prediction. A foundation model is pretrained on synthetic and real data, so it works on your data
|
|
63
|
+
zero-shot: there is no model of your own to train, tune or maintain.
|
|
64
|
+
|
|
65
|
+
The first model is **ChakraTS-OS-10M**, for time-series forecasting. Give it the past values of any series, such as daily
|
|
66
|
+
sales, hourly electricity use or weekly sign-ups, and it predicts the next values with a range of likely outcomes around
|
|
67
|
+
each one. It can also use what you already know about the future, like planned prices or a weather forecast, and it
|
|
68
|
+
reads up to 32,768 past values of a series, nearly four years of hourly data, so long seasonal patterns are not cut off.
|
|
69
|
+
It is a drop-in alternative to ARIMA, Prophet or a model you would train yourself, and with 10.6M parameters it runs on
|
|
70
|
+
a laptop CPU in a fraction of a second.
|
|
71
|
+
|
|
72
|
+
For its size it is a frontier model: the most accurate open forecasting model under 100M parameters on fev-bench, and
|
|
73
|
+
more accurate than most open models up to 100 times its size (see [Results](#results)).
|
|
74
|
+
|
|
75
|
+
## Quick start
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install yhatmodels
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import numpy as np
|
|
83
|
+
from yhatmodels import ChakraTS
|
|
84
|
+
|
|
85
|
+
model = ChakraTS.from_pretrained("ChakraTS-OS-10M")
|
|
86
|
+
|
|
87
|
+
history = 10 + np.sin(np.arange(500) / 24 * 2 * np.pi) # any series: sales, demand, sensor readings, ...
|
|
88
|
+
q = model.forecast(history, h=48) # the next 48 steps: quantiles 0.1, 0.5 and 0.9
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The first download asks you to accept the model license once, with a free yhatlabs.com account (see
|
|
92
|
+
[License](#license)). After that the model runs entirely on your computer.
|
|
93
|
+
|
|
94
|
+
## What you can do
|
|
95
|
+
|
|
96
|
+
### Get a range, not just a number
|
|
97
|
+
|
|
98
|
+
Every forecast comes with a range of likely values, so you can plan for a bad week as well as a typical one; the shaded
|
|
99
|
+
bands in the picture at the top are 80% and 90% intervals. Ask for the intervals you need: an 80% interval should
|
|
100
|
+
contain the actual value about 80% of the time, and `evaluate` (below) checks that on your own data.
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
q = model.forecast(history, h=48, level=[80, 95]) # (48, 5): the 95% and 80% interval edges around the median
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Use what you know about the future
|
|
107
|
+
|
|
108
|
+
If you know something about the coming days, give it to the model: a weather forecast, planned prices, holidays. Name
|
|
109
|
+
those columns as `known`, and put their future values in the rows after your last observation.
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
# df: one row per hour with ds, y (solar output), sunlight and clouds;
|
|
113
|
+
# the last 48 rows hold tomorrow's weather forecast, with y empty
|
|
114
|
+
fc = model.forecast(df, h=48, known=["sunlight", "clouds"])
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
<p align="center">
|
|
118
|
+
<picture>
|
|
119
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/covariates_dark.png">
|
|
120
|
+
<img src="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/covariates_light.png" alt="Two days of solar output forecast from history alone and with sunlight and cloud cover" width="100%">
|
|
121
|
+
</picture>
|
|
122
|
+
<br>
|
|
123
|
+
<sub>Two days of solar output. From history alone, the model expects another sunny day; with sunlight and cloud cover
|
|
124
|
+
it sees the cloudy one coming. Data: <a href="https://www.kaggle.com/datasets/samanemami/renewable-energy-and-weather-conditions">Renewable Energy and Weather Conditions</a> (CC0).</sub>
|
|
125
|
+
</p>
|
|
126
|
+
|
|
127
|
+
### Forecast your tables
|
|
128
|
+
|
|
129
|
+
Most data lives in tables. Pass one row per series and timestamp, and you get a table back: one row per future step,
|
|
130
|
+
with the quantiles or intervals you ask for.
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
fc = model.forecast(df, h=7, known=["price", "promo"], level=[80, 95])
|
|
134
|
+
fc.head() # unique_id, ds, q2.5, q10, median, q90, q97.5
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
<p align="center">
|
|
138
|
+
<picture>
|
|
139
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/tables_dark.png">
|
|
140
|
+
<img src="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/tables_light.png" alt="Four regions of the Texas grid forecast three days ahead in one call" width="100%">
|
|
141
|
+
</picture>
|
|
142
|
+
<br>
|
|
143
|
+
<sub>Four regions of the Texas grid, forecast three days ahead in one call, each with its 80% interval. Data:
|
|
144
|
+
<a href="https://www.ercot.com">ERCOT</a>.</sub>
|
|
145
|
+
</p>
|
|
146
|
+
|
|
147
|
+
### Check it on your own history
|
|
148
|
+
|
|
149
|
+
Before you rely on a forecast, see how it would have done. `evaluate` goes back to a few points in each series' past,
|
|
150
|
+
forecasts from there, and scores the forecasts against what really happened, next to a simple seasonal baseline.
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
res = model.evaluate(df, h=7, windows=3)
|
|
154
|
+
res.summary # accuracy per model, and how much better than the baseline
|
|
155
|
+
res.plot() # each forecast against what happened (pip install "yhatmodels[plot]")
|
|
156
|
+
res.plot_calibration() # do 10% of actual values fall below the 10% quantile, and so on?
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
<p align="center">
|
|
160
|
+
<picture>
|
|
161
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/backtest_dark.png">
|
|
162
|
+
<img src="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/backtest_light.png" alt="A backtest of four past days and its calibration plot" width="100%">
|
|
163
|
+
</picture>
|
|
164
|
+
<br>
|
|
165
|
+
<sub>Four past days of Gulf Coast demand, each forecast from the history before it. The third was a hot day the history
|
|
166
|
+
gave no sign of, and the forecast misses it; across all four regions, the quantiles stay close to calibrated.</sub>
|
|
167
|
+
</p>
|
|
168
|
+
|
|
169
|
+
### Fine-tune on your data
|
|
170
|
+
|
|
171
|
+
If your series follow patterns of their own, such as your promotions or paydays, `tune` adapts the model to your
|
|
172
|
+
history in seconds to minutes on a CPU. The tuned model is kept only if it forecasts your held-out history better than
|
|
173
|
+
the original.
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
tuned = model.tune(df, h=7)
|
|
177
|
+
tuned.save("my-tuned/")
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### From the command line
|
|
181
|
+
|
|
182
|
+
Everything above also works on a CSV or Parquet file, straight from the terminal.
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
yhatmodels forecast sales.csv --h 7 --known price,promo --level 80,95 -o forecast.csv
|
|
186
|
+
yhatmodels evaluate sales.csv --h 7 --windows 3
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Every option is in the [usage guide](docs/usage.md).
|
|
190
|
+
|
|
191
|
+
## Results
|
|
192
|
+
|
|
193
|
+
[fev-bench](https://huggingface.co/spaces/autogluon/fev-leaderboard) scores forecasting models on 100 tasks from many
|
|
194
|
+
domains. Its skill score says how much more accurate a model is than a simple seasonal forecast; higher is better.
|
|
195
|
+
ChakraTS-OS-10M is the most accurate open model under 100M parameters, and more accurate than most open models up to
|
|
196
|
+
100 times its size.
|
|
197
|
+
|
|
198
|
+
<p align="center">
|
|
199
|
+
<picture>
|
|
200
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/results_dark.png">
|
|
201
|
+
<img src="https://raw.githubusercontent.com/yhatlabs/yhatmodels/main/docs/assets/results_light.png" alt="fev-bench skill score against model size for open forecasting models" width="100%">
|
|
202
|
+
</picture>
|
|
203
|
+
</p>
|
|
204
|
+
|
|
205
|
+
It is at its best when you give it covariates. On the 42 tasks that come with them, it keeps its accuracy, while most
|
|
206
|
+
models lose some:
|
|
207
|
+
|
|
208
|
+
| Model | Parameters | All 100 tasks | 42 tasks with covariates |
|
|
209
|
+
|---|---|---|---|
|
|
210
|
+
| **ChakraTS-OS-10M** | **10.6M** | **49.9** | **50.1** |
|
|
211
|
+
| Timestral-5M | 5.2M | 46.2 | 44.5 |
|
|
212
|
+
| TimeH2O-v1-tiny | 5.8M | 45.5 | 41.5 |
|
|
213
|
+
| Timestral-28M | 28M | 48.4 | 47.7 |
|
|
214
|
+
| Chronos-2 | 119M | 47.3 | 47.0 |
|
|
215
|
+
| t0-gamma | 256M | 49.4 | 49.3 |
|
|
216
|
+
| Simons-297M | 297M | 48.4 | 47.3 |
|
|
217
|
+
| TimesFM-3 | 331M | 49.0 | 49.0 |
|
|
218
|
+
| Toto-2.0-2.5B | 2.5B | 44.4 | 38.8 |
|
|
219
|
+
|
|
220
|
+
<sub>fev-bench skill score (%), as of November 2026, computed the way the fev-bench leaderboard does from the result
|
|
221
|
+
files in the [fev repository](https://github.com/autogluon/fev); sizes from the models' Hugging Face pages. The data
|
|
222
|
+
behind the chart and table is in [docs/benchmarks.csv](docs/benchmarks.csv).</sub>
|
|
223
|
+
|
|
224
|
+
## Ways to use ChakraTS
|
|
225
|
+
|
|
226
|
+
| | `yhatmodels` (this library) | The YHat Labs API |
|
|
227
|
+
|---|---|---|
|
|
228
|
+
| Model | ChakraTS-OS-10M, open weights | ChakraTS, our flagship model |
|
|
229
|
+
| Runs | on your computer | on our servers |
|
|
230
|
+
| For | research, evaluation, personal projects, competitions | production and commercial use |
|
|
231
|
+
| Start | `pip install yhatmodels` | `pip install yhatlabs`, or try it on [yhatlabs.com](https://yhatlabs.com) |
|
|
232
|
+
|
|
233
|
+
Both use the same argument names, so code moves from one to the other with few changes.
|
|
234
|
+
|
|
235
|
+
## Models
|
|
236
|
+
|
|
237
|
+
| Model | Task | Parameters | History read | Output | License |
|
|
238
|
+
|---|---|---|---|---|---|
|
|
239
|
+
| [ChakraTS-OS-10M](https://huggingface.co/yhatlabs/ChakraTS-OS-10M) | forecasting | 10.6M | up to 32,768 steps | quantiles at any level | [non-commercial](https://yhatlabs.com/model-license) |
|
|
240
|
+
|
|
241
|
+
## License
|
|
242
|
+
|
|
243
|
+
The `yhatmodels` code is [Apache-2.0](LICENSE). The ChakraTS-OS-10M weights are under the
|
|
244
|
+
[Chakra Non-Commercial Model License](https://yhatlabs.com/model-license): free for research, personal use, internal
|
|
245
|
+
evaluation and data science competitions. For commercial use, use the [hosted API](https://yhatlabs.com) or write to
|
|
246
|
+
[licensing@yhatlabs.com](mailto:licensing@yhatlabs.com).
|
|
247
|
+
|
|
248
|
+
The first download asks you to accept the license once, with a free yhatlabs.com account:
|
|
249
|
+
|
|
250
|
+
- **On your computer:** your browser opens; sign in or create an account, accept, and the download starts.
|
|
251
|
+
- **Over SSH:** the terminal shows a link; open it anywhere and paste back the token it shows.
|
|
252
|
+
- **In CI or scripts:** set `YHAT_MODELS_TOKEN` (copy it from [yhatlabs.com/models/license](https://yhatlabs.com/models/license)),
|
|
253
|
+
or run `yhatmodels accept-license ChakraTS-OS-10M` once in a terminal.
|
|
254
|
+
|
|
255
|
+
## Questions
|
|
256
|
+
|
|
257
|
+
**Does my data leave my computer?** No. The model runs locally. The only call to YHat Labs is the license check before
|
|
258
|
+
the first download, which sends your token and nothing else.
|
|
259
|
+
|
|
260
|
+
**Can I use it offline, or on a server?** Yes. Once downloaded, the weights stay in the Hugging Face cache and later runs
|
|
261
|
+
need no network. On machines without a browser, set `YHAT_MODELS_TOKEN`.
|
|
262
|
+
|
|
263
|
+
**Do I need a GPU?** No. It is fast on a CPU; an NVIDIA or Apple GPU helps with large batches and long histories.
|
|
264
|
+
|
|
265
|
+
**What can't it do?** It returns quantiles rather than sample paths, has no per-series attributes (static covariates),
|
|
266
|
+
and reads at most the last 32,768 steps of a history. The hosted ChakraTS adds sample paths and static covariates.
|
|
267
|
+
|
|
268
|
+
## Citation
|
|
269
|
+
|
|
270
|
+
If you use ChakraTS-OS in your work, please cite it:
|
|
271
|
+
|
|
272
|
+
```bibtex
|
|
273
|
+
@misc{yhatlabs2026chakratsos,
|
|
274
|
+
title = {{ChakraTS-OS}: open-weight time-series forecasting models},
|
|
275
|
+
author = {{YHat Labs}},
|
|
276
|
+
year = {2026},
|
|
277
|
+
howpublished = {\url{https://huggingface.co/yhatlabs/ChakraTS-OS-10M}},
|
|
278
|
+
url = {https://huggingface.co/yhatlabs/ChakraTS-OS-10M}
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Contact
|
|
283
|
+
|
|
284
|
+
[founders@yhatlabs.com](mailto:founders@yhatlabs.com) · [yhatlabs.com](https://yhatlabs.com)
|