Skip to content

[timeseries] Improve model-zoo hyperparameter typing - #5605

Open
PsychoRover wants to merge 2 commits into
autogluon:masterfrom
PsychoRover:devx/hyperparameters-types
Open

PsychoRover wants to merge 2 commits into
autogluon:masterfrom
PsychoRover:devx/hyperparameters-types

Conversation

@PsychoRover

Copy link
Copy Markdown

Summary

This PR improves the typing surface for TimeSeriesPredictor.fit(..., hyperparameters=...) by adding and refining model-specific type definitions for the Time Series model zoo.

Motivation

This came out of a great AutoGluon experience in an academic forecasting competition a friend and I worked on.

We finished 8th overall (and not 1st 😄), so if anything was missing, it was definitely our “personal skills” and not AutoGluon.

While working, we found ourselves constantly going back and forth between docs and source to confirm accepted hyperparameters. This PR is meant to make that loop easier for future users through stronger, clearer type hints.

What Changed

  • Improved the overall typing experience for Time Series hyperparameters in TimeSeriesPredictor.fit.
  • Brought type hints closer to the model-zoo/documentation expectations so users can rely more on editor/type-checker guidance.
  • Refined internal type aliasing to keep typing robust without affecting runtime behavior.
  • Kept changes scoped to typing and developer ergonomics (no intended functional training/inference changes).

Validation

  • Local syntax/import sanity checks on updated typing modules (py_compile + import checks).
  • No functional model-training behavior changes expected from this PR.

Notes

  • Goal is developer ergonomics: better autocomplete, type-checking, and docs-to-code consistency.

Demo

Demo

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@PsychoRover PsychoRover changed the title Devx/hyperparameters types [timeseries] Improve model-zoo hyperparameter typing Feb 21, 2026
- Guard gluonts and autogluon.common imports behind TYPE_CHECKING
- Use public API import path for TimeSeriesHyperparameters in predictor
- Add re-exports in hyperparameters/__init__.py and timeseries/__init__.py
- Add from __future__ import annotations consistently across type files
- Use PEP 585 list[] instead of List[] in deep_models.py
- Remove redundant union members in NPTSModel (float|SearchableFloat -> SearchableFloat)
- Allow list-of-dicts (ModelType | list[ModelType]) for all model entries
- Widen model_name from Literal to str | space.Categorical in TabularModelMixIn
- Drop NJobsMixIn from PerStepTabularModel to avoid TypedDict invariance error
- Fix docstring URLs to use literal strings instead of uninterpolated variables
@PsychoRover
PsychoRover force-pushed the devx/hyperparameters-types branch from dae7c56 to a7f2bfe Compare April 18, 2026 18:38
@github-actions

Copy link
Copy Markdown
Contributor

Job PR-5605-a7f2bfe is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-5605/a7f2bfe/index.html

@shchur

shchur commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Hi @PsychoRover, thanks a lot for the PR - this looks like a really cool idea. I will need to think about the design a bit and see how to best integrate this with existing mechanisms that we have like the allowed_hyperparameters: list[str] property for time series models

def allowed_hyperparameters(self) -> list[str]:

I cannot promise that I will complete this by the next release, but this definitely looks like a great quality-of-life improvement that we should eventually merge.

@shchur

shchur commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

I created an issue to keep track of this #5698

@PsychoRover

Copy link
Copy Markdown
Author

Hi @shchur! Glad you liked it.

LMK if I can help somehow 👍

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.

2 participants