Refactoring TrainingSet implementation to use pipeline components