Skip to content

Conversation

@Davide-Miotti
Copy link

@Davide-Miotti Davide-Miotti commented Dec 3, 2025

Description

Implements AutoregressiveCondition, TimeWeightingInterface and AutoregressiveSolver.
This is a tentative initial implementation, not a definive development.

AutoregressiveCondition

  • Input: Raw time-series tensor ($y_0, \dots, y_T$).
  • Output Slots:
    • input: Initial state ($y_t$). NB: input is just one time, longer input sequences are not supported.
    • unroll: Ground truth sequence ($y_{t+1}, \dots, y_{t+k}$).
  • Key Feature: Stores the time_weighting strategy (e.g., linear decay) directly within the condition.

AutoregressiveSolverInterface

AutoregressiveSolver

  1. Takes input ($y_t$).
  2. Predicts $\hat{y}_{t+1}$.
  3. Calculates loss against unroll target ($y_{t+1}$).
  4. Weights the loss using the condition's strategy.
  5. Feeds $\hat{y}_{t+1}$ back as input for the next step.
  6. Repeats for unroll_length.

Limitations

  • Single length input does not remember previous states beyond the immediate last prediction, limiting context for long-term dependencies.
  • For curriculum learning you need to define multiple conditions with different unroll length by hand, no automation

This PR fixes #730

Checklist

  • Code follows the project’s Code Style Guidelines
  • Tests have been added or updated
  • Documentation has been updated if necessary
  • Pull request is linked to an open issue

@Davide-Miotti Davide-Miotti requested a review from a team as a code owner December 3, 2025 17:07
@Davide-Miotti Davide-Miotti marked this pull request as draft December 3, 2025 17:07
@dario-coscia dario-coscia changed the base branch from master to dev December 3, 2025 17:07
@GiovanniCanali GiovanniCanali added enhancement New feature or request pr-to-fix Label for PR that needs modification labels Dec 4, 2025
@GiovanniCanali
Copy link
Collaborator

Hi @Davide-Miotti , thank you for your valuable contribution!

I would suggest integrating the entire TimeWeighting logic directly into the autoregressive solver. In PINA, weights are typically used to balance different conditions. In this case, however, the weights correspond to different time steps within the same condition, so placing this logic inside the weighting mechanism could be confusing and potentially misleading.

@GiovanniCanali GiovanniCanali added the 0.3 Related to 0.3 release label Dec 15, 2025
@Davide-Miotti Davide-Miotti force-pushed the 730-autoregressive-solver branch from 765550f to 1daa10b Compare December 15, 2025 16:18
@Davide-Miotti
Copy link
Author

To give some additional context, here is a python script that uses the code from this PR:
autoregressive_prova.py

@Davide-Miotti
Copy link
Author

With the last commit I deleted the autoregressive condition and now all the logic is contained within autoregressive solver, I also pushed by mistake a test script, called autoregressive_prova_generic_condition.py which can be used to test the new pipeline. I'll live it there for you to try and remove it later before eventual merge.
Now the solver is set to use DataCondition, as was suggested by @dario-coscia and adopts an adaptive weighting for unrolls as suggested by @GiovanniCanali
Side note, the automatic random shuffling performed by the dataloader is disruptive for autoregressive method, in the test script I set it to false in the Trainer settings

@GiovanniCanali GiovanniCanali self-assigned this Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.3 Related to 0.3 release enhancement New feature or request pr-to-fix Label for PR that needs modification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autoregressive solver

2 participants