autots 0.5.5__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.
- autots-0.5.5/AutoTS.egg-info/PKG-INFO +150 -0
- autots-0.5.5/AutoTS.egg-info/SOURCES.txt +81 -0
- autots-0.5.5/AutoTS.egg-info/dependency_links.txt +1 -0
- autots-0.5.5/AutoTS.egg-info/requires.txt +21 -0
- autots-0.5.5/AutoTS.egg-info/top_level.txt +6 -0
- autots-0.5.5/LICENSE +21 -0
- autots-0.5.5/MANIFEST.in +3 -0
- autots-0.5.5/PKG-INFO +150 -0
- autots-0.5.5/README.md +132 -0
- autots-0.5.5/autots/__init__.py +56 -0
- autots-0.5.5/autots/datasets/__init__.py +30 -0
- autots-0.5.5/autots/datasets/_base.py +786 -0
- autots-0.5.5/autots/datasets/data/covid_daily.zip +0 -0
- autots-0.5.5/autots/datasets/data/eia_weekly.zip +0 -0
- autots-0.5.5/autots/datasets/data/fred_monthly.zip +0 -0
- autots-0.5.5/autots/datasets/data/fred_yearly.zip +0 -0
- autots-0.5.5/autots/datasets/data/holidays.zip +0 -0
- autots-0.5.5/autots/datasets/data/traffic_hourly.zip +0 -0
- autots-0.5.5/autots/datasets/fred.py +96 -0
- autots-0.5.5/autots/evaluator/__init__.py +3 -0
- autots-0.5.5/autots/evaluator/anomaly_detector.py +387 -0
- autots-0.5.5/autots/evaluator/auto_model.py +2696 -0
- autots-0.5.5/autots/evaluator/auto_ts.py +3024 -0
- autots-0.5.5/autots/evaluator/benchmark.py +593 -0
- autots-0.5.5/autots/evaluator/event_forecasting.py +816 -0
- autots-0.5.5/autots/evaluator/metrics.py +590 -0
- autots-0.5.5/autots/evaluator/validation.py +160 -0
- autots-0.5.5/autots/models/__init__.py +3 -0
- autots-0.5.5/autots/models/arch.py +386 -0
- autots-0.5.5/autots/models/base.py +573 -0
- autots-0.5.5/autots/models/basics.py +2769 -0
- autots-0.5.5/autots/models/cassandra.py +2631 -0
- autots-0.5.5/autots/models/dnn.py +421 -0
- autots-0.5.5/autots/models/ensemble.py +1539 -0
- autots-0.5.5/autots/models/gluonts.py +653 -0
- autots-0.5.5/autots/models/greykite.py +290 -0
- autots-0.5.5/autots/models/matrix_var.py +969 -0
- autots-0.5.5/autots/models/mlensemble.py +524 -0
- autots-0.5.5/autots/models/model_list.py +354 -0
- autots-0.5.5/autots/models/prophet.py +783 -0
- autots-0.5.5/autots/models/pytorch.py +505 -0
- autots-0.5.5/autots/models/sklearn.py +2978 -0
- autots-0.5.5/autots/models/statsmodels.py +2416 -0
- autots-0.5.5/autots/models/tfp.py +574 -0
- autots-0.5.5/autots/templates/__init__.py +3 -0
- autots-0.5.5/autots/templates/general.py +464 -0
- autots-0.5.5/autots/tools/__init__.py +4 -0
- autots-0.5.5/autots/tools/anomaly_utils.py +1095 -0
- autots-0.5.5/autots/tools/calendar.py +256 -0
- autots-0.5.5/autots/tools/cointegration.py +231 -0
- autots-0.5.5/autots/tools/cpu_count.py +57 -0
- autots-0.5.5/autots/tools/fast_kalman.py +1197 -0
- autots-0.5.5/autots/tools/hierarchial.py +154 -0
- autots-0.5.5/autots/tools/holiday.py +116 -0
- autots-0.5.5/autots/tools/impute.py +289 -0
- autots-0.5.5/autots/tools/lunar.py +174 -0
- autots-0.5.5/autots/tools/percentile.py +112 -0
- autots-0.5.5/autots/tools/probabilistic.py +201 -0
- autots-0.5.5/autots/tools/profile.py +35 -0
- autots-0.5.5/autots/tools/regressor.py +359 -0
- autots-0.5.5/autots/tools/seasonal.py +406 -0
- autots-0.5.5/autots/tools/shaping.py +442 -0
- autots-0.5.5/autots/tools/thresholding.py +486 -0
- autots-0.5.5/autots/tools/transform.py +4186 -0
- autots-0.5.5/autots/tools/window_functions.py +480 -0
- autots-0.5.5/docs/conf.py +77 -0
- autots-0.5.5/pyproject.toml +52 -0
- autots-0.5.5/setup.cfg +4 -0
- autots-0.5.5/setup.py +53 -0
- autots-0.5.5/tests/test_anomalies.py +111 -0
- autots-0.5.5/tests/test_autots.py +630 -0
- autots-0.5.5/tests/test_calendar_holiday.py +89 -0
- autots-0.5.5/tests/test_cassandra.py +259 -0
- autots-0.5.5/tests/test_event_forecasting.py +92 -0
- autots-0.5.5/tests/test_impute.py +42 -0
- autots-0.5.5/tests/test_metrics.py +112 -0
- autots-0.5.5/tests/test_percentile.py +42 -0
- autots-0.5.5/tests/test_regressor.py +52 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: autots
|
|
3
|
+
Version: 0.5.5
|
|
4
|
+
Summary: Automated Time Series Forecasting
|
|
5
|
+
Home-page: https://github.com/winedarksea/AutoTS
|
|
6
|
+
Author: Colin Catlin
|
|
7
|
+
Author-email: Colin Catlin <colin.catlin@gmail.com>
|
|
8
|
+
License: MIT License
|
|
9
|
+
Project-URL: Homepage, https://github.com/winedarksea/AutoTS
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/winedarksea/AutoTS/issues
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.6
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Provides-Extra: additional
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
|
|
19
|
+
# AutoTS
|
|
20
|
+
|
|
21
|
+
<img src="/img/autots_1280.png" width="400" height="184" title="AutoTS Logo">
|
|
22
|
+
|
|
23
|
+
AutoTS is a time series package for Python designed for rapidly deploying high-accuracy forecasts at scale.
|
|
24
|
+
|
|
25
|
+
In 2023, AutoTS has won the M6 forecasting competition, delivering the highest performance investment decisions across 12 months of stock market forecasting.
|
|
26
|
+
|
|
27
|
+
There are dozens of forecasting models usable in the `sklearn` style of `.fit()` and `.predict()`.
|
|
28
|
+
These includes naive, statistical, machine learning, and deep learning models.
|
|
29
|
+
Additionally, there are over 30 time series specific transforms usable in the `sklearn` style of `.fit()`, `.transform()` and `.inverse_transform()`.
|
|
30
|
+
All of these function directly on Pandas Dataframes, without the need for conversion to proprietary objects.
|
|
31
|
+
|
|
32
|
+
All models support forecasting multivariate (multiple time series) outputs and also support probabilistic (upper/lower bound) forecasts.
|
|
33
|
+
Most models can readily scale to tens and even hundreds of thousands of input series.
|
|
34
|
+
Many models also support passing in user-defined exogenous regressors.
|
|
35
|
+
|
|
36
|
+
These models are all designed for integration in an AutoML feature search which automatically finds the best models, preprocessing, and ensembling for a given dataset through genetic algorithms.
|
|
37
|
+
|
|
38
|
+
Horizontal and mosaic style ensembles are the flagship ensembling types, allowing each series to receive the most accurate possible models while still maintaining scalability.
|
|
39
|
+
|
|
40
|
+
A combination of metrics and cross-validation options, the ability to apply subsets and weighting, regressor generation tools, simulation forecasting mode, event risk forecasting, live datasets, template import and export, plotting, and a collection of data shaping parameters round out the available feature set.
|
|
41
|
+
|
|
42
|
+
## Table of Contents
|
|
43
|
+
* [Installation](https://github.com/winedarksea/AutoTS#installation)
|
|
44
|
+
* [Basic Use](https://github.com/winedarksea/AutoTS#basic-use)
|
|
45
|
+
* [Tips for Speed and Large Data](https://github.com/winedarksea/AutoTS#tips-for-speed-and-large-data)
|
|
46
|
+
* Extended Tutorial [GitHub](https://github.com/winedarksea/AutoTS/blob/master/extended_tutorial.md) or [Docs](https://winedarksea.github.io/AutoTS/build/html/source/tutorial.html)
|
|
47
|
+
* [Production Example](https://github.com/winedarksea/AutoTS/blob/master/production_example.py)
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
```
|
|
51
|
+
pip install autots
|
|
52
|
+
```
|
|
53
|
+
This includes dependencies for basic models, but [additonal packages](https://github.com/winedarksea/AutoTS/blob/master/extended_tutorial.md#installation-and-dependency-versioning) are required for some models and methods.
|
|
54
|
+
|
|
55
|
+
## Basic Use
|
|
56
|
+
|
|
57
|
+
Input data for AutoTS is expected to come in either a *long* or a *wide* format:
|
|
58
|
+
|
|
59
|
+
- The *wide* format is a `pandas.DataFrame` with a `pandas.DatetimeIndex` and each column a distinct series.
|
|
60
|
+
- The *long* format has three columns:
|
|
61
|
+
- Date (ideally already in pandas-recognized `datetime` format)
|
|
62
|
+
- Series ID. For a single time series, series_id can be `= None`.
|
|
63
|
+
- Value
|
|
64
|
+
- For *long* data, the column name for each of these is passed to `.fit()` as `date_col`, `id_col`, and `value_col`. No parameters are needed for *wide* data.
|
|
65
|
+
|
|
66
|
+
Lower-level functions are only designed for `wide` style data.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
# also load: _hourly, _monthly, _weekly, _yearly, or _live_daily
|
|
70
|
+
from autots import AutoTS, load_daily
|
|
71
|
+
|
|
72
|
+
# sample datasets can be used in either of the long or wide import shapes
|
|
73
|
+
long = False
|
|
74
|
+
df = load_daily(long=long)
|
|
75
|
+
|
|
76
|
+
model = AutoTS(
|
|
77
|
+
forecast_length=21,
|
|
78
|
+
frequency='infer',
|
|
79
|
+
prediction_interval=0.9,
|
|
80
|
+
ensemble=None,
|
|
81
|
+
model_list="fast", # "superfast", "default", "fast_parallel"
|
|
82
|
+
transformer_list="fast", # "superfast",
|
|
83
|
+
drop_most_recent=1,
|
|
84
|
+
max_generations=4,
|
|
85
|
+
num_validations=2,
|
|
86
|
+
validation_method="backwards"
|
|
87
|
+
)
|
|
88
|
+
model = model.fit(
|
|
89
|
+
df,
|
|
90
|
+
date_col='datetime' if long else None,
|
|
91
|
+
value_col='value' if long else None,
|
|
92
|
+
id_col='series_id' if long else None,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
prediction = model.predict()
|
|
96
|
+
# plot a sample
|
|
97
|
+
prediction.plot(model.df_wide_numeric,
|
|
98
|
+
series=model.df_wide_numeric.columns[0],
|
|
99
|
+
start_date="2019-01-01")
|
|
100
|
+
# Print the details of the best model
|
|
101
|
+
print(model)
|
|
102
|
+
|
|
103
|
+
# point forecasts dataframe
|
|
104
|
+
forecasts_df = prediction.forecast
|
|
105
|
+
# upper and lower forecasts
|
|
106
|
+
forecasts_up, forecasts_low = prediction.upper_forecast, prediction.lower_forecast
|
|
107
|
+
|
|
108
|
+
# accuracy of all tried model results
|
|
109
|
+
model_results = model.results()
|
|
110
|
+
# and aggregated from cross validation
|
|
111
|
+
validation_results = model.results("validation")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The lower-level API, in particular the large section of time series transformers in the scikit-learn style, can also be utilized independently from the AutoML framework.
|
|
115
|
+
|
|
116
|
+
Check out [extended_tutorial.md](https://winedarksea.github.io/AutoTS/build/html/source/tutorial.html) for a more detailed guide to features.
|
|
117
|
+
|
|
118
|
+
Also take a look at the [production_example.py](https://github.com/winedarksea/AutoTS/blob/master/production_example.py)
|
|
119
|
+
|
|
120
|
+
## Tips for Speed and Large Data:
|
|
121
|
+
* Use appropriate model lists, especially the predefined lists:
|
|
122
|
+
* `superfast` (simple naive models) and `fast` (more complex but still faster models, optimized for many series)
|
|
123
|
+
* `fast_parallel` (a combination of `fast` and `parallel`) or `parallel`, given many CPU cores are available
|
|
124
|
+
* `n_jobs` usually gets pretty close with `='auto'` but adjust as necessary for the environment
|
|
125
|
+
* see a dict of predefined lists (some defined for internal use) with `from autots.models.model_list import model_lists`
|
|
126
|
+
* Use the `subset` parameter when there are many similar series, `subset=100` will often generalize well for tens of thousands of similar series.
|
|
127
|
+
* if using `subset`, passing `weights` for series will weight subset selection towards higher priority series.
|
|
128
|
+
* if limited by RAM, it can be distributed by running multiple instances of AutoTS on different batches of data, having first imported a template pretrained as a starting point for all.
|
|
129
|
+
* Set `model_interrupt=True` which passes over the current model when a `KeyboardInterrupt` ie `crtl+c` is pressed (although if the interrupt falls between generations it will stop the entire training).
|
|
130
|
+
* Use the `result_file` method of `.fit()` which will save progress after each generation - helpful to save progress if a long training is being done. Use `import_results` to recover.
|
|
131
|
+
* While Transformations are pretty fast, setting `transformer_max_depth` to a lower number (say, 2) will increase speed. Also utilize `transformer_list` == 'fast' or 'superfast'.
|
|
132
|
+
* Check out [this example](https://github.com/winedarksea/AutoTS/discussions/76) of using AutoTS with pandas UDF.
|
|
133
|
+
* Ensembles are obviously slower to predict because they run many models, 'distance' models 2x slower, and 'simple' models 3x-5x slower.
|
|
134
|
+
* `ensemble='horizontal-max'` with `model_list='no_shared_fast'` can scale relatively well given many cpu cores because each model is only run on the series it is needed for.
|
|
135
|
+
* Reducing `num_validations` and `models_to_validate` will decrease runtime but may lead to poorer model selections.
|
|
136
|
+
* For datasets with many records, upsampling (for example, from daily to monthly frequency forecasts) can reduce training time if appropriate.
|
|
137
|
+
* this can be done by adjusting `frequency` and `aggfunc` but is probably best done before passing data into AutoTS.
|
|
138
|
+
* It will be faster if NaN's are already filled. If a search for optimal NaN fill method is not required, then fill any NaN with a satisfactory method before passing to class.
|
|
139
|
+
* Set `runtime_weighting` in `metric_weighting` to a higher value. This will guide the search towards faster models, although it may come at the expense of accuracy.
|
|
140
|
+
|
|
141
|
+
## How to Contribute:
|
|
142
|
+
* Give feedback on where you find the documentation confusing
|
|
143
|
+
* Use AutoTS and...
|
|
144
|
+
* Report errors and request features by adding Issues on GitHub
|
|
145
|
+
* Posting the top model templates for your data (to help improve the starting templates)
|
|
146
|
+
* Feel free to recommend different search grid parameters for your favorite models
|
|
147
|
+
* And, of course, contributing to the codebase directly on GitHub.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
*Also known as Project CATS (Catlin's Automated Time Series) hence the logo.*
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.py
|
|
6
|
+
AutoTS.egg-info/PKG-INFO
|
|
7
|
+
AutoTS.egg-info/SOURCES.txt
|
|
8
|
+
AutoTS.egg-info/dependency_links.txt
|
|
9
|
+
AutoTS.egg-info/requires.txt
|
|
10
|
+
AutoTS.egg-info/top_level.txt
|
|
11
|
+
autots/__init__.py
|
|
12
|
+
autots.egg-info/PKG-INFO
|
|
13
|
+
autots.egg-info/SOURCES.txt
|
|
14
|
+
autots.egg-info/dependency_links.txt
|
|
15
|
+
autots.egg-info/requires.txt
|
|
16
|
+
autots.egg-info/top_level.txt
|
|
17
|
+
autots/datasets/__init__.py
|
|
18
|
+
autots/datasets/_base.py
|
|
19
|
+
autots/datasets/fred.py
|
|
20
|
+
autots/datasets/data/covid_daily.zip
|
|
21
|
+
autots/datasets/data/eia_weekly.zip
|
|
22
|
+
autots/datasets/data/fred_monthly.zip
|
|
23
|
+
autots/datasets/data/fred_yearly.zip
|
|
24
|
+
autots/datasets/data/holidays.zip
|
|
25
|
+
autots/datasets/data/traffic_hourly.zip
|
|
26
|
+
autots/evaluator/__init__.py
|
|
27
|
+
autots/evaluator/anomaly_detector.py
|
|
28
|
+
autots/evaluator/auto_model.py
|
|
29
|
+
autots/evaluator/auto_ts.py
|
|
30
|
+
autots/evaluator/benchmark.py
|
|
31
|
+
autots/evaluator/event_forecasting.py
|
|
32
|
+
autots/evaluator/metrics.py
|
|
33
|
+
autots/evaluator/validation.py
|
|
34
|
+
autots/models/__init__.py
|
|
35
|
+
autots/models/arch.py
|
|
36
|
+
autots/models/base.py
|
|
37
|
+
autots/models/basics.py
|
|
38
|
+
autots/models/cassandra.py
|
|
39
|
+
autots/models/dnn.py
|
|
40
|
+
autots/models/ensemble.py
|
|
41
|
+
autots/models/gluonts.py
|
|
42
|
+
autots/models/greykite.py
|
|
43
|
+
autots/models/matrix_var.py
|
|
44
|
+
autots/models/mlensemble.py
|
|
45
|
+
autots/models/model_list.py
|
|
46
|
+
autots/models/prophet.py
|
|
47
|
+
autots/models/pytorch.py
|
|
48
|
+
autots/models/sklearn.py
|
|
49
|
+
autots/models/statsmodels.py
|
|
50
|
+
autots/models/tfp.py
|
|
51
|
+
autots/templates/__init__.py
|
|
52
|
+
autots/templates/general.py
|
|
53
|
+
autots/tools/__init__.py
|
|
54
|
+
autots/tools/anomaly_utils.py
|
|
55
|
+
autots/tools/calendar.py
|
|
56
|
+
autots/tools/cointegration.py
|
|
57
|
+
autots/tools/cpu_count.py
|
|
58
|
+
autots/tools/fast_kalman.py
|
|
59
|
+
autots/tools/hierarchial.py
|
|
60
|
+
autots/tools/holiday.py
|
|
61
|
+
autots/tools/impute.py
|
|
62
|
+
autots/tools/lunar.py
|
|
63
|
+
autots/tools/percentile.py
|
|
64
|
+
autots/tools/probabilistic.py
|
|
65
|
+
autots/tools/profile.py
|
|
66
|
+
autots/tools/regressor.py
|
|
67
|
+
autots/tools/seasonal.py
|
|
68
|
+
autots/tools/shaping.py
|
|
69
|
+
autots/tools/thresholding.py
|
|
70
|
+
autots/tools/transform.py
|
|
71
|
+
autots/tools/window_functions.py
|
|
72
|
+
docs/conf.py
|
|
73
|
+
tests/test_anomalies.py
|
|
74
|
+
tests/test_autots.py
|
|
75
|
+
tests/test_calendar_holiday.py
|
|
76
|
+
tests/test_cassandra.py
|
|
77
|
+
tests/test_event_forecasting.py
|
|
78
|
+
tests/test_impute.py
|
|
79
|
+
tests/test_metrics.py
|
|
80
|
+
tests/test_percentile.py
|
|
81
|
+
tests/test_regressor.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
numpy>=1.14.6
|
|
2
|
+
pandas>=0.25.0
|
|
3
|
+
statsmodels>=0.10.0
|
|
4
|
+
scikit-learn>=0.20.0
|
|
5
|
+
|
|
6
|
+
[additional]
|
|
7
|
+
holidays>=0.9
|
|
8
|
+
prophet>=0.4.0
|
|
9
|
+
fredapi
|
|
10
|
+
tensorflow
|
|
11
|
+
xgboost
|
|
12
|
+
lightgbm
|
|
13
|
+
joblib
|
|
14
|
+
scipy
|
|
15
|
+
arch
|
|
16
|
+
numexpr
|
|
17
|
+
bottleneck
|
|
18
|
+
yfinance
|
|
19
|
+
pytrends
|
|
20
|
+
matplotlib
|
|
21
|
+
requests
|
autots-0.5.5/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Colin Catlin
|
|
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.
|
autots-0.5.5/MANIFEST.in
ADDED
autots-0.5.5/PKG-INFO
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: autots
|
|
3
|
+
Version: 0.5.5
|
|
4
|
+
Summary: Automated Time Series Forecasting
|
|
5
|
+
Home-page: https://github.com/winedarksea/AutoTS
|
|
6
|
+
Author: Colin Catlin
|
|
7
|
+
Author-email: Colin Catlin <colin.catlin@gmail.com>
|
|
8
|
+
License: MIT License
|
|
9
|
+
Project-URL: Homepage, https://github.com/winedarksea/AutoTS
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/winedarksea/AutoTS/issues
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.6
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Provides-Extra: additional
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
|
|
19
|
+
# AutoTS
|
|
20
|
+
|
|
21
|
+
<img src="/img/autots_1280.png" width="400" height="184" title="AutoTS Logo">
|
|
22
|
+
|
|
23
|
+
AutoTS is a time series package for Python designed for rapidly deploying high-accuracy forecasts at scale.
|
|
24
|
+
|
|
25
|
+
In 2023, AutoTS has won the M6 forecasting competition, delivering the highest performance investment decisions across 12 months of stock market forecasting.
|
|
26
|
+
|
|
27
|
+
There are dozens of forecasting models usable in the `sklearn` style of `.fit()` and `.predict()`.
|
|
28
|
+
These includes naive, statistical, machine learning, and deep learning models.
|
|
29
|
+
Additionally, there are over 30 time series specific transforms usable in the `sklearn` style of `.fit()`, `.transform()` and `.inverse_transform()`.
|
|
30
|
+
All of these function directly on Pandas Dataframes, without the need for conversion to proprietary objects.
|
|
31
|
+
|
|
32
|
+
All models support forecasting multivariate (multiple time series) outputs and also support probabilistic (upper/lower bound) forecasts.
|
|
33
|
+
Most models can readily scale to tens and even hundreds of thousands of input series.
|
|
34
|
+
Many models also support passing in user-defined exogenous regressors.
|
|
35
|
+
|
|
36
|
+
These models are all designed for integration in an AutoML feature search which automatically finds the best models, preprocessing, and ensembling for a given dataset through genetic algorithms.
|
|
37
|
+
|
|
38
|
+
Horizontal and mosaic style ensembles are the flagship ensembling types, allowing each series to receive the most accurate possible models while still maintaining scalability.
|
|
39
|
+
|
|
40
|
+
A combination of metrics and cross-validation options, the ability to apply subsets and weighting, regressor generation tools, simulation forecasting mode, event risk forecasting, live datasets, template import and export, plotting, and a collection of data shaping parameters round out the available feature set.
|
|
41
|
+
|
|
42
|
+
## Table of Contents
|
|
43
|
+
* [Installation](https://github.com/winedarksea/AutoTS#installation)
|
|
44
|
+
* [Basic Use](https://github.com/winedarksea/AutoTS#basic-use)
|
|
45
|
+
* [Tips for Speed and Large Data](https://github.com/winedarksea/AutoTS#tips-for-speed-and-large-data)
|
|
46
|
+
* Extended Tutorial [GitHub](https://github.com/winedarksea/AutoTS/blob/master/extended_tutorial.md) or [Docs](https://winedarksea.github.io/AutoTS/build/html/source/tutorial.html)
|
|
47
|
+
* [Production Example](https://github.com/winedarksea/AutoTS/blob/master/production_example.py)
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
```
|
|
51
|
+
pip install autots
|
|
52
|
+
```
|
|
53
|
+
This includes dependencies for basic models, but [additonal packages](https://github.com/winedarksea/AutoTS/blob/master/extended_tutorial.md#installation-and-dependency-versioning) are required for some models and methods.
|
|
54
|
+
|
|
55
|
+
## Basic Use
|
|
56
|
+
|
|
57
|
+
Input data for AutoTS is expected to come in either a *long* or a *wide* format:
|
|
58
|
+
|
|
59
|
+
- The *wide* format is a `pandas.DataFrame` with a `pandas.DatetimeIndex` and each column a distinct series.
|
|
60
|
+
- The *long* format has three columns:
|
|
61
|
+
- Date (ideally already in pandas-recognized `datetime` format)
|
|
62
|
+
- Series ID. For a single time series, series_id can be `= None`.
|
|
63
|
+
- Value
|
|
64
|
+
- For *long* data, the column name for each of these is passed to `.fit()` as `date_col`, `id_col`, and `value_col`. No parameters are needed for *wide* data.
|
|
65
|
+
|
|
66
|
+
Lower-level functions are only designed for `wide` style data.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
# also load: _hourly, _monthly, _weekly, _yearly, or _live_daily
|
|
70
|
+
from autots import AutoTS, load_daily
|
|
71
|
+
|
|
72
|
+
# sample datasets can be used in either of the long or wide import shapes
|
|
73
|
+
long = False
|
|
74
|
+
df = load_daily(long=long)
|
|
75
|
+
|
|
76
|
+
model = AutoTS(
|
|
77
|
+
forecast_length=21,
|
|
78
|
+
frequency='infer',
|
|
79
|
+
prediction_interval=0.9,
|
|
80
|
+
ensemble=None,
|
|
81
|
+
model_list="fast", # "superfast", "default", "fast_parallel"
|
|
82
|
+
transformer_list="fast", # "superfast",
|
|
83
|
+
drop_most_recent=1,
|
|
84
|
+
max_generations=4,
|
|
85
|
+
num_validations=2,
|
|
86
|
+
validation_method="backwards"
|
|
87
|
+
)
|
|
88
|
+
model = model.fit(
|
|
89
|
+
df,
|
|
90
|
+
date_col='datetime' if long else None,
|
|
91
|
+
value_col='value' if long else None,
|
|
92
|
+
id_col='series_id' if long else None,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
prediction = model.predict()
|
|
96
|
+
# plot a sample
|
|
97
|
+
prediction.plot(model.df_wide_numeric,
|
|
98
|
+
series=model.df_wide_numeric.columns[0],
|
|
99
|
+
start_date="2019-01-01")
|
|
100
|
+
# Print the details of the best model
|
|
101
|
+
print(model)
|
|
102
|
+
|
|
103
|
+
# point forecasts dataframe
|
|
104
|
+
forecasts_df = prediction.forecast
|
|
105
|
+
# upper and lower forecasts
|
|
106
|
+
forecasts_up, forecasts_low = prediction.upper_forecast, prediction.lower_forecast
|
|
107
|
+
|
|
108
|
+
# accuracy of all tried model results
|
|
109
|
+
model_results = model.results()
|
|
110
|
+
# and aggregated from cross validation
|
|
111
|
+
validation_results = model.results("validation")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The lower-level API, in particular the large section of time series transformers in the scikit-learn style, can also be utilized independently from the AutoML framework.
|
|
115
|
+
|
|
116
|
+
Check out [extended_tutorial.md](https://winedarksea.github.io/AutoTS/build/html/source/tutorial.html) for a more detailed guide to features.
|
|
117
|
+
|
|
118
|
+
Also take a look at the [production_example.py](https://github.com/winedarksea/AutoTS/blob/master/production_example.py)
|
|
119
|
+
|
|
120
|
+
## Tips for Speed and Large Data:
|
|
121
|
+
* Use appropriate model lists, especially the predefined lists:
|
|
122
|
+
* `superfast` (simple naive models) and `fast` (more complex but still faster models, optimized for many series)
|
|
123
|
+
* `fast_parallel` (a combination of `fast` and `parallel`) or `parallel`, given many CPU cores are available
|
|
124
|
+
* `n_jobs` usually gets pretty close with `='auto'` but adjust as necessary for the environment
|
|
125
|
+
* see a dict of predefined lists (some defined for internal use) with `from autots.models.model_list import model_lists`
|
|
126
|
+
* Use the `subset` parameter when there are many similar series, `subset=100` will often generalize well for tens of thousands of similar series.
|
|
127
|
+
* if using `subset`, passing `weights` for series will weight subset selection towards higher priority series.
|
|
128
|
+
* if limited by RAM, it can be distributed by running multiple instances of AutoTS on different batches of data, having first imported a template pretrained as a starting point for all.
|
|
129
|
+
* Set `model_interrupt=True` which passes over the current model when a `KeyboardInterrupt` ie `crtl+c` is pressed (although if the interrupt falls between generations it will stop the entire training).
|
|
130
|
+
* Use the `result_file` method of `.fit()` which will save progress after each generation - helpful to save progress if a long training is being done. Use `import_results` to recover.
|
|
131
|
+
* While Transformations are pretty fast, setting `transformer_max_depth` to a lower number (say, 2) will increase speed. Also utilize `transformer_list` == 'fast' or 'superfast'.
|
|
132
|
+
* Check out [this example](https://github.com/winedarksea/AutoTS/discussions/76) of using AutoTS with pandas UDF.
|
|
133
|
+
* Ensembles are obviously slower to predict because they run many models, 'distance' models 2x slower, and 'simple' models 3x-5x slower.
|
|
134
|
+
* `ensemble='horizontal-max'` with `model_list='no_shared_fast'` can scale relatively well given many cpu cores because each model is only run on the series it is needed for.
|
|
135
|
+
* Reducing `num_validations` and `models_to_validate` will decrease runtime but may lead to poorer model selections.
|
|
136
|
+
* For datasets with many records, upsampling (for example, from daily to monthly frequency forecasts) can reduce training time if appropriate.
|
|
137
|
+
* this can be done by adjusting `frequency` and `aggfunc` but is probably best done before passing data into AutoTS.
|
|
138
|
+
* It will be faster if NaN's are already filled. If a search for optimal NaN fill method is not required, then fill any NaN with a satisfactory method before passing to class.
|
|
139
|
+
* Set `runtime_weighting` in `metric_weighting` to a higher value. This will guide the search towards faster models, although it may come at the expense of accuracy.
|
|
140
|
+
|
|
141
|
+
## How to Contribute:
|
|
142
|
+
* Give feedback on where you find the documentation confusing
|
|
143
|
+
* Use AutoTS and...
|
|
144
|
+
* Report errors and request features by adding Issues on GitHub
|
|
145
|
+
* Posting the top model templates for your data (to help improve the starting templates)
|
|
146
|
+
* Feel free to recommend different search grid parameters for your favorite models
|
|
147
|
+
* And, of course, contributing to the codebase directly on GitHub.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
*Also known as Project CATS (Catlin's Automated Time Series) hence the logo.*
|
autots-0.5.5/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# AutoTS
|
|
2
|
+
|
|
3
|
+
<img src="/img/autots_1280.png" width="400" height="184" title="AutoTS Logo">
|
|
4
|
+
|
|
5
|
+
AutoTS is a time series package for Python designed for rapidly deploying high-accuracy forecasts at scale.
|
|
6
|
+
|
|
7
|
+
In 2023, AutoTS has won the M6 forecasting competition, delivering the highest performance investment decisions across 12 months of stock market forecasting.
|
|
8
|
+
|
|
9
|
+
There are dozens of forecasting models usable in the `sklearn` style of `.fit()` and `.predict()`.
|
|
10
|
+
These includes naive, statistical, machine learning, and deep learning models.
|
|
11
|
+
Additionally, there are over 30 time series specific transforms usable in the `sklearn` style of `.fit()`, `.transform()` and `.inverse_transform()`.
|
|
12
|
+
All of these function directly on Pandas Dataframes, without the need for conversion to proprietary objects.
|
|
13
|
+
|
|
14
|
+
All models support forecasting multivariate (multiple time series) outputs and also support probabilistic (upper/lower bound) forecasts.
|
|
15
|
+
Most models can readily scale to tens and even hundreds of thousands of input series.
|
|
16
|
+
Many models also support passing in user-defined exogenous regressors.
|
|
17
|
+
|
|
18
|
+
These models are all designed for integration in an AutoML feature search which automatically finds the best models, preprocessing, and ensembling for a given dataset through genetic algorithms.
|
|
19
|
+
|
|
20
|
+
Horizontal and mosaic style ensembles are the flagship ensembling types, allowing each series to receive the most accurate possible models while still maintaining scalability.
|
|
21
|
+
|
|
22
|
+
A combination of metrics and cross-validation options, the ability to apply subsets and weighting, regressor generation tools, simulation forecasting mode, event risk forecasting, live datasets, template import and export, plotting, and a collection of data shaping parameters round out the available feature set.
|
|
23
|
+
|
|
24
|
+
## Table of Contents
|
|
25
|
+
* [Installation](https://github.com/winedarksea/AutoTS#installation)
|
|
26
|
+
* [Basic Use](https://github.com/winedarksea/AutoTS#basic-use)
|
|
27
|
+
* [Tips for Speed and Large Data](https://github.com/winedarksea/AutoTS#tips-for-speed-and-large-data)
|
|
28
|
+
* Extended Tutorial [GitHub](https://github.com/winedarksea/AutoTS/blob/master/extended_tutorial.md) or [Docs](https://winedarksea.github.io/AutoTS/build/html/source/tutorial.html)
|
|
29
|
+
* [Production Example](https://github.com/winedarksea/AutoTS/blob/master/production_example.py)
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
```
|
|
33
|
+
pip install autots
|
|
34
|
+
```
|
|
35
|
+
This includes dependencies for basic models, but [additonal packages](https://github.com/winedarksea/AutoTS/blob/master/extended_tutorial.md#installation-and-dependency-versioning) are required for some models and methods.
|
|
36
|
+
|
|
37
|
+
## Basic Use
|
|
38
|
+
|
|
39
|
+
Input data for AutoTS is expected to come in either a *long* or a *wide* format:
|
|
40
|
+
|
|
41
|
+
- The *wide* format is a `pandas.DataFrame` with a `pandas.DatetimeIndex` and each column a distinct series.
|
|
42
|
+
- The *long* format has three columns:
|
|
43
|
+
- Date (ideally already in pandas-recognized `datetime` format)
|
|
44
|
+
- Series ID. For a single time series, series_id can be `= None`.
|
|
45
|
+
- Value
|
|
46
|
+
- For *long* data, the column name for each of these is passed to `.fit()` as `date_col`, `id_col`, and `value_col`. No parameters are needed for *wide* data.
|
|
47
|
+
|
|
48
|
+
Lower-level functions are only designed for `wide` style data.
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
# also load: _hourly, _monthly, _weekly, _yearly, or _live_daily
|
|
52
|
+
from autots import AutoTS, load_daily
|
|
53
|
+
|
|
54
|
+
# sample datasets can be used in either of the long or wide import shapes
|
|
55
|
+
long = False
|
|
56
|
+
df = load_daily(long=long)
|
|
57
|
+
|
|
58
|
+
model = AutoTS(
|
|
59
|
+
forecast_length=21,
|
|
60
|
+
frequency='infer',
|
|
61
|
+
prediction_interval=0.9,
|
|
62
|
+
ensemble=None,
|
|
63
|
+
model_list="fast", # "superfast", "default", "fast_parallel"
|
|
64
|
+
transformer_list="fast", # "superfast",
|
|
65
|
+
drop_most_recent=1,
|
|
66
|
+
max_generations=4,
|
|
67
|
+
num_validations=2,
|
|
68
|
+
validation_method="backwards"
|
|
69
|
+
)
|
|
70
|
+
model = model.fit(
|
|
71
|
+
df,
|
|
72
|
+
date_col='datetime' if long else None,
|
|
73
|
+
value_col='value' if long else None,
|
|
74
|
+
id_col='series_id' if long else None,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
prediction = model.predict()
|
|
78
|
+
# plot a sample
|
|
79
|
+
prediction.plot(model.df_wide_numeric,
|
|
80
|
+
series=model.df_wide_numeric.columns[0],
|
|
81
|
+
start_date="2019-01-01")
|
|
82
|
+
# Print the details of the best model
|
|
83
|
+
print(model)
|
|
84
|
+
|
|
85
|
+
# point forecasts dataframe
|
|
86
|
+
forecasts_df = prediction.forecast
|
|
87
|
+
# upper and lower forecasts
|
|
88
|
+
forecasts_up, forecasts_low = prediction.upper_forecast, prediction.lower_forecast
|
|
89
|
+
|
|
90
|
+
# accuracy of all tried model results
|
|
91
|
+
model_results = model.results()
|
|
92
|
+
# and aggregated from cross validation
|
|
93
|
+
validation_results = model.results("validation")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The lower-level API, in particular the large section of time series transformers in the scikit-learn style, can also be utilized independently from the AutoML framework.
|
|
97
|
+
|
|
98
|
+
Check out [extended_tutorial.md](https://winedarksea.github.io/AutoTS/build/html/source/tutorial.html) for a more detailed guide to features.
|
|
99
|
+
|
|
100
|
+
Also take a look at the [production_example.py](https://github.com/winedarksea/AutoTS/blob/master/production_example.py)
|
|
101
|
+
|
|
102
|
+
## Tips for Speed and Large Data:
|
|
103
|
+
* Use appropriate model lists, especially the predefined lists:
|
|
104
|
+
* `superfast` (simple naive models) and `fast` (more complex but still faster models, optimized for many series)
|
|
105
|
+
* `fast_parallel` (a combination of `fast` and `parallel`) or `parallel`, given many CPU cores are available
|
|
106
|
+
* `n_jobs` usually gets pretty close with `='auto'` but adjust as necessary for the environment
|
|
107
|
+
* see a dict of predefined lists (some defined for internal use) with `from autots.models.model_list import model_lists`
|
|
108
|
+
* Use the `subset` parameter when there are many similar series, `subset=100` will often generalize well for tens of thousands of similar series.
|
|
109
|
+
* if using `subset`, passing `weights` for series will weight subset selection towards higher priority series.
|
|
110
|
+
* if limited by RAM, it can be distributed by running multiple instances of AutoTS on different batches of data, having first imported a template pretrained as a starting point for all.
|
|
111
|
+
* Set `model_interrupt=True` which passes over the current model when a `KeyboardInterrupt` ie `crtl+c` is pressed (although if the interrupt falls between generations it will stop the entire training).
|
|
112
|
+
* Use the `result_file` method of `.fit()` which will save progress after each generation - helpful to save progress if a long training is being done. Use `import_results` to recover.
|
|
113
|
+
* While Transformations are pretty fast, setting `transformer_max_depth` to a lower number (say, 2) will increase speed. Also utilize `transformer_list` == 'fast' or 'superfast'.
|
|
114
|
+
* Check out [this example](https://github.com/winedarksea/AutoTS/discussions/76) of using AutoTS with pandas UDF.
|
|
115
|
+
* Ensembles are obviously slower to predict because they run many models, 'distance' models 2x slower, and 'simple' models 3x-5x slower.
|
|
116
|
+
* `ensemble='horizontal-max'` with `model_list='no_shared_fast'` can scale relatively well given many cpu cores because each model is only run on the series it is needed for.
|
|
117
|
+
* Reducing `num_validations` and `models_to_validate` will decrease runtime but may lead to poorer model selections.
|
|
118
|
+
* For datasets with many records, upsampling (for example, from daily to monthly frequency forecasts) can reduce training time if appropriate.
|
|
119
|
+
* this can be done by adjusting `frequency` and `aggfunc` but is probably best done before passing data into AutoTS.
|
|
120
|
+
* It will be faster if NaN's are already filled. If a search for optimal NaN fill method is not required, then fill any NaN with a satisfactory method before passing to class.
|
|
121
|
+
* Set `runtime_weighting` in `metric_weighting` to a higher value. This will guide the search towards faster models, although it may come at the expense of accuracy.
|
|
122
|
+
|
|
123
|
+
## How to Contribute:
|
|
124
|
+
* Give feedback on where you find the documentation confusing
|
|
125
|
+
* Use AutoTS and...
|
|
126
|
+
* Report errors and request features by adding Issues on GitHub
|
|
127
|
+
* Posting the top model templates for your data (to help improve the starting templates)
|
|
128
|
+
* Feel free to recommend different search grid parameters for your favorite models
|
|
129
|
+
* And, of course, contributing to the codebase directly on GitHub.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
*Also known as Project CATS (Catlin's Automated Time Series) hence the logo.*
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Automated Time Series Model Selection for Python
|
|
3
|
+
|
|
4
|
+
https://github.com/winedarksea/AutoTS
|
|
5
|
+
"""
|
|
6
|
+
from autots.datasets import (
|
|
7
|
+
load_hourly,
|
|
8
|
+
load_daily,
|
|
9
|
+
load_monthly,
|
|
10
|
+
load_yearly,
|
|
11
|
+
load_weekly,
|
|
12
|
+
load_weekdays,
|
|
13
|
+
load_live_daily,
|
|
14
|
+
load_linear,
|
|
15
|
+
load_artificial,
|
|
16
|
+
load_sine,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
from autots.evaluator.auto_ts import AutoTS
|
|
20
|
+
from autots.evaluator.event_forecasting import EventRiskForecast
|
|
21
|
+
from autots.tools.transform import GeneralTransformer, RandomTransform
|
|
22
|
+
from autots.tools.shaping import long_to_wide
|
|
23
|
+
from autots.tools.regressor import create_lagged_regressor, create_regressor
|
|
24
|
+
from autots.evaluator.auto_model import model_forecast
|
|
25
|
+
from autots.evaluator.anomaly_detector import AnomalyDetector, HolidayDetector
|
|
26
|
+
from autots.models.cassandra import Cassandra
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__version__ = '0.5.5'
|
|
30
|
+
|
|
31
|
+
TransformTS = GeneralTransformer
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
'load_daily',
|
|
35
|
+
'load_monthly',
|
|
36
|
+
'load_yearly',
|
|
37
|
+
'load_hourly',
|
|
38
|
+
'load_weekly',
|
|
39
|
+
'load_weekdays',
|
|
40
|
+
'load_live_daily',
|
|
41
|
+
'load_linear',
|
|
42
|
+
'load_artificial',
|
|
43
|
+
'load_sine',
|
|
44
|
+
'AutoTS',
|
|
45
|
+
'TransformTS',
|
|
46
|
+
'GeneralTransformer',
|
|
47
|
+
'RandomTransform',
|
|
48
|
+
'long_to_wide',
|
|
49
|
+
'model_forecast',
|
|
50
|
+
'create_lagged_regressor',
|
|
51
|
+
'create_regressor',
|
|
52
|
+
'EventRiskForecast',
|
|
53
|
+
'AnomalyDetector',
|
|
54
|
+
'HolidayDetector',
|
|
55
|
+
'Cassandra',
|
|
56
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tools for Importing Sample Data
|
|
3
|
+
"""
|
|
4
|
+
from autots.datasets._base import (
|
|
5
|
+
load_daily,
|
|
6
|
+
load_live_daily,
|
|
7
|
+
load_monthly,
|
|
8
|
+
load_yearly,
|
|
9
|
+
load_hourly,
|
|
10
|
+
load_weekly,
|
|
11
|
+
load_weekdays,
|
|
12
|
+
load_zeroes,
|
|
13
|
+
load_linear,
|
|
14
|
+
load_sine,
|
|
15
|
+
load_artificial,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
'load_daily',
|
|
20
|
+
'load_monthly',
|
|
21
|
+
'load_yearly',
|
|
22
|
+
'load_hourly',
|
|
23
|
+
'load_weekly',
|
|
24
|
+
'load_weekdays',
|
|
25
|
+
'load_live_daily',
|
|
26
|
+
'load_zeroes',
|
|
27
|
+
'load_linear',
|
|
28
|
+
'load_sine',
|
|
29
|
+
'load_artificial',
|
|
30
|
+
]
|