Full implementation of the base Trainer class