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

BaseBootstrapCV

Metaclasses

ABCMeta

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 an int, use this as the absolute number of blocks. If a float, 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

get_n_splits

Return the number of splits generated by this cross-validator.

split

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
Return type

int

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