Skip to content

Commit

Permalink
Save images for split visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
labdmitriy committed Nov 20, 2021
1 parent 0e49ed9 commit 06edb45
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 61 deletions.
Binary file added images/test_size_n_splits_cv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/test_size_n_splits_expanding_window_cv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/test_size_n_splits_gap_cv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/test_size_n_splits_shift_size_cv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/test_size_train_size_cv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/train_test_split.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ml_lab/model_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _calculate_split_params(self) -> None:
)

if (train_size is None) and (n_splits is not None):
train_size = n_groups - gap - (test_size + (n_splits - 1) * shift_size)
train_size = n_groups - gap - test_size - (n_splits - 1) * shift_size
self.train_size = train_size

if train_size <= 0:
Expand All @@ -181,7 +181,7 @@ def _calculate_split_params(self) -> None:
)
train_start_idx = 0
elif (n_splits is None) and (train_size is not None):
n_splits = ((n_groups - train_size - gap - test_size) // shift_size) + 1
n_splits = (n_groups - train_size - gap - test_size) // shift_size + 1
self.n_splits = n_splits

if self.n_splits <= 0:
Expand Down
139 changes: 80 additions & 59 deletions notebooks/GroupTimeSeriesSplit.ipynb

Large diffs are not rendered by default.

0 comments on commit 06edb45

Please sign in to comment.