BaseSplitter¶
yohou.model_selection.BaseSplitter
¶
Bases: BaseEstimator, ABC
Base class for yohou time series cross-validation splitters.
Extends sklearn's BaseCrossValidator with time series-specific functionality including polars DataFrame support and panel data awareness.
All concrete splitters should inherit from this class and implement
the split(), _iter_test_indices(), and get_n_splits()
methods (all declared abstract here).
Attributes ¶
| Name | Type | Description |
|---|---|---|
interval_ |
str
|
Detected time interval of the data, set during |
Notes ¶
This is an abstract base class. Concrete splitters should inherit from
this class and implement split(), _iter_test_indices(), and
get_n_splits().
See Also ¶
ExpandingWindowSplitter: Expanding-window cross-validation.SlidingWindowSplitter: Sliding-window cross-validation.
Source Code ¶
Source code in src/yohou/model_selection/split.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
Methods ¶
__init_subclass__(**kwargs)
¶
Merge parameter constraints from all classes in the MRO.
Source Code ¶
Source code in src/yohou/model_selection/split.py
split(y, X_actual=None)
abstractmethod
¶
Generate indices to split time series data.
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
y
|
DataFrame
|
Target time series used to generate train/test split indices.
Must have a |
required |
X_actual
|
DataFrame or None
|
Actual features. Not used for splitting but accepted for API consistency. |
None
|
Yields:
| Name | Type | Description |
|---|---|---|
train |
ndarray
|
Training set row indices for that split. |
test |
ndarray
|
Test set row indices for that split. |
Source Code ¶
Source code in src/yohou/model_selection/split.py
get_n_splits(y=None, X_actual=None)
abstractmethod
¶
Return the number of cross-validation folds.
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
y
|
DataFrame or None
|
Not used. Accepted for API consistency. |
None
|
X_actual
|
DataFrame or None
|
Not used. Accepted for API consistency. |
None
|
Returns ¶
| Type | Description |
|---|---|
int
|
The number of cross-validation folds. |
Source Code ¶
Source code in src/yohou/model_selection/split.py
__sklearn_tags__()
¶
Get metadata tags for this splitter.
Returns ¶
| Name | Type | Description |
|---|---|---|
tags |
Tags
|
Metadata tags describing splitter capabilities. |