Class SubsetSampler
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
indicesIEnumerable<int>The subset of indices to sample from.
shuffleboolWhether to shuffle the indices each epoch.
seedint?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
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
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.