facet.validation.StationaryBootstrapCV#
- class facet.validation.StationaryBootstrapCV(n_splits=1000, mean_block_size=0.5, random_state=None)[source]#
Bootstrap for stationary time series, based on Politis and Romano (1994).
This bootstrapping approach samples blocks with exponentially distributed sizes, instead of individual random observations as is the case with the regular bootstrap.
Intended for use with time series that satisfy the stationarity requirement.
- Bases
- Metaclasses
- Parameters
n_splits (
int
) – number of splits to generate (default: 1000)mean_block_size (
Union
[int
,float
]) – mean size of coherent blocks to sample. If anint
, use this as the absolute number of blocks. If afloat
, must be in the range (0.0, 1.0) and denotes a block size relative to the total number samples. (default: 0.5)random_state (
Union
[int
,RandomState
,None
]) – random state to initialise the random generator with (optional)
Method summary
Return the number of splits generated by this cross-validator.
Generate indices to split data into training and test set.
Definitions
- get_n_splits(X=None, y=None, groups=None)#
Return the number of splits generated by this cross-validator.
- Parameters
X (
Union
[ndarray
[Any
,dtype
[Any
]],DataFrame
,None
]) – for compatibility only, not usedy (
Union
[ndarray
[Any
,dtype
[Any
]],Series
,DataFrame
,None
]) – for compatibility only, not usedgroups (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]],None
]) – for compatibility only, not used
- Return type
- Returns
the number of splits
- split(X, y=None, groups=None)#
Generate indices to split data into training and test set.
- Parameters
- Return type
Generator
[Tuple
[ndarray
[Any
,dtype
[int64
]],ndarray
[Any
,dtype
[int64
]]],None
,None
]- Returns
a generator yielding (train, test) tuples where train and test are numpy arrays with train and test indices, respectively