verde.base.BaseBlockCrossValidator#

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

Base class for spatially blocked cross-validators.

Parameters:
spacingfloat, 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.

shapetuple = (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_splitsint

Number of splitting iterations.

Methods

get_metadata_routing()

Get metadata routing of this object.

get_n_splits([X, y, groups])

Returns the number of splitting iterations in the cross-validator

split(X[, y, groups])

Generate indices to split data into training and test set.

Methods#

BaseBlockCrossValidator.get_metadata_routing()#

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:
routingMetadataRequest

A MetadataRequest encapsulating routing information.

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

Returns the number of splitting iterations in the cross-validator

Parameters:
Xobject

Always ignored, exists for compatibility.

yobject

Always ignored, exists for compatibility.

groupsobject

Always ignored, exists for compatibility.

Returns:
n_splitsint

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:
Xarray_like, shape (n_samples, 2)

Columns should be the easting and northing coordinates of data points, respectively.

yarray_like, shape (n_samples,)

The target variable for supervised learning problems. Always ignored.

groupsarray_like, with shape (n_samples,), optional

Group labels for the samples used while splitting the dataset into train/test set. Always ignored.

Yields:
trainndarray

The training set indices for that split.

testndarray

The testing set indices for that split.


Examples using verde.base.BaseBlockCrossValidator#

K-Fold cross-validation with blocks

K-Fold cross-validation with blocks