AgNewsDataLoader<T>

Models & Types · AiDotNet.Data.Text.Benchmarks

Loads the AG News topic classification dataset (4 classes: World, Sports, Business, Sci/Tech).

Inheritance: DataLoaderBase<T> → InputOutputDataLoaderBase<T, Tensor<T>, Tensor<T>> → AgNewsDataLoader<T>

How It Works

Expects CSV files train.csv and test.csv with columns class_index,title,description. Auto-download fetches the canonical release from the FastAI mirror. Features are tokenized title+description sequences Tensor[N, MaxSequenceLength]. Labels are one-hot 4-class vectors Tensor[N, 4].

Constructors

Constructor Summary
AgNewsDataLoader(AgNewsDataLoaderOptions options) Creates a new AG News data loader.

Properties

Property Summary
int FeatureCount { get; }
int OutputDimension { get; }
int TotalCount { get; }
string Description { get; }
string Name { get; }

Methods

Method Summary
Task<string> LoadRawTextAsync(DatasetSplit split, CancellationToken cancellationToken) Loads the raw, unprocessed CSV text content for the requested AG News split, auto-downloading via AutoDownload if the file is not already cached.
ValueTuple<IInputOutputDataLoader<T, Tensor<T>, Tensor<T>>, IInputOutputDataLoader<T, Tensor<T>, Tensor<T>>, IInputOutputDataLoader<T, Tensor<T>, Tensor<T>>> Split(double trainRatio, double validationRatio, int? seed)