Skip to content

feat: add support for more neural models#338

Merged
AzulGarza merged 6 commits intomainfrom
feat/neural-models
Apr 26, 2026
Merged

feat: add support for more neural models#338
AzulGarza merged 6 commits intomainfrom
feat/neural-models

Conversation

@AzulGarza
Copy link
Copy Markdown
Member

this pr adds support for more neural models

Copilot AI review requested due to automatic review settings April 25, 2026 20:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands timecopilot.models by adding additional auto-tuned NeuralForecast and MLForecast model wrappers, and by standardizing/supporting quantiles-based probabilistic outputs (while explicitly rejecting level) for these “Auto*” model families.

Changes:

  • Added new NeuralForecast auto model wrappers: AutoNBEATS, AutoDeepAR, AutoPatchTST, and enabled quantiles support for the existing auto neural models via MQLoss + QuantileConverter.
  • Added multiple new MLForecast auto model wrappers (e.g., AutoXGBoost, AutoCatboost, linear models, forests) and added catboost/xgboost as core dependencies.
  • Updated exports (timecopilot.models.__init__) and test coverage for the expanded model set; added/updated changelog entries.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
timecopilot/models/neural.py Adds new auto neural wrappers and routes probabilistic output through QuantileConverter + MQLoss.
timecopilot/models/ml.py Adds new AutoMLForecast-based wrappers and a shared run_automlforecast_model helper for quantile outputs.
timecopilot/models/__init__.py Re-exports new ML and neural models in the public package surface.
tests/models/conftest.py Registers the new models in the test matrix with minimal configs for speed.
tests/models/test_models.py Updates tests to reflect quantile support and the expanded auto-model set.
pyproject.toml Adds catboost and xgboost to runtime dependencies.
uv.lock Locks new dependencies (notably catboost, xgboost, graphviz updates).
docs/changelogs/v0.0.25.md Adds new feature notes (but modifies an existing release file).
docs/changelogs/v0.0.26.md Introduces a new changelog entry for quantile support improvements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread timecopilot/models/ml.py
Comment on lines +4 to +33
from mlforecast.auto import (
AutoCatboost as _AutoCatboost,
)
from mlforecast.auto import (
AutoElasticNet as _AutoElasticNet,
)
from mlforecast.auto import (
AutoLasso as _AutoLasso,
)
from mlforecast.auto import (
AutoLightGBM as _AutoLightGBM,
)
from mlforecast.auto import (
AutoLinearRegression as _AutoLinearRegression,
)
from mlforecast.auto import (
AutoMLForecast,
)
from mlforecast.auto import (
AutoRandomForest as _AutoRandomForest,
)
from mlforecast.auto import (
AutoRidge as _AutoRidge,
)
from mlforecast.auto import (
AutoXGBoost as _AutoXGBoost,
)
from mlforecast.utils import PredictionIntervals

from .utils.forecaster import Forecaster, get_seasonality
from .utils.forecaster import Forecaster, QuantileConverter, get_seasonality
Comment thread docs/changelogs/v0.0.25.md Outdated
Comment on lines +1 to +19
### Features

* **New neural models**: Added 3 new auto neural models powered by `neuralforecast`: `AutoNBEATS`, `AutoDeepAR`, and `AutoPatchTST`. All support `quantiles` for probabilistic forecasts trained with `MQLoss` and follow the same interface as the existing `AutoNHITS` and `AutoTFT`.

```python
import pandas as pd
from timecopilot.models.neural import AutoDeepAR, AutoNBEATS, AutoPatchTST

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

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

* **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`.

Comment on lines +341 to +359
if level is not None and quantiles is not None:
raise ValueError(
"You must not provide both `level` and `quantiles` simultaneously."
)
if level is not None:
raise ValueError(
"Level is not supported for AutoNBEATS. "
"Please use `quantiles` instead."
)

inferred_freq = self._maybe_infer_freq(df, freq)
qc = QuantileConverter(level=None, quantiles=quantiles)
loss = MQLoss(level=qc.level) if qc.level is not None else MAE()
if self.config is None:
config = _AutoNBEATS.get_default_config(h=h, backend="ray")
config["scaler_type"] = tune.choice(["robust"])
else:
config = self.config
if self.backend == "optuna":
Comment on lines 254 to 282
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",
"PatchTST-FM",
]:
# These models do not support levels yet
"AutoNBEATS",
"AutoDeepAR",
"AutoPatchTST",
}
if model.alias in _level_unsupported:
# these models only support quantiles, not level
with pytest.raises(ValueError) as excinfo:
model.forecast(
df=df,
h=2,
freq="D",
level=level,
)
assert "not supported" in str(excinfo.value)
assert "quantiles" in str(excinfo.value)
return
@AzulGarza
Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request. i want to keep everything from #337. let me know if you have any questions.

Co-authored-by: AzulGarza <10517170+AzulGarza@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ AzulGarza
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

@copilot resolve the merge conflicts in this pull request. i want to keep everything from #337. let me know if you have any questions.

Resolved the merge conflicts in a7fa6ba. The merge brings in origin/main (commits bebe988 and 63059d9) while keeping all changes from the current PR. Conflict resolutions:

  • neural.py: Kept our new AutoNBEATS, AutoDeepAR, AutoPatchTST classes
  • ml.py: Kept all new ML model imports and the refactored run_automlforecast_model helper
  • test_models.py: Kept the new models in both the quantile monotonicity skip list and _level_unsupported set
  • v0.0.26.md: Merged all three changelog sections (new neural models, new ML models, quantile support for existing models)
  • v0.0.25.md: Reverted to the published release content (new entries moved to v0.0.26.md, following feat: add support for more ml models #337's approach)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional NeuralForecast “auto” neural forecasters to the timecopilot.models surface area, along with tests and changelog updates.

Changes:

  • Added new neural model wrappers: AutoNBEATS, AutoDeepAR, AutoPatchTST.
  • Exported new models from timecopilot.models and included them in the test matrix/fixtures.
  • Updated changelogs to document the new neural models.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
timecopilot/models/neural.py Adds NeuralForecast auto-model wrappers for NBEATS, DeepAR, PatchTST using the existing wrapper pattern.
timecopilot/models/__init__.py Exposes the new neural models at the package level via imports and __all__.
tests/models/test_models.py Updates tests to account for new neural auto aliases (min-length handling, quantile monotonicity exceptions, level unsupported list).
tests/models/conftest.py Adds the new models to the parametrized test model fixture with lightweight configs.
docs/changelogs/v0.0.26.md Documents the new neural models and provides a usage example.
docs/changelogs/v0.0.25.md Removes an extra blank line in the features section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to 17
)
from neuralforecast.auto import (
AutoNBEATS as _AutoNBEATS,
)
from neuralforecast.auto import (
AutoNHITS as _AutoNHITS,
)
from neuralforecast.auto import (
AutoPatchTST as _AutoPatchTST,
)
from neuralforecast.auto import (
Comment thread docs/changelogs/v0.0.26.md Outdated
AzulGarza and others added 3 commits April 25, 2026 18:39
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@AzulGarza AzulGarza merged commit 48d3c25 into main Apr 26, 2026
10 checks passed
@AzulGarza AzulGarza deleted the feat/neural-models branch April 26, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants