File size: 3,734 Bytes
fa53297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d896a52
 
 
 
 
 
 
 
 
 
 
 
fa53297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d896a52
 
fa53297
d896a52
 
fa53297
d896a52
 
fa53297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d896a52
 
 
 
fa53297
 
 
d896a52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
language: en
license: mit
tags:
  - time-series
  - forecasting
  - arima
  - chronos
  - lstm
  - api
---

# TSFA β€” Time Series Forecasting API

**Predict future values with calibrated confidence intervals via a simple REST API.**

TSFA handles the full forecasting pipeline: automatic preprocessing, model selection,
uncertainty quantification, and diagnostics β€” no ML expertise required.

## Available on RapidAPI

πŸš€ **[Try the API on RapidAPI](https://rapidapi.com/dorianmrt/api/tsfa)**

Free tier available. No credit card required to start.

## Quick Start

```python
import requests

resp = requests.post(
    "https://tsfa.p.rapidapi.com/v1/forecast/univariate",
    headers={
        "X-RapidAPI-Key": "YOUR_KEY",
        "X-RapidAPI-Host": "tsfa.p.rapidapi.com",
    },
    json={
        "series": [120, 132, 128, 145, 139, 152, 148, 160, 155, 168],
        "horizon": 7,
        "model": "auto",
    },
)
print(resp.json()["forecast"]["mean"])
# [171.2, 174.5, 177.8, 181.0, 184.3, 187.6, 190.8]
```

## Use Cases

![Retail demand forecast β€” 14-day ahead with 80% and 95% confidence intervals](https://huggingface.co/Eymdeyy/tsfa-forecasting-api/resolve/main/images/01_retail_forecast.png)
*Retail demand forecast β€” 14-day ahead with 80% and 95% confidence intervals*

![EUR/USD exchange rate forecast β€” 30-day ahead with 95% probability band](https://huggingface.co/Eymdeyy/tsfa-forecasting-api/resolve/main/images/02_financial_forecast.png)
*EUR/USD exchange rate forecast β€” 30-day ahead with 95% probability band*

![Energy consumption forecast β€” 48h ahead (ETT-h1 real data)](https://huggingface.co/Eymdeyy/tsfa-forecasting-api/resolve/main/images/03_energy_forecast.png)
*Energy consumption forecast β€” 48h ahead (ETT-h1 real data)*


## Models

| Model | Credits | Best For |
|-------|---------|----------|
| `auto` | 1 | Automatic selection β€” recommended |
| `arima` | 1 | Stationary series, interpretable |
| `chronos` | 1 | Pre-trained transformer (zero-shot) |
| `lstm` | 2 | Long sequences, complex patterns |

## Benchmarks

Evaluated via sliding-window backtesting (5 windows) on public datasets.

| Dataset | Model | Horizon | MAE | RMSE | MAPE | sMAPE |
|---------|-------|---------|-----|------|------|-------|
| ett_h1 | arima | 24 | 2.4524 | 2.9405 | 10.12% | 10.74% |
| ett_h1 | naive | 24 | 2.4524 | 2.9405 | 10.12% | 10.74% |
| ett_h1 | seasonal_naive | 24 | 1.9263 | 2.2837 | 8.25% | 8.74% |
| exchange_rate | arima | 30 | 0.0085 | 0.0100 | 1.13% | 1.13% |
| exchange_rate | naive | 30 | 0.0085 | 0.0100 | 1.13% | 1.13% |
| exchange_rate | seasonal_naive | 30 | 0.0103 | 0.0117 | 1.37% | 1.37% |
| m5_sample | arima | 14 | 9.0427 | 10.5617 | 7.63% | 7.43% |
| m5_sample | naive | 14 | 14.3541 | 16.7054 | 11.45% | 11.74% |
| m5_sample | seasonal_naive | 14 | 5.0372 | 6.2019 | 4.24% | 4.18% |

Datasets: ETT-h1 (electricity transformer temperature), Exchange Rate (8 currencies),
M5 (retail sales). All results are out-of-sample.

## Endpoints

| Method | Path | Description |
|--------|------|-------------|
| POST | `/v1/forecast/univariate` | Forecast a single series |
| POST | `/v1/forecast/batch` | Forecast 50–500 series in parallel |
| POST | `/v1/validate` | Backtest with sliding-window cross-validation |
| GET | `/v1/models` | List available models |
| GET | `/v1/usage` | Check credit consumption |
| GET | `/health` | API health status |

## Plans

| Plan | Monthly Credits | Rate Limit | Price |
|------|----------------|------------|-------|
| Free | 500 | 10 req/min | $0 |
| Basic | 10,000 | 30 req/min | $49 |
| Pro | 50,000 | 100 req/min | $199 |
| Ultra | 200,000 | 300 req/min | $499 |

## License

MIT β€” see [GitHub](https://github.com/Eymdey/tsfa)