SpatialLeaveOneOut

class museotoolbox.cross_validation.SpatialLeaveOneOut(distance_thresold=None, distance_matrix=None, n_repeats=False, n_splits=False, random_state=False, verbose=False, **kwargs)[source]

Generate a Cross-Validation with a stratified spatial Leave-One-Out method.

Parameters
  • distance_matrix (numpy.ndarray, shape [n_samples, n_samples]) – Array got from function museotoolbox.vector_tools.get_distance_matrix(inRaster,inVector)

  • distance_thresold (int.) – In pixels.

  • n_repeats (int or False, optional (default=False)) – If False : will iterate as many times as the smallest number of groups. If int : will iterate the number of times specified.

  • random_state (int or False, optional (default=False)) – If int, random_state is the seed used by the random number generator; If None, the random number generator is created with time.time().

  • verbose (integer or False, optional (default=False)) – Controls the verbosity: the higher the value is, the more the messages are detailed.

See also

museotoolbox.vector_tools.get_distance_matrix

to get distance matrix and label.

References

See “Spatial leave‐one‐out cross‐validation for variable selection in the presence of spatial autocorrelation” : https://doi.org/10.1111/geb.12161.

Manage cross-validartion methods to generate the duo valid/train samples.

split(X,y,g) : Function.

Get a memory cross validation to use directly in Scikit-Learn.

saveVectorFiles() : Need default output name (str).

To save as many vector files (train/valid) as your Cross Validation method outputs.

__get_supported_extensions() : Function.

Show you the list of supported vector extensions type when using saveVectorFiles function.

reinitialize() : Function.

If you need to regenerate the cross validation, you need to reinitialize it.

Methods

__init__([distance_thresold, …])

Manage cross-validartion methods to generate the duo valid/train samples.

get_n_splits([X, y, groups])

Returns the number of splitting iterations in the cross-validator.

get_supported_extensions()

reinitialize()

save_to_vector(vector, field[, group, …])

Save to vector files each fold from the cross-validation.

split(X, y[, groups])

Split the vector/array according to y and groups.

Examples using museotoolbox.cross_validation.SpatialLeaveOneOut