vangja 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.
- vangja-0.1.0/LICENSE +21 -0
- vangja-0.1.0/PKG-INFO +93 -0
- vangja-0.1.0/README.md +80 -0
- vangja-0.1.0/pyproject.toml +30 -0
- vangja-0.1.0/setup.cfg +4 -0
- vangja-0.1.0/vangja.egg-info/PKG-INFO +93 -0
- vangja-0.1.0/vangja.egg-info/SOURCES.txt +8 -0
- vangja-0.1.0/vangja.egg-info/dependency_links.txt +1 -0
- vangja-0.1.0/vangja.egg-info/requires.txt +1 -0
- vangja-0.1.0/vangja.egg-info/top_level.txt +1 -0
vangja-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 jovan-krajevski
|
|
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.
|
vangja-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: vangja
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A time-series forecasting package with an intuitive API capable of modeling short time series with prior knowledge derived from a similar long time series.
|
|
5
|
+
Author-email: Jovan Krajevski <jovan.krajevski@gmail.com>
|
|
6
|
+
Project-URL: Repository, https://github.com/jovan-krajevski/vangja
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Requires-Python: <3.14,>=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: scikit-learn~=1.6.1
|
|
13
|
+
|
|
14
|
+
# vangja
|
|
15
|
+
|
|
16
|
+
<img src="images/logo.webp" width="35%" height="35%" align="right" />
|
|
17
|
+
|
|
18
|
+
A time-series forecasting package based on Facebook Prophet with an intuitive API capable of modeling short time-series with prior knowledge derived from a similar long time-series.
|
|
19
|
+
|
|
20
|
+
The package has been inspired by:
|
|
21
|
+
|
|
22
|
+
* [Facebook Prophet](https://facebook.github.io/prophet/docs/quick_start.html)
|
|
23
|
+
* [Facebook Prophet implementation in PyMC3](https://www.ritchievink.com/blog/2018/10/09/build-facebooks-prophet-in-pymc3-bayesian-time-series-analyis-with-generalized-additive-models/)
|
|
24
|
+
* [TimeSeers](https://github.com/MBrouns/timeseers)
|
|
25
|
+
* [Modeling short time series with prior knowledge](https://minimizeregret.com/short-time-series-prior-knowledge)
|
|
26
|
+
* [Modeling short time series with prior knowledge - PyMC](https://juanitorduz.github.io/short_time_series_pymc/)
|
|
27
|
+
|
|
28
|
+
# Installation
|
|
29
|
+
|
|
30
|
+
You need to create a conda PyMC environment before installing `vangja`. The recommended way of installing PyMC is by running:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
conda create -c conda-forge -n pymc_env python=3.12 "pymc>=5.20.1"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Install `vangja` with pip:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install vangja
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
# Usage
|
|
43
|
+
|
|
44
|
+
The data used for fitting the models is expected to be in the same format as the data used for fitting the Facebook Prophet model i.e. it should be a `pandas` dataframe, where the timestamp is stored in column `ds` and the value is stored in column `y`.
|
|
45
|
+
|
|
46
|
+
The API is heavily inspired by TimeSeers. A simple model consisting of a linear trend, a yearly seasonality and a weekly seasonality can be fitted like this:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from vangja import LinearTrend, FourierSeasonality
|
|
50
|
+
|
|
51
|
+
model = LinearTrend() + FourierSeasonality(365.25, 10) + FourierSeasonality(7, 10)
|
|
52
|
+
model.fit(data)
|
|
53
|
+
model.predict(365)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Multiplicative compositions
|
|
57
|
+
|
|
58
|
+
There are two types of multiplicative compositions that `vangja` supports. The first one supports creating models from components $g(t)$ and $s(t)$ in the form $y(t)=g(t) * (1 + s(t))$. Using `vangja`, this can be written by using the `__pow__` operator:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
model = LinearTrend() ** FourierSeasonality(365.25, 10)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The second multiplicative composition supports creating models from components $g(t)$ and $s(t)$ in the form $y(t)=g(t) * s(t)$. Using `vangja`, this can be written by using the `__mul__` operator:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
model = LinearTrend() * FourierSeasonality(365.25, 10)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Components
|
|
71
|
+
|
|
72
|
+
Currently, `vangja` supports the following components:
|
|
73
|
+
|
|
74
|
+
* `LinearTrend(n_changepoints=25, changepoint_range=0.8, slope_mean=0, slope_sd=5, intercept_mean=0, intercept_sd=5, delta_mean=0, delta_sd=0.05, allow_tune=False)`
|
|
75
|
+
* `FourierSeasonality(period, series_order, beta_mean=0, beta_sd=10, shrinkage_strength=100, allow_tune=False,tune_method="simple")`
|
|
76
|
+
* `UniformConstant(lower, upper, allow_tune=False)`
|
|
77
|
+
* `BetaConstant(lower, upper, alpha=0.5, beta=0.5, allow_tune=False)`
|
|
78
|
+
* `NormalConstant(mu=0, sd=1, allow_tune=False)`
|
|
79
|
+
|
|
80
|
+
## Model tuning
|
|
81
|
+
|
|
82
|
+
If you are given a long time-series and a "similar" short time-series, you can fit a model on the long time-series and then tune it on the short time-series. This is especially useful if you want to model a long seasonality on the short time-series, but you do not have enough data to do it (e.g. you have 3 months of data and want to model the yearly seasonality). In `vangja`, this can be written like this:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
model = LinearTrend() + FourierSeasonality(365.25, 10, allow_tune=True)
|
|
86
|
+
model.fit(long_time_series)
|
|
87
|
+
model.tune(short_time_series)
|
|
88
|
+
model.predict(365)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
# Contributing
|
|
92
|
+
|
|
93
|
+
PR's and suggestions are always welcome. Please open an issue on the issue list before submitting in order to avoid doing unnecessary work.
|
vangja-0.1.0/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# vangja
|
|
2
|
+
|
|
3
|
+
<img src="images/logo.webp" width="35%" height="35%" align="right" />
|
|
4
|
+
|
|
5
|
+
A time-series forecasting package based on Facebook Prophet with an intuitive API capable of modeling short time-series with prior knowledge derived from a similar long time-series.
|
|
6
|
+
|
|
7
|
+
The package has been inspired by:
|
|
8
|
+
|
|
9
|
+
* [Facebook Prophet](https://facebook.github.io/prophet/docs/quick_start.html)
|
|
10
|
+
* [Facebook Prophet implementation in PyMC3](https://www.ritchievink.com/blog/2018/10/09/build-facebooks-prophet-in-pymc3-bayesian-time-series-analyis-with-generalized-additive-models/)
|
|
11
|
+
* [TimeSeers](https://github.com/MBrouns/timeseers)
|
|
12
|
+
* [Modeling short time series with prior knowledge](https://minimizeregret.com/short-time-series-prior-knowledge)
|
|
13
|
+
* [Modeling short time series with prior knowledge - PyMC](https://juanitorduz.github.io/short_time_series_pymc/)
|
|
14
|
+
|
|
15
|
+
# Installation
|
|
16
|
+
|
|
17
|
+
You need to create a conda PyMC environment before installing `vangja`. The recommended way of installing PyMC is by running:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
conda create -c conda-forge -n pymc_env python=3.12 "pymc>=5.20.1"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Install `vangja` with pip:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install vangja
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
# Usage
|
|
30
|
+
|
|
31
|
+
The data used for fitting the models is expected to be in the same format as the data used for fitting the Facebook Prophet model i.e. it should be a `pandas` dataframe, where the timestamp is stored in column `ds` and the value is stored in column `y`.
|
|
32
|
+
|
|
33
|
+
The API is heavily inspired by TimeSeers. A simple model consisting of a linear trend, a yearly seasonality and a weekly seasonality can be fitted like this:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from vangja import LinearTrend, FourierSeasonality
|
|
37
|
+
|
|
38
|
+
model = LinearTrend() + FourierSeasonality(365.25, 10) + FourierSeasonality(7, 10)
|
|
39
|
+
model.fit(data)
|
|
40
|
+
model.predict(365)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Multiplicative compositions
|
|
44
|
+
|
|
45
|
+
There are two types of multiplicative compositions that `vangja` supports. The first one supports creating models from components $g(t)$ and $s(t)$ in the form $y(t)=g(t) * (1 + s(t))$. Using `vangja`, this can be written by using the `__pow__` operator:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
model = LinearTrend() ** FourierSeasonality(365.25, 10)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The second multiplicative composition supports creating models from components $g(t)$ and $s(t)$ in the form $y(t)=g(t) * s(t)$. Using `vangja`, this can be written by using the `__mul__` operator:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
model = LinearTrend() * FourierSeasonality(365.25, 10)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Components
|
|
58
|
+
|
|
59
|
+
Currently, `vangja` supports the following components:
|
|
60
|
+
|
|
61
|
+
* `LinearTrend(n_changepoints=25, changepoint_range=0.8, slope_mean=0, slope_sd=5, intercept_mean=0, intercept_sd=5, delta_mean=0, delta_sd=0.05, allow_tune=False)`
|
|
62
|
+
* `FourierSeasonality(period, series_order, beta_mean=0, beta_sd=10, shrinkage_strength=100, allow_tune=False,tune_method="simple")`
|
|
63
|
+
* `UniformConstant(lower, upper, allow_tune=False)`
|
|
64
|
+
* `BetaConstant(lower, upper, alpha=0.5, beta=0.5, allow_tune=False)`
|
|
65
|
+
* `NormalConstant(mu=0, sd=1, allow_tune=False)`
|
|
66
|
+
|
|
67
|
+
## Model tuning
|
|
68
|
+
|
|
69
|
+
If you are given a long time-series and a "similar" short time-series, you can fit a model on the long time-series and then tune it on the short time-series. This is especially useful if you want to model a long seasonality on the short time-series, but you do not have enough data to do it (e.g. you have 3 months of data and want to model the yearly seasonality). In `vangja`, this can be written like this:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
model = LinearTrend() + FourierSeasonality(365.25, 10, allow_tune=True)
|
|
73
|
+
model.fit(long_time_series)
|
|
74
|
+
model.tune(short_time_series)
|
|
75
|
+
model.predict(365)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
# Contributing
|
|
79
|
+
|
|
80
|
+
PR's and suggestions are always welcome. Please open an issue on the issue list before submitting in order to avoid doing unnecessary work.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vangja"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A time-series forecasting package with an intuitive API capable of modeling short time series with prior knowledge derived from a similar long time series."
|
|
9
|
+
authors = [{ name = "Jovan Krajevski", email = "jovan.krajevski@gmail.com" }]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"License :: OSI Approved :: MIT License",
|
|
13
|
+
]
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.12,<3.14"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"scikit-learn~=1.6.1",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.setuptools]
|
|
21
|
+
py-modules = []
|
|
22
|
+
|
|
23
|
+
[tool.pip-tools]
|
|
24
|
+
generate-hashes = true
|
|
25
|
+
# TODO(deps): Can remove this once they become defaults in next major version
|
|
26
|
+
allow-unsafe = true
|
|
27
|
+
strip-extras = true
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Repository = "https://github.com/jovan-krajevski/vangja"
|
vangja-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: vangja
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A time-series forecasting package with an intuitive API capable of modeling short time series with prior knowledge derived from a similar long time series.
|
|
5
|
+
Author-email: Jovan Krajevski <jovan.krajevski@gmail.com>
|
|
6
|
+
Project-URL: Repository, https://github.com/jovan-krajevski/vangja
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Requires-Python: <3.14,>=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: scikit-learn~=1.6.1
|
|
13
|
+
|
|
14
|
+
# vangja
|
|
15
|
+
|
|
16
|
+
<img src="images/logo.webp" width="35%" height="35%" align="right" />
|
|
17
|
+
|
|
18
|
+
A time-series forecasting package based on Facebook Prophet with an intuitive API capable of modeling short time-series with prior knowledge derived from a similar long time-series.
|
|
19
|
+
|
|
20
|
+
The package has been inspired by:
|
|
21
|
+
|
|
22
|
+
* [Facebook Prophet](https://facebook.github.io/prophet/docs/quick_start.html)
|
|
23
|
+
* [Facebook Prophet implementation in PyMC3](https://www.ritchievink.com/blog/2018/10/09/build-facebooks-prophet-in-pymc3-bayesian-time-series-analyis-with-generalized-additive-models/)
|
|
24
|
+
* [TimeSeers](https://github.com/MBrouns/timeseers)
|
|
25
|
+
* [Modeling short time series with prior knowledge](https://minimizeregret.com/short-time-series-prior-knowledge)
|
|
26
|
+
* [Modeling short time series with prior knowledge - PyMC](https://juanitorduz.github.io/short_time_series_pymc/)
|
|
27
|
+
|
|
28
|
+
# Installation
|
|
29
|
+
|
|
30
|
+
You need to create a conda PyMC environment before installing `vangja`. The recommended way of installing PyMC is by running:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
conda create -c conda-forge -n pymc_env python=3.12 "pymc>=5.20.1"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Install `vangja` with pip:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install vangja
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
# Usage
|
|
43
|
+
|
|
44
|
+
The data used for fitting the models is expected to be in the same format as the data used for fitting the Facebook Prophet model i.e. it should be a `pandas` dataframe, where the timestamp is stored in column `ds` and the value is stored in column `y`.
|
|
45
|
+
|
|
46
|
+
The API is heavily inspired by TimeSeers. A simple model consisting of a linear trend, a yearly seasonality and a weekly seasonality can be fitted like this:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from vangja import LinearTrend, FourierSeasonality
|
|
50
|
+
|
|
51
|
+
model = LinearTrend() + FourierSeasonality(365.25, 10) + FourierSeasonality(7, 10)
|
|
52
|
+
model.fit(data)
|
|
53
|
+
model.predict(365)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Multiplicative compositions
|
|
57
|
+
|
|
58
|
+
There are two types of multiplicative compositions that `vangja` supports. The first one supports creating models from components $g(t)$ and $s(t)$ in the form $y(t)=g(t) * (1 + s(t))$. Using `vangja`, this can be written by using the `__pow__` operator:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
model = LinearTrend() ** FourierSeasonality(365.25, 10)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The second multiplicative composition supports creating models from components $g(t)$ and $s(t)$ in the form $y(t)=g(t) * s(t)$. Using `vangja`, this can be written by using the `__mul__` operator:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
model = LinearTrend() * FourierSeasonality(365.25, 10)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Components
|
|
71
|
+
|
|
72
|
+
Currently, `vangja` supports the following components:
|
|
73
|
+
|
|
74
|
+
* `LinearTrend(n_changepoints=25, changepoint_range=0.8, slope_mean=0, slope_sd=5, intercept_mean=0, intercept_sd=5, delta_mean=0, delta_sd=0.05, allow_tune=False)`
|
|
75
|
+
* `FourierSeasonality(period, series_order, beta_mean=0, beta_sd=10, shrinkage_strength=100, allow_tune=False,tune_method="simple")`
|
|
76
|
+
* `UniformConstant(lower, upper, allow_tune=False)`
|
|
77
|
+
* `BetaConstant(lower, upper, alpha=0.5, beta=0.5, allow_tune=False)`
|
|
78
|
+
* `NormalConstant(mu=0, sd=1, allow_tune=False)`
|
|
79
|
+
|
|
80
|
+
## Model tuning
|
|
81
|
+
|
|
82
|
+
If you are given a long time-series and a "similar" short time-series, you can fit a model on the long time-series and then tune it on the short time-series. This is especially useful if you want to model a long seasonality on the short time-series, but you do not have enough data to do it (e.g. you have 3 months of data and want to model the yearly seasonality). In `vangja`, this can be written like this:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
model = LinearTrend() + FourierSeasonality(365.25, 10, allow_tune=True)
|
|
86
|
+
model.fit(long_time_series)
|
|
87
|
+
model.tune(short_time_series)
|
|
88
|
+
model.predict(365)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
# Contributing
|
|
92
|
+
|
|
93
|
+
PR's and suggestions are always welcome. Please open an issue on the issue list before submitting in order to avoid doing unnecessary work.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
scikit-learn~=1.6.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|