Skip to main content

Module resampling

Module resampling 

Source
Expand description

Resampling methods (ISL ch 5) — cross-validation and the bootstrap. The generic harness every later chapter reuses to estimate test error / variability without a separate validation set.

folds generates the index splits; bootstrap resamples a statistic; cross_val_score runs a caller-supplied fit→predict over the folds and scores each with a caller-supplied metric (so it is estimator-agnostic — works with the regression, glm, … estimators or any closure).

Re-exports§

pub use bootstrap::bootstrap_ci;
pub use bootstrap::bootstrap_estimate;
pub use bootstrap::bootstrap_indices;
pub use bootstrap::BootstrapCi;
pub use bootstrap::BootstrapResult;
pub use bootstrap::CiMethod;
pub use folds::k_fold;
pub use folds::loocv;
pub use folds::train_test_split;
pub use folds::Fold;
pub use permutation::two_sample_test;
pub use permutation::PermutationResult;

Modules§

bootstrap
The bootstrap (ISL ch 5.2) — resample-with-replacement to estimate the sampling distribution (standard error / spread) of an arbitrary statistic.
folds
Resampling index generators — k-fold / LOOCV splits and train/test partition, with a deterministic shuffle so results are reproducible.
permutation
Permutation tests — assumption-free hypothesis testing by resampling.

Functions§

cross_val_score
Cross-validated score of an estimator across folds.