default_splitter_kwargs
| Name | Type | Default | Description |
|---|---|---|---|
splitter | str | -- | The type of splitter. |
kwargs | tp.Kwargs | -- | Arbitrary keyword arguments, will be filtered based on the splitter type. |
| Type | Description |
|---|---|
ValueError | If the splitter type is unsupported. |
| Type | Description |
|---|---|
tp.Kwargs | A dictionary containing the necessary keyword arguments for the splitter. |
CustomSplitter
Ancestors
vectorbtpro.generic.splitting.base.Splittervectorbtpro.generic.analyzable.Analyzablevectorbtpro.base.wrapping.Wrappingvectorbtpro.utils.config.Configuredvectorbtpro.utils.config.HasSettingsvectorbtpro.utils.caching.Cacheablevectorbtpro.utils.checks.Comparablevectorbtpro.utils.pickling.Pickleablevectorbtpro.utils.formatting.Prettifiedvectorbtpro.utils.chaining.Chainablevectorbtpro.base.wrapping.HasWrappervectorbtpro.base.indexing.ExtPandasIndexervectorbtpro.base.indexing.PandasIndexervectorbtpro.base.indexing.IndexingBasevectorbtpro.utils.params.ItemParamablevectorbtpro.utils.params.Itemablevectorbtpro.utils.params.Paramablevectorbtpro.base.indexes.IndexAppliervectorbtpro.utils.attr_.AttrResolverMixinvectorbtpro.generic.stats_builder.StatsBuilderMixinvectorbtpro.generic.plots_builder.PlotsBuilderMixinvectorbtpro.utils.base.Base
Static methods
from_custom_rolling
Splitter instance from a rolling range of fixed length.
Superset Splitter.from_rolling by adding the first (if backwards is sorted)
or last remaining split. Creates a rolling sequence of slices based on the provided index.
The first slice uses a length defined by length, and each subsequent
slice begins after an offset from the previous slice’s right boundary.
Uses Splitter.from_splits to generate an array of splits and
corresponding labels, and then construct the Splitter instance. See Splitter.from_rolling for further informations.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
index | tp.IndexLike | -- | The index to use for the splits. Must be a datetime-like index. |
length | int | -- | The length of each rolling slice. Can be an int, Float, or timedelta. |
offset | int | 0 | The offset to apply to the start of each slice after the first one. Can be an integer, float, or timedelta. |
offset_anchor | str | prev_end | The anchor point for the offset. Can be prev_end or start. |
offset_anchor_set | int | 0 | The index of the anchor point to use for the offset. If None, uses the last anchor point. |
offset_space | str | prev | The space in which the offset is applied. Can be prev or all. |
backwards | bool | False | If True, the rolling slices are created in reverse order. If ‘sorted’, the first slice is sorted in reverse order. If False, the rolling slices are created in forward order. |
split | tp.SplitLike | None | If provided, the rolling slices will be split further according to this parameter. Can be a single split or a list of splits. |
split_range_kwargs | tp.KwargsLike | None | Additional keyword arguments to pass to the split_range method. |
range_bounds_kwargs | tp.KwargsLike | None | Additional keyword arguments to pass to the get_range_bounds method. |
template_context | tp.KwargsLike | None | Context for template rendering, if applicable. |
freq | tp.FrequencyLike | None | Frequency of the index. If None, it will be inferred from the index. |
kwargs | tp.Kwargs | -- | Additional keyword arguments to pass to the Splitter.from_splits method. |
| Type | Description |
|---|---|
ValueError | If backwards is a string that is not sorted. |
ValueError | If the length is negative when backwards is True. |
| Type | Description |
|---|---|
SplitterT | An instance of Splitter containing the rolling slices and their labels. |
from_custom_expanding
Splitter instance from an expanding range.
Creates an expanding sequence of slices based on the provided index.
The first slice uses a minimum length defined by min_length, and each
subsequent slice begins after an offset from the previous slice’s right
boundary.
Uses Splitter.from_expanding by adding the last remaining split. See Splitter.from_expanding for further informations.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
index | tp.IndexLike | -- | The index to use for the splits. Must be a datetime-like index. |
min_length | int | -- | The minimum length of each expanding slice. Can be an int, float, or timedelta. |
offset | int | -- | The offset to apply to the start of each slice after the first one. Can be an int, Float, or timedelta. |
split | tp.SplitLike | None | If provided, the expanding slices will be split further according to this parameter. Can be a single split or a list of splits. |
split_range_kwargs | tp.KwargsLike | None | Additional keyword arguments to pass to the split_range method. |
range_bounds_kwargs | tp.KwargsLike | None | Additional keyword arguments to pass to the get_range_bounds method. |
template_context | tp.KwargsLike | None | Context for template rendering, if applicable. |
freq | tp.FrequencyLike | None | Frequency of the index. If None, it will be inferred from the index. |
kwargs | tp.Kwargs | -- | Additional keyword arguments to pass to the Splitter.from_splits method. |
| Type | Description |
|---|---|
ValueError | If the min_length is negative. |
ValueError | If the offset is negative. |
ValueError | If the split is not a valid split type. |
| Type | Description |
|---|---|
SplitterT | An instance of Splitter containing the expanding slices and their labels. |

