Preprocessing splitters repeatedkfold - CyrilB1531/lodestar GitHub Wiki
Development build. This page describes
main, not a released package. The latest published Lodestar.Preprocessing is 0.2.0 โ read its documentation.
Home โบ Preprocessing โบ Splitting
Repeats shuffled k-fold, as RepeatedKFold does.
public static IReadOnlyList<FoldSplit> RepeatedKFold(int sampleCount, int foldCount, int repeatCount, long randomState)Parameters โ sampleCount is how many rows there are. foldCount is how many folds each repeat
cuts. repeatCount is how many repeats, at least one. randomState is scikit-learn's
random_state, in [0, 2ยณยฒ โ 1].
Returns โ repeatCount ยท foldCount folds, repeat by repeat, each index list ascending โ the
order the reference yields them in.
Exceptions โ ArgumentOutOfRangeException when a count or randomState is out of range.
ArgumentException when the repeats times the folds are more splits than one list holds (#1318).
Example โ six rows, three folds, two repeats.
using Lodestar.Preprocessing;
IReadOnlyList<FoldSplit> folds = Splitters.RepeatedKFold(sampleCount: 6, foldCount: 3, repeatCount: 2, randomState: 0);
int count = folds.Count; // => 6
string firstRepeat = string.Join(",", folds[0].TestIndices); // => 2,5
string secondRepeat = string.Join(",", folds[3].TestIndices); // => 1,3Remarks โ one generator serves every repeat, so repeat r reads the rows in the generator's
r-th permutation, exactly as the reference hands one RandomState to each KFold it builds.
Applies to โ net10.0, netstandard2.0.
See also โ Splitters.KFold,
Splitters.RepeatedStratifiedKFold.