Refactored and generalized TrainSGD and CSVLineReader