partition(dates::AbstractInterval{Date}, s::DateSelector)
partition(dates::StepRange{Date, Day}, selector::DateSelector)
partition(dates::AbstractVector{Date}, s::DateSelector)

Partition the set of dates into disjoint validation and holdout sets according to the selector and return a NamedTuple({:validation, :holdout}) of iterators.


PeriodicSelector(period::DatePeriod, stride::DatePeriod=Day(1), offset::DatePeriod=Day(0))

Assign holdout dates by taking a set of size stride once per period. The offset is relative to Monday 1st Jan 1900, and controls when the selected section starts.

For example, PeriodicSelector(Week(1), Day(2), Day(1)) will select 2 days per week. With this selected periods offset by 1 day from 1st Jan 1900. I.e. if applied to the first two weeks of the year 1900, it would select 2nd, 3rd, 9th and 8th of Jan 1900.

Note: this cannot be actually used to select days earlier than offset after 1st Jan 1900.

RandomSelector(seed, holdout_fraction=1//2, block_size=Day(1), offset=Day(0))

Determine holdout set by randomly subsampling contiguous blocks of size block_size without replacement using a MersenneTwister seeded with seed. The probability of any given block being in the holdout set is given by holdout_fraction.

The offset is rarely needed, but is used to control block boundries. It is given as a offset relative to Monday 1st Jan 1900. For example, with the default offset of Day(0), and if using a Week(1) block_size, then every block will start on a Monday, and will go for 1 or more weeks from there.

Note that at the boundries of the partitioned dates the blocks may not be of size block_size if they go over the edge – this is infact the common case.