oa::FnDataset

FnDataset namespace in the OA Data public surface.

NsC++ public headers

Public Types

Public Functions

Batch oa::FnDataset::collate(oa::Span<const Dataset::Sample> inSamples)
SplitResult oa::FnDataset::randomSplit(oa::I64 inTotalSize, oa::F32 inTrainRatio = 0.8f, oa::F32 inValRatio = 0.1f, oa::U64 inSeed = 42)
void oa::FnDataset::shuffle(oa::Vector<oa::I64> & inOutIndices, oa::U64 inSeed = 0)

Function Documentation

Batch oa::FnDataset::collate( oa::Span<const Dataset::Sample> inSamples )
Collate a span of samples into a single batch. Returns an empty batch when samples are empty, inconsistent, or cannot be represented with a leading batch dimension.

Parameters

inSamples
oa::Span<const Dataset::Sample>

Returns

Batch

The declared return value.

SplitResult oa::FnDataset::randomSplit( oa::I64 inTotalSize, oa::F32 inTrainRatio = 0.8f, oa::F32 inValRatio = 0.1f, oa::U64 inSeed = 42 )
Randomly split indices into train/val/test subsets. Ratios are clamped so that train+val+test < = totalSize. Any remainder goes to the training set.

Parameters

inTotalSize
oa::I64

inTrainRatio
oa::F32

Default: 0.8f

inValRatio
oa::F32

Default: 0.1f

inSeed
oa::U64

Default: 42

Returns

SplitResult

The declared return value.

void oa::FnDataset::shuffle( oa::Vector<oa::I64> & inOutIndices, oa::U64 inSeed = 0 )
Fisher-Yates shuffle on an index array.

Parameters

inOutIndices
oa::Vector<oa::I64> &

inSeed
oa::U64

Default: 0

Returns

void

The declared return value.