SplitterBootstrapTransformer
SplitterBootstrapTransformer
- class SplitterBootstrapTransformer(splitter=None, fold='train', shuffle=False, subsample=None, replace=True, random_state=None)[source]
Splitter based Bootstrapping method for synthetic time series generation.
A generalized form of bootstrap based on an sktime splitter.
Any sktime splitter can be passed as a component to this transformer, which will then produce for each series in the input of
transforma panel of time series with the train and/or test sub-series.The output of
transformwill have additional levels:all levels of the
transforminputan additional integer indexed top level, indicating the number of the sample note: this is in general the number of the sample and corresponds to the number of the fold only in the deterministic, exhaustive case
if
split="train"orsplit="test", no further levelsif
split="both", the second top level contains strings"train"and
"test"to indicate train or test fold from the split
For instance, if
split="train", and there is a single original seriesX, the output oftransformwill have a top level (level 0) with integer index ranging from 0 tosplitter.get_n_splits(X)-1.The splitter can be exhaustive and deterministic, or random. By default, exhaustive ordered samples are returned (deterministic). Randomness is controlled by the following parameters:
shuffle(by default off) applies random uniform shuffling to the instancessubsample(by default off) applies sub-sampling with or without replacementreplace(by defaultFalse) selects sub-sampling with or without
replacement
Caution: the instance index of the
transformoutput will correspond to the split index only ifshuffle=Falseandsubsample=None(unless by coincidence)- Parameters:
- splitteroptional, sktime splitter, BaseSplitter descendant
default = SlidingWindowSplitter(window_length=3, step_length=1) The splitter used for the bootstrap splitting.
- foldstr, one of “train” (default), “test”, and “both”
Determines which fold is returned as new instances in the panel. “train” - the training folds; “test” - the test folds; “both” - both training and test folds, and an additional string level with possible values
"train"and"test"is present- shufflebool, default=False
whether to shuffle the order of folds uniformly at random before returning if not, folds will be returned in the ordering defined by the splitter
- subsampleoptional, int or float, default = None
if provided, subsamples the folds returned uniformly at random
int= subsample of that size will be returned (or full sample if smaller)float, must be between 0 and 1 = subsample of that fraction is returned Note: integer 1 selects one series; float 1 selects number insplittermany- replacebool, default=True; only used if
subsample=True whether sampling, if
subsampleis provided is with or without replacementTrue= with replacement,False= without replacement- random_stateint, np.random.RandomState or None (default)
Random seed for the estimator if
None,numpyenvironment random seed is used ifint, passed tonumpyRandomStateas seed ifRandomState, will be used as random generator
- Attributes:
is_fittedWhether
fithas been called.
See also
sktime.transformations.bootstrap.MovingBlockBootstrapTransformerSimilar logic to sliding window splitter, with bootstrap random windows.
Examples
>>> from sktime.transformations.bootstrap import SplitterBootstrapTransformer >>> from sktime.datasets import load_airline >>> y = load_airline() >>> transformer = SplitterBootstrapTransformer(fold="both") >>> y_hat = transformer.fit_transform(y)
Methods
check_is_fitted([method_name])Check if the estimator has been fitted.
clone()Obtain a clone of the object with same hyper-parameters and config.
clone_tags(estimator[, tag_names])Clone tags from another object as dynamic override.
create_test_instance([parameter_set])Construct an instance of the class, using first test parameter set.
create_test_instances_and_names([parameter_set])Create list of all test instances and a list of names for them.
fit(X[, y])Fit transformer to X, optionally to y.
fit_transform(X[, y])Fit to data, then transform it.
get_class_tag(tag_name[, tag_value_default])Get class tag value from class, with tag level inheritance from parents.
get_class_tags()Get class tags from class, with tag level inheritance from parent classes.
get_config()Get config flags for self.
get_fitted_params([deep])Get fitted parameters.
get_param_defaults()Get object's parameter defaults.
get_param_names([sort])Get object's parameter names.
get_params([deep])Get a dict of parameters values for this object.
get_tag(tag_name[, tag_value_default, ...])Get tag value from instance, with tag level inheritance and overrides.
get_tags()Get tags from instance, with tag level inheritance and overrides.
get_test_params([parameter_set])Return testing parameter settings for the estimator.
inverse_transform(X[, y])Inverse transform X and return an inverse transformed version.
is_composite()Check if the object is composed of other BaseObjects.
load_from_path(serial)Load object from file location.
load_from_serial(serial)Load object from serialized memory container.
reset()Reset the object to a clean post-init state.
save([path, serialization_format])Save serialized self to bytes-like object or to (.zip) file.
set_config(**config_dict)Set config flags to given values.
set_params(**params)Set the parameters of this object.
set_random_state([random_state, deep, ...])Set random_state pseudo-random seed parameters for self.
set_tags(**tag_dict)Set instance level tag overrides to given values.
transform(X[, y])Transform X and return a transformed version.
update(X[, y, update_params])Update transformer with X, optionally y.

