Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Insample predictions with series of varying lengths #1246

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

marcopeix
Copy link
Contributor

Currently, predict_insample() assumes all series have the same length.

This fix allows insample predictions with series of different lengths.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@marcopeix marcopeix marked this pull request as ready for review January 14, 2025 14:06
@@ -37,7 +37,18 @@
"execution_count": null,
"id": "515672ca",
"metadata": {},
"outputs": [],
"outputs": [
Copy link
Contributor

Choose a reason for hiding this comment

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

Please clear (not clean) notebooks

@@ -1687,7 +1731,93 @@
"execution_count": null,
"id": "4bede563-78c0-40ee-ba76-f06f329cd772",
"metadata": {},
"outputs": [],
"outputs": [
Copy link
Contributor

Choose a reason for hiding this comment

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

clear nb

if test_size > 0 or forefront_offset > 0:
trimmed_dataset = TimeSeriesDataset.trim_dataset(
dataset=self.dataset, right_trim=test_size, left_trim=forefront_offset
for i in range(self.dataset.n_groups):
Copy link
Contributor

Choose a reason for hiding this comment

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

So we loop individually over all series?


# original y
# Combine all series forecasts DataFrames
if isinstance(fcsts_dfs[0], pl_DataFrame):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we use ufp.concat here?

" 'val_check_steps': 1,\n",
" 'step_size': 12}\n",
"\n",
"def get_expected_size(df, h, test_size, step_size):\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Difficult to disect but is this the unit test for having insample predictions with series of varying lengths? If not, do we have it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants