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.
- spacing
Methods
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:
- routing
MetadataRequest
A
MetadataRequest
encapsulating routing information.
- routing
- BaseBlockCrossValidator.get_n_splits(X=None, y=None, groups=None)[source]#
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.
- Xarray_like,
- Yields:
Examples using verde.base.BaseBlockCrossValidator
#
K-Fold cross-validation with blocks