verde.base.BaseBlockCrossValidator

class verde.base.BaseBlockCrossValidator(spacing=None, shape=None, n_splits=10)[source]

Base class for spatially blocked cross-validators.

Parameters
  • spacing (float, tuple = (s_north, s_east), or None) – The block size in the South-North and West-East directions, respectively. A single value means that the spacing is equal in both directions. If None, then shape must be provided.

  • shape (tuple = (n_north, n_east) or None) – The number of blocks in the South-North and West-East directions, respectively. If None, then spacing must be provided.

  • n_splits (int) – Number of splitting iterations.

Methods Summary

BaseBlockCrossValidator.get_n_splits([X, y, …])

Returns the number of splitting iterations in the cross-validator

BaseBlockCrossValidator.split(X[, y, groups])

Generate indices to split data into training and test set.


BaseBlockCrossValidator.get_n_splits(X=None, y=None, groups=None)[source]

Returns the number of splitting iterations in the cross-validator

Parameters
  • X (object) – Always ignored, exists for compatibility.

  • y (object) – Always ignored, exists for compatibility.

  • groups (object) – Always ignored, exists for compatibility.

Returns

n_splits (int) – Returns the number of splitting iterations in the cross-validator.

BaseBlockCrossValidator.split(X, y=None, groups=None)[source]

Generate indices to split data into training and test set.

Parameters
  • X (array-like, shape (n_samples, 2)) – Columns should be the easting and northing coordinates of data points, respectively.

  • y (array-like, shape (n_samples,)) – The target variable for supervised learning problems. Always ignored.

  • groups (array-like, with shape (n_samples,), optional) – Group labels for the samples used while splitting the dataset into train/test set. Always ignored.

Yields
  • train (ndarray) – The training set indices for that split.

  • test (ndarray) – The testing set indices for that split.

Examples using verde.base.BaseBlockCrossValidator