Skip to content

Commit

Permalink
docs: docstring for bootstrap method in base class (#20)
Browse files Browse the repository at this point in the history
This PR adds a complete docstring for the `bootstrap` method in the
bootstrapper base class
fkiraly authored Jan 5, 2024
1 parent 6bff268 commit 6a60fbb
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/tsbootstrap/base_bootstrap.py
Original file line number Diff line number Diff line change
@@ -44,7 +44,33 @@ def bootstrap(
exog: np.ndarray | None = None,
test_ratio: float = 0.2,
) -> Iterator[np.ndarray] | Iterator[tuple[list[np.ndarray], np.ndarray]]:
"""Generate indices to split data into training and test set."""
"""Generate indices to split data into training and test set.
Parameters
----------
X : 2D array-like of shape (n_timepoints, n_features)
The endogenous time series to bootstrap.
Dimension 0 is assumed to be the time dimension, ordered
return_indices : bool, default=False
If True, a second output is retured, integer locations of
index references for the bootstrap sample, in reference to original indices.
Indexed values do are not necessarily identical with bootstrapped values.
exog : array-like of shape (n_timepoints, n_features_exog), default=None
Exogenous time series to use in bootstrapping.
test_ratio : float, default=0.2
The ratio of test samples to total samples.
If provided, test_ratio fraction the data (rounded up)
is removed from the end before applying the bootstrap logic.
Yields
------
X_boot_i : 2D np.ndarray-like of shape (n_timepoints_boot_i, n_features)
i-th bootstrapped sample of X.
indices_i : 1D np.nparray of shape (n_timepoints_boot_i,) integer values,
only returned if return_indices=True.
Index references for the i-th bootstrapped sample of X.
Indexed values do are not necessarily identical with bootstrapped values.
"""
X = np.asarray(X)
if len(X.shape) < 2:
X = np.expand_dims(X, 1)

0 comments on commit 6a60fbb

Please sign in to comment.