Package parsimony :: Package utils :: Module resampling
[hide private]
[frames] | no frames]

Module resampling

source code

Created on Mon Jun 16 10:00:06 2014

Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved.


Author: Tommy Löfstedt

License: BSD 3-clause.

Functions [hide private]
 
k_fold(n, K=7)
K-fold cross validation iterator.
source code
 
stratified_k_fold(y, K=7)
Stratified k-fold cross validation iterator.
source code
 
bootstrap(n, B=100, seed=None)
Bootstrap sample iterator.
source code
 
stratified_bootstrap(y, B=100, seed=None)
Stratified bootstrap sample iterator.
source code
Variables [hide private]
  __package__ = 'parsimony.utils'
Function Details [hide private]

k_fold(n, K=7)

source code 
K-fold cross validation iterator.

Returns indices for training and test sets.

Parameters
----------
n : Positive integer greater than one. The number of samples.

K : Positive integer greater than or equal to two. The number of folds.

stratified_k_fold(y, K=7)

source code 
Stratified k-fold cross validation iterator.

Returns indices for training and test sets.

Parameters
----------
y : Numpy array with n > 1 elements. The class labels. These labels are
        used to stratify the folds.

K : Positive integer greater than or equal to two. The number of folds.

bootstrap(n, B=100, seed=None)

source code 
Bootstrap sample iterator.

Returns indices for a bootstrap training set.

Parameters
----------
n : Positive integer greater than one. The number of samples.

B : Positive integer greater than or equal to two. The number of bootstrap
        samples to draw.

seed : Integer. A random seed to initialise the random number generator
        with. Use in order to obtain deterministic results. The seed is not
        used if the seed is None.

stratified_bootstrap(y, B=100, seed=None)

source code 
Stratified bootstrap sample iterator.

Returns indices for a bootstrap training set.

Parameters
----------
y : Numpy array with n > 1 elements. The class labels. These labels are
        used to stratify the samples.

B : Positive integer greater than or equal to two. The number of bootstrap
        samples to draw.

seed : Integer. A random seed to initialise the random number generator
        with. Use in order to obtain deterministic results. The seed is not
        used if the seed is None.