Table of Contents

Interface IDataLoader<T>

Namespace
AiDotNet.Interfaces
Assembly
AiDotNet.dll

Base interface for all data loaders providing common data loading capabilities.

public interface IDataLoader<T> : IResettable, ICountable

Type Parameters

T

The numeric type used for calculations, typically float or double.

Inherited Members

Remarks

IDataLoader defines the foundation for all specialized data loaders in the system. It provides: - Basic metadata (name, description) - Load/unload lifecycle management - Reset capability for multi-epoch training - Progress tracking through ICountable

For Beginners: Think of IDataLoader as the foundation that all data loaders build upon.

Just like all vehicles (cars, trucks, motorcycles) share common features (wheels, engine), all data loaders share these common features:

  • A name and description so you know what data it loads
  • The ability to load and unload data
  • The ability to track how much data there is and where you are in processing it

Specific types of data loaders (for images, graphs, text, etc.) add their own specialized features on top of this foundation.

Properties

Description

Gets a description of the dataset and its intended use.

string Description { get; }

Property Value

string

IsLoaded

Gets whether the data has been loaded and is ready for iteration.

bool IsLoaded { get; }

Property Value

bool

Name

Gets the human-readable name of this data loader.

string Name { get; }

Property Value

string

Remarks

Examples: "MNIST", "Cora Citation Network", "IMDB Reviews"

Methods

LoadAsync(CancellationToken)

Loads the data asynchronously, preparing it for iteration.

Task LoadAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Token to cancel the loading operation.

Returns

Task

A task that completes when loading is finished.

Remarks

This method should be called before attempting to iterate through data. It may perform operations like: - Reading files from disk - Downloading data if implementing IDownloadable - Parsing and preprocessing data - Building indices for efficient access

For Beginners: Call this once at the start to prepare your data. It's async so your program stays responsive while loading large datasets.

Unload()

Unloads the data and releases associated resources.

void Unload()

Remarks

Call this when you're done with the dataset to free memory. The loader can be loaded again by calling LoadAsync().