Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelogs/v0.0.25.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Features


* **TimeGPT finetuning**: Finetuning is now supported for TimeGPT. You can adapt the pre-trained model to your data before forecasting via `TimeGPTFinetuningConfig`, with options for loss function and finetuning depth. See [#332](https://github.com/TimeCopilot/timecopilot/pull/332) and the [Finetuning Foundation Models](https://timecopilot.dev/examples/finetuning/) example for a full walkthrough.

```python
Expand Down
31 changes: 28 additions & 3 deletions docs/changelogs/v0.0.26.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
### Features

* **Prediction intervals for AutoLGBM, AutoNHITS, and AutoTFT**: These models now support quantile forecasts via the `quantiles` parameter. Pass a list of floats between 0 and 1 to receive additional output columns named `model-q-{percentile}`. Note that `level` is not supported for these models; use `quantiles` instead.
* **New ML models**: Added 7 new auto ML models powered by `mlforecast`'s hyperparameter optimization: `AutoLinearRegression`, `AutoXGBoost`, `AutoRidge`, `AutoLasso`, `AutoElasticNet`, `AutoRandomForest`, and `AutoCatboost`. All models support `quantiles` for probabilistic forecasts via conformal prediction and follow the same interface as the existing `AutoLGBM`.

```python
import pandas as pd
from timecopilot.models.ml import (
AutoLinearRegression,
AutoXGBoost,
AutoRidge,
AutoLasso,
AutoElasticNet,
AutoRandomForest,
AutoCatboost,
)

df = pd.read_csv(
"https://timecopilot.s3.amazonaws.com/public/data/air_passengers.csv",
parse_dates=["ds"],
)

model = AutoRidge()
fcst_df = model.forecast(df, h=12, quantiles=[0.1, 0.5, 0.9])
```

* **Quantile forecasts for AutoLGBM, AutoNHITS, and AutoTFT**: These models now support quantile forecasts via the `quantiles` parameter. Pass a list of floats between 0 and 1 to receive additional output columns named `model-q-{percentile}`. Note that `level` is not supported for these models; use `quantiles` instead.

- `AutoLGBM` computes prediction intervals via conformal prediction using cross-validation residuals.
- `AutoNHITS` and `AutoTFT` are trained with [`MQLoss`](https://nixtla.github.io/neuralforecast/losses.pytorch.html) when quantiles are requested.
Expand All @@ -10,8 +33,10 @@
from timecopilot.models.ml import AutoLGBM
from timecopilot.models.neural import AutoNHITS, AutoTFT

df = pd.read_csv("AirPassengers.csv", parse_dates=["ds"])
df.insert(0, "unique_id", "AirPassengers")
df = pd.read_csv(
"https://timecopilot.s3.amazonaws.com/public/data/air_passengers.csv",
parse_dates=["ds"],
)

model = AutoLGBM()
fcst_df = model.forecast(df, h=12, quantiles=[0.1, 0.5, 0.9])
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ dependencies = [
"accelerate>=1.10.1",
"arch>=7.2.0",
"black>=25.9.0",
"catboost>=1.2.10",
"datasets>=4.1.1",
"fire",
"fsspec>=2025.9.0",
Expand Down Expand Up @@ -103,6 +104,7 @@ dependencies = [
"tsfeatures>=0.4.5",
"utilsforecast[plotting]>=0.2.15",
"wandb==0.22.1",
"xgboost>=3.2.0",
]
description = "The GenAI Forecasting Agent · LLMs × Time Series Foundation Models"
license = "MIT"
Expand Down
10 changes: 9 additions & 1 deletion tests/models/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
from timecopilot.models.foundation.patchtst_fm import PatchTSTFM
from timecopilot.models.foundation.timesfm import TimesFM
from timecopilot.models.foundation.toto import Toto
from timecopilot.models.ml import AutoLGBM
from timecopilot.models.ml import (
AutoElasticNet,
AutoLGBM,
AutoLinearRegression,
AutoXGBoost,
)
from timecopilot.models.neural import AutoNHITS, AutoTFT
from timecopilot.models.prophet import Prophet
from timecopilot.models.stats import (
Expand Down Expand Up @@ -39,6 +44,9 @@ def disable_mps_session(monkeypatch):

models = [
AutoLGBM(num_samples=2, cv_n_windows=2),
AutoLinearRegression(num_samples=2, cv_n_windows=2),
AutoXGBoost(num_samples=2, cv_n_windows=2),
AutoElasticNet(num_samples=2, cv_n_windows=2),
AutoNHITS(
num_samples=2,
config=dict(
Expand Down
26 changes: 22 additions & 4 deletions tests/models/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,18 @@ def test_freq_inferred_correctly(model, freq):
)
@pytest.mark.parametrize("h", [1, 12])
def test_correct_forecast_dates(model, freq, h):
if model.alias in ["AutoLGBM", "AutoNHITS", "AutoTFT"]:
# AutoLGBM requires a certain minimum length
_ml_auto_aliases = {
"AutoLGBM",
"AutoLinearRegression",
"AutoXGBoost",
"AutoRidge",
"AutoLasso",
"AutoElasticNet",
"AutoRandomForest",
"AutoCatboost",
}
if model.alias in _ml_auto_aliases | {"AutoNHITS", "AutoTFT"}:
# These auto ML and neural models require a longer minimum series length
sizes_per_freq = {
freq: 1_000 for freq in ["10S", "10T", "15T", "5T", "H", "Q-DEC"]
}
Expand Down Expand Up @@ -231,11 +241,19 @@ def test_using_quantiles(model):
def test_using_level(model):
level = [0, 20, 40, 60, 80] # corresponds to qs [0.1, 0.2, ..., 0.9]
df = generate_series(n_series=2, freq="D")
if model.alias in [
_level_unsupported = {
"AutoLGBM",
"AutoLinearRegression",
"AutoXGBoost",
"AutoRidge",
"AutoLasso",
"AutoElasticNet",
"AutoRandomForest",
"AutoCatboost",
"AutoNHITS",
"AutoTFT",
]:
}
if model.alias in _level_unsupported:
# These models do not support levels yet
with pytest.raises(ValueError) as excinfo:
model.forecast(
Expand Down
18 changes: 18 additions & 0 deletions timecopilot/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
from .ml import (
AutoCatboost,
AutoElasticNet,
AutoLasso,
AutoLGBM,
AutoLinearRegression,
AutoRandomForest,
AutoRidge,
AutoXGBoost,
)
from .stats import (
ADIDA,
IMAPA,
Expand All @@ -14,10 +24,18 @@

__all__ = [
"ADIDA",
"AutoCatboost",
"AutoElasticNet",
"IMAPA",
"AutoARIMA",
"AutoCES",
"AutoETS",
"AutoLasso",
"AutoLGBM",
"AutoLinearRegression",
"AutoRandomForest",
"AutoRidge",
"AutoXGBoost",
"CrostonClassic",
"DynamicOptimizedTheta",
"HistoricAverage",
Expand Down
Loading
Loading