Skip to content
Open
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
6 changes: 3 additions & 3 deletions neuralforecast/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ def cross_validation(
self,
df: Optional[DataFrame] = None,
static_df: Optional[DataFrame] = None,
n_windows: int = 1,
n_windows: Union[int, None] = 1,
step_size: int = 1,
val_size: Optional[int] = 0,
test_size: Optional[int] = None,
Expand All @@ -1326,7 +1326,7 @@ def cross_validation(
df (pandas or polars DataFrame, optional): DataFrame with columns [`unique_id`, `ds`, `y`] and exogenous variables.
If None, a previously stored dataset is required. Defaults to None.
static_df (pandas or polars DataFrame, optional): DataFrame with columns [`unique_id`] and static exogenous. Defaults to None.
n_windows (int): Number of windows used for cross validation. Defaults to 1.
n_windows (int, None): Number of windows used for cross validation. If None, define `test_size`. Defaults to 1.
step_size (int): Step size between each window. Defaults to 1.
val_size (int, optional): Length of validation size. If passed, set `n_windows=None`. Defaults to 0.
test_size (int, optional): Length of test size. If passed, set `n_windows=None`. Defaults to None.
Expand Down Expand Up @@ -1385,7 +1385,7 @@ def cross_validation(
test_size = h + step_size * (n_windows - 1)
elif n_windows is None:
if (test_size - h) % step_size:
raise Exception("`test_size - h` should be module `step_size`")
raise Exception("`test_size - h` must be divisible by `step_size`")
n_windows = int((test_size - h) / step_size) + 1
else:
raise Exception("you must define `n_windows` or `test_size` but not both")
Expand Down