TrainerBase<T>

Base Classes · AiDotNet.Training

Abstract base class for all trainers, providing shared infrastructure for configuration-driven training pipelines.

Implements: ITrainer<T>

Known derived types: Trainer<T>

For Beginners

Think of TrainerBase as a template for running experiments. It handles all the boilerplate—loading data, setting up the model/optimizer/loss, timing the run, and collecting results—so that concrete trainers only need to implement the actual training strategy in TrainEpoch.

How It Works

The inheritance pattern follows the project’s architecture requirements: ITrainer<T> (interface) → TrainerBase<T> (base) → Trainer<T> (concrete). To create a custom training strategy, inherit from this base class and override TrainEpoch.

Properties

Property Summary
Action<string> LogAction { get; set; } Gets or sets the action used for logging training messages.
TrainingRecipeConfig Config { get; }

Methods

Method Summary
Task<TrainingResult<T>> RunAsync()
TrainingResult<T> Run()
void SetData(Matrix<T> features, Vector<T> labels) Sets in-memory feature and label data for training, bypassing CSV loading.