Skip to content

Commit d290ff6

Browse files
committed
Merge remote-tracking branch 'origin' into feat/new_faqs
2 parents 725ff49 + 2af94d4 commit d290ff6

33 files changed

+3458
-56
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
cache-environment: true
8484

8585
- name: Install pip requirements
86-
run: pip install ./
86+
run: pip install -e ".[dev]"
8787

8888
- name: Run tests
8989
run: nbdev_test --skip_file_glob "*distributed*"

.github/workflows/lint.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Clone repo
14+
uses: actions/checkout@v2
15+
16+
- name: Set up python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.10'
20+
21+
- name: Install dependencies
22+
run: pip install black nbdev pre-commit
23+
24+
- name: Run pre-commit
25+
run: pre-commit run

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/fastai/nbdev
3+
rev: 2.2.10
4+
hooks:
5+
- id: nbdev_clean
6+
- id: nbdev_export

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# Changelog
22

3+
## 0.1.21
4+
5+
### 🚀 Feature Enhancements
6+
7+
#### Introduction of Quantile Forecasts in `forecast` and `cross_validation` Methods 📈
8+
9+
We're thrilled to announce the integration of the `quantiles` argument into TimeGP's `forecast` and `cross_validation` methods. This feature allows users to specify a list of quantiles, offering a comprehensive view of potential future values under uncertainty.
10+
11+
- **Quantile Forecasting Capability:**
12+
By providing a list of quantiles, users can now obtain forecasts at various percentiles of the forecast distribution. This is crucial for understanding the range of possible outcomes and assessing risks more effectively.
13+
14+
``` python
15+
# Generate quantile forecasts
16+
quantiles = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
17+
timegpt_quantile_fcst_df = timegpt.forecast(df=df, h=12, quantiles=quantiles, ...)
18+
```
19+
20+
- **Enhanced Cross-Validation with Quantiles:**
21+
The `cross_validation` method has been updated to support quantile forecasting, enabling a more nuanced validation of model performance across different percentiles.
22+
23+
``` python
24+
# Apply quantile forecasting in cross-validation
25+
timegpt_cv_quantile_fcst_df = timegpt.cross_validation(df=df, h=12, n_windows=5, quantiles=quantiles, ...)
26+
```
27+
28+
*See full changelog [here](https://github.com/Nixtla/nixtla/releases/v0.1.21).*
29+
330
## 0.1.20
431

532
### 🚀 Feature Enhancements

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Please write to `[email protected]` if you're insterested in contributing to this pr
5959
Before doing any changes to the code, please install the git hooks that run automatic scripts during each commit and merge to strip the notebooks of superfluous metadata (and avoid merge conflicts).
6060
```
6161
nbdev_install_hooks
62+
pre-commit install
6263
```
6364

6465
### Preview Changes

action_files/models_performance/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ def summary_performance(
315315
results_comb = ["metric"] + models
316316
exp_config = [col for col in eval_df.columns if col not in results_comb]
317317
eval_df = eval_df.fillna("None")
318+
f.write("<details><summary>Experiment Results</summary>\n\n")
318319
for exp_number, (exp_desc, eval_exp_df) in enumerate(
319320
eval_df.groupby(exp_config), start=1
320321
):
@@ -344,6 +345,7 @@ def summary_performance(
344345
if os.getenv("GITHUB_ACTIONS"):
345346
plot_path = f"{os.getenv('PLOTS_REPO_URL')}/{plot_path}?raw=true"
346347
f.write(f"![]({plot_path})\n\n")
348+
f.write("</details>\n")
347349

348350

349351
if __name__ == "__main__":
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
AZURE_SUBSCRIPTION_ID=
2+
AZURE_RESOURCE_GROUP=
3+
AZURE_WORKSPACE_NAME=
4+
TIMEGPT_TOKEN=
5+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
TS_FILES := Hourly_H.parquet Daily_D.parquet Weekly_W-MON.parquet Monthly_MS.parquet
2+
FILTERED_TS_FILES := $(patsubst %,./data/filtered_datasets/%,$(TS_FILES))
3+
4+
filter_data:
5+
@for file in $(TS_FILES); do \
6+
python -m src.utils.filter_data --dataset_path ./data/$$file; \
7+
done
8+
9+
run_timegpt: .require-dataset_path
10+
@echo Running TimeGPT with dataset_path=$(dataset_path)
11+
@python -m src.nixtla_timegpt --dataset_path $(dataset_path)
12+
13+
run_sn: .require-dataset_path
14+
@echo Running SN with dataset_path=$(dataset_path)
15+
@python -m src.statsforecast_sn --dataset_path $(dataset_path)
16+
17+
run_automl: .require-dataset_path
18+
@echo Running AutoML with dataset_path=$(dataset_path)
19+
@python -m src.azure_automl.forecasting --dataset_path $(dataset_path)
20+
21+
run_methods:
22+
@for file in $(TS_FILES); do \
23+
echo "Running methods for $$file"; \
24+
$(MAKE) run_timegpt dataset_path=./data/filtered_datasets/$$file; \
25+
$(MAKE) run_sn dataset_path=./data/filtered_datasets/$$file; \
26+
$(MAKE) run_automl dataset_path=./data/filtered_datasets/$$file; \
27+
done
28+
29+
download_automl_forecasts:
30+
@python -m src.azure_automl.download_forecasts
31+
32+
evaluate_experiments:
33+
@python -m src.evaluation --datasets_paths "$(shell echo $(FILTERED_TS_FILES) | tr ' ' ',')"
34+
35+
.require-dataset_path:
36+
ifndef dataset_path
37+
$(error dataset_path is required)
38+
endif
39+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Nixtla TimeGPT vs. Azure AutoML: A Comprehensive Performance Analysis
2+
3+
This experiment evaluates the performance of **Nixtla TimeGPT's zero-shot inference** against **Microsoft's Azure AutoML** in the domain of time series forecasting. Our analysis shows that TimeGPT **surpasses Azure AutoML by 12%, 12%, and 10% in MAE, RMSE, and MASE metrics** and has **300x improvement in computational efficiency**. This evaluation spanned over 3,000 distinct time series across various data frequencies, with considerations for Azure AutoML's cost constraints.
4+
5+
# Introduction
6+
7+
[Azure AutoML](https://learn.microsoft.com/en-us/azure/machine-learning/concept-automl-forecasting-methods?view=azureml-api-2), a product of Microsoft, offers a robust automated machine-learning solution that caters to a wide array of predictive tasks, including time series forecasting. TimeGPT is a foundational model for time series forecasting that can be accessed [through an API](https://docs.nixtla.io/). While Azure AutoML is known for its adaptability and ease of use, our findings reveal that TimeGPT offers superior accuracy and efficiency, especially in the context of time series data.
8+
9+
## Empirical Evaluation
10+
11+
Our study involved a detailed comparison of both models across various datasets, including Hourly, Daily, Weekly, and Monthly data frequencies. The datasets were chosen from the test set of the [TimeGPT-1 paper](https://arxiv.org/abs/2310.03589), ensuring a diverse set of time series for evaluation. The selection process was designed to manage computational complexity and adhere to Azure AutoML's dataset size requirements, with a cap of 3,000 observations to maintain cost-effectiveness.
12+
13+
## Results
14+
15+
The following table shows the main findings of our analysis, presenting a comparison of performance metrics (MASE, MAE, RMSE) and computational time (in seconds) across different datasets. The best results are highlighted in **bold** for clarity.
16+
17+
<img width="632" alt="image" src="https://github.com/Nixtla/nixtla/assets/10517170/0cc4285e-2572-4f08-9846-94c68ad72e8b">
18+
19+
20+
## Reproducibility
21+
22+
All experiments were conducted in controlled environments to uphold the integrity and reproducibility of our results. TimeGPT evaluations were performed using a 2020 MacBook Air with an M1 chip, ensuring accessibility and practicality. In contrast, Azure AutoML experiments were carried out on a cluster of 11 STANDARD_DS5_V2 virtual machines equipped with substantial computational resources to showcase its scalability and power.
23+
24+
### Instructions
25+
26+
1. Configure Azure AutoML according to the official Microsoft documentation.
27+
2. Set the environment variables in a `.env` file using `.env.example` as example.
28+
3. Set up a conda environment using:
29+
30+
```bash
31+
mamba create -n azure-automl-fcst python=3.10
32+
conda activate azure-automl-fcst
33+
pip install uv
34+
uv pip install -r requirements.txt
35+
```
36+
37+
4. Download the data using
38+
39+
```python
40+
python -m src.utils.download_data
41+
```
42+
43+
If you're interested in replicating the results, write us at `[email protected]` to give you access to the data.
44+
45+
5. Filter the datasets to prevent AzureML from crashing
46+
47+
```
48+
make filter_data
49+
```
50+
51+
6. Run the forecasting tasks for TimeGPT, SeasonalNaive, and AzureAutoML using the following:
52+
53+
```
54+
make run_methods
55+
```
56+
57+
Notice that AzureAutoML will send the job to the predefined cluster.
58+
59+
7. Retrieve AzureAutoML forecasts once they are ready:
60+
61+
```
62+
make download_automl_forecasts
63+
```
64+
65+
8. Run evaluation
66+
67+
```
68+
make evaluate_experiments
69+
```
70+
71+
72+
### References
73+
- [TimeGPT 1](https://arxiv.org/abs/2310.03589)
74+
- [StatsForecast](https://github.com/Nixtla/statsforecast/)
75+
- [Distributed AzureAutoML for forecasting](https://github.com/Azure/azureml-examples/blob/main/sdk/python/jobs/pipelines/1k_demand_forecasting_with_pipeline_components/automl-forecasting-demand-many-models-in-pipeline/automl-forecasting-demand-many-models-in-pipeline.ipynb)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
azure-ai-ml
2+
azure-identity
3+
azureml-core
4+
fire
5+
mltable
6+
nixtlats
7+
pandas
8+
python-dotenv
9+
rich
10+
statsforecast
11+
utilsforecast

0 commit comments

Comments
 (0)