Table of Contents

Class SubsetSampler

Namespace
AiDotNet.Data.Sampling
Assembly
AiDotNet.dll

A sampler that returns a subset of indices.

public class SubsetSampler : DataSamplerBase, IDataSampler
Inheritance
SubsetSampler
Implements
Inherited Members

Remarks

SubsetSampler is useful when you want to train on a specific subset of your data, such as a validation split or a filtered dataset.

Constructors

SubsetSampler(IEnumerable<int>, bool, int?)

Initializes a new instance of the SubsetSampler class.

public SubsetSampler(IEnumerable<int> indices, bool shuffle = false, int? seed = null)

Parameters

indices IEnumerable<int>

The subset of indices to sample from.

shuffle bool

Whether to shuffle the indices each epoch.

seed int?

Optional random seed for reproducibility.

Properties

Length

Gets the total number of samples this sampler will produce per epoch.

public override int Length { get; }

Property Value

int

Remarks

This may differ from the dataset size for oversampling or undersampling strategies.

Shuffle

Gets or sets whether to shuffle the indices each epoch.

public bool Shuffle { get; set; }

Property Value

bool

Methods

GetIndicesCore()

Core implementation for generating indices. Override this in derived classes.

protected override IEnumerable<int> GetIndicesCore()

Returns

IEnumerable<int>

An enumerable of sample indices.