Skip to content

Expose block_split(adjust=...) option in BlockKFold #551

Description

@ErosKerouak

Description of the desired feature:

Currently, verde.BlockKFold internally calls block_split() with:

adjust="spacing"

This behavior appears to be fixed and is not exposed as a user-configurable argument.

It would be useful to allow users to pass the adjust parameter through the BlockKFold API, for example:

cv = vd.BlockKFold(
    spacing=300000,
    n_splits=4,
    adjust="region",
)

This would make it possible to choose between the two existing block_split() behaviors:

  • adjust="spacing": preserve the region bounds and slightly modify the effective spacing.
  • adjust="region": preserve the requested spacing and slightly modify the region bounds.

This can be particularly relevant in spatial cross-validation workflows where block size has methodological meaning (for example, when chosen from an estimated correlation length scale or variogram range). In such cases, preserving the requested spacing may be preferable to adjusting the spacing itself.

A backward-compatible solution would be to add:

adjust="spacing"

as the default behavior in BlockKFold.


Are you willing to help implement and maintain this feature?

Yes. I would be happy to help test the feature, provide feedback, and contribute a pull request if needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIdea or request for a new feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions