-
Notifications
You must be signed in to change notification settings - Fork 303
docs for forecasting task #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
51aa88f
6a969f1
2145b68
2b8f6d1
3db6626
12ba700
be290e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,9 @@ Copyright (C) 2021 [AutoML Groups Freiburg and Hannover](http://www.automl.org/ | |
|
|
||
| While early AutoML frameworks focused on optimizing traditional ML pipelines and their hyperparameters, another trend in AutoML is to focus on neural architecture search. To bring the best of these two worlds together, we developed **Auto-PyTorch**, which jointly and robustly optimizes the network architecture and the training hyperparameters to enable fully automated deep learning (AutoDL). | ||
|
|
||
| Auto-PyTorch is mainly developed to support tabular data (classification, regression). | ||
| Auto-PyTorch is mainly developed to support tabular data (classification, regression) and time series data (forecasting). | ||
| The newest features in Auto-PyTorch for tabular data are described in the paper ["Auto-PyTorch Tabular: Multi-Fidelity MetaLearning for Efficient and Robust AutoDL"](https://arxiv.org/abs/2006.13799) (see below for bibtex ref). | ||
| Details about Auto-PyTorch for multi-horizontal time series forecasting tasks can be found in the paper ["Efficient Automated Deep Learning for Time Series Forecasting"](https://arxiv.org/abs/2205.05511) (also see below for bibtex ref). | ||
|
|
||
| Also, find the documentation [here](https://automl.github.io/Auto-PyTorch/master). | ||
|
|
||
|
|
@@ -27,7 +28,9 @@ In other words, we evaluate the portfolio on a provided data as initial configur | |
| Then API starts the following procedures: | ||
| 1. **Validate input data**: Process each data type, e.g. encoding categorical data, so that Auto-Pytorch can handled. | ||
| 2. **Create dataset**: Create a dataset that can be handled in this API with a choice of cross validation or holdout splits. | ||
| 3. **Evaluate baselines** *1: Train each algorithm in the predefined pool with a fixed hyperparameter configuration and dummy model from `sklearn.dummy` that represents the worst possible performance. | ||
| 3. **Evaluate baselines** | ||
| * ***Tabular dataset*** *1: Train each algorithm in the predefined pool with a fixed hyperparameter configuration and dummy model from `sklearn.dummy` that represents the worst possible performance. | ||
| * ***Time Series Forecasting dataset*** : Train a dummy predictor that repeats the last observed value in each series | ||
| 4. **Search by [SMAC](https://github.com/automl/SMAC3)**:\ | ||
| a. Determine budget and cut-off rules by [Hyperband](https://jmlr.org/papers/volume18/16-558/16-558.pdf)\ | ||
| b. Sample a pipeline hyperparameter configuration *2 by SMAC\ | ||
|
|
@@ -50,6 +53,14 @@ pip install autoPyTorch | |
|
|
||
| ``` | ||
|
|
||
| Auto-PyTorch for Time Series Forecasting requires additional dependencies | ||
|
|
||
| ```sh | ||
|
|
||
| pip install autoPyTorch[forecasting] | ||
|
|
||
| ``` | ||
|
|
||
| ### Manual Installation | ||
|
|
||
| We recommend using Anaconda for developing as follows: | ||
|
|
@@ -70,6 +81,20 @@ python setup.py install | |
|
|
||
| ``` | ||
|
|
||
| Similarly, to install all the dependencies for Auto-PyTorch-TimeSeriesForecasting: | ||
|
|
||
|
|
||
| ```sh | ||
|
|
||
| git submodule update --init --recursive | ||
|
|
||
| conda create -n auto-pytorch python=3.8 | ||
| conda activate auto-pytorch | ||
| conda install swig | ||
| pip install -e[forecasting] | ||
|
|
||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| In a nutshell: | ||
|
|
@@ -105,6 +130,63 @@ score = api.score(y_pred, y_test) | |
| print("Accuracy score", score) | ||
| ``` | ||
|
|
||
| For Time Series Forecasting Tasks | ||
| ```py | ||
|
|
||
| from autoPyTorch.api.time_series_forecasting import TimeSeriesForecastingTask | ||
|
|
||
| # data and metric imports | ||
| from sktime.datasets import load_longley | ||
| targets, features = load_longley() | ||
|
|
||
| # define the forecasting horizon | ||
| forecasting_horizon = 3 | ||
|
|
||
| # each series represent an element in the List | ||
| # we take the last forecasting_horizon as test targets. The itme before that as training targets | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you miswrote here. Do you mean
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. items... the part before forecasting starts |
||
| # Normally the value to be forecasted should follow the training sets | ||
| y_train = [targets[: -forecasting_horizon]] | ||
| y_test = [targets[-forecasting_horizon:]] | ||
|
|
||
| # same for features. For uni-variant models, X_train, X_test can be omitted | ||
| X_train = [features[: -forecasting_horizon]] | ||
| # Here x_test indicates the 'known future features': they are the features known previously, features that are unknown | ||
| # could be replaced with NAN or zeros (which will not be used by our networks). If no feature is known beforehand, | ||
| # we could also omit X_test | ||
| known_future_features = list(features.columns) | ||
| X_test = [features[-forecasting_horizon:]] | ||
|
|
||
| start_times = [targets.index.to_timestamp()[0]] | ||
| freq = '1Y' | ||
|
|
||
| # initialise Auto-PyTorch api | ||
| api = TimeSeriesForecastingTask() | ||
|
|
||
| # Search for an ensemble of machine learning algorithms | ||
| api.search( | ||
| X_train=X_train, | ||
| y_train=y_train, | ||
| X_test=X_test, | ||
| optimize_metric='mean_MAPE_forecasting', | ||
| n_prediction_steps=forecasting_horizon, | ||
| memory_limit=16 * 1024, # Currently, forecasting models need much more memories than it actually requires | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you mean to say "use much more memories"? |
||
| freq=freq, | ||
| start_times=start_times, | ||
| func_eval_time_limit_secs=50, | ||
| total_walltime_limit=60, | ||
| min_num_test_instances=1000, # proxy validation sets. This only works for the tasks with more than 1000 series | ||
| known_future_features=known_future_features, | ||
| ) | ||
|
|
||
| # our dataset could directly generate sequences for new datasets | ||
| test_sets = api.dataset.generate_test_seqs() | ||
|
|
||
| # Calculate test accuracy | ||
| y_pred = api.predict(test_sets) | ||
| score = api.score(y_pred, y_test) | ||
| print("Forecasting score", score) | ||
| ``` | ||
|
|
||
| For more examples including customising the search space, parellising the code, etc, checkout the `examples` folder | ||
|
|
||
| ```sh | ||
|
|
@@ -163,6 +245,17 @@ Please refer to the branch `TPAMI.2021.3067763` to reproduce the paper *Auto-PyT | |
| } | ||
| ``` | ||
|
|
||
| ```bibtex | ||
| @article{deng-ecml22, | ||
| author = {Difan Deng and Florian Karl and Frank Hutter and Bernd Bischl and Marius Lindauer}, | ||
| title = {Efficient Automated Deep Learning for Time Series Forecasting}, | ||
| year = {2022}, | ||
| booktitle = {Machine Learning and Knowledge Discovery in Databases. Research Track | ||
| - European Conference, {ECML} {PKDD} 2022}, | ||
| url = {https://doi.org/10.48550/arXiv.2205.05511}, | ||
| } | ||
| ``` | ||
|
|
||
| ## Contact | ||
|
|
||
| Auto-PyTorch is developed by the [AutoML Groups of the University of Freiburg and Hannover](http://www.automl.org/). | ||
Uh oh!
There was an error while loading. Please reload this page.