Preprocessing traintestsplit - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Preprocessing is 0.1.0 — read its documentation.

HomePreprocessingSplitting

TrainTestSplit

A single train and test split of the rows.

public sealed class TrainTestSplit

PropertiesTrainIndices is the rows to fit on and TestIndices the rows held out, both ascending and both IReadOnlyList<int>. The two are disjoint and cover every row.

Example — a fifth of twenty rows.

using Lodestar.Preprocessing;

TrainTestSplit split = Splitters.TrainTest(sampleCount: 20, testFraction: 0.2);

int fitted = split.TrainIndices.Count;             // => 16
string held = string.Join(",", split.TestIndices); // => 16,17,18,19

Remarks — the same shape as FoldSplit and a different type on purpose: a train/test split is one split, not the first of several, and returning a one-element fold list would invite a loop that runs once.

There is no constructor: a TrainTestSplit comes from Splitters.TrainTest.

Applies to — net10.0, netstandard2.0.

See alsoSplitters.TrainTest, FoldSplit.

⚠️ **GitHub.com Fallback** ⚠️