public static void Train(GPUModule module, List <OneHotRecordReadOnly> allTrainRecords, Network net, float learnRate = 0.02f, float momentum = 0.5f, int epochsBeforeMergeHoldout = 30, int totalEpochs = 50, string tmpDir = null) { // use roughly last day for validation var trainCount = allTrainRecords.Count; var holdoutCount = trainCount / 7; trainCount = trainCount - holdoutCount; var holdoutRecords = allTrainRecords.Skip(trainCount).ToList(); holdoutRecords.Shuffle(); var trainRecords = allTrainRecords.Take(trainCount).ToList(); var trainProvider = new OneHotRecordProvider(module, trainRecords, "train", shuffleEveryEpoch: true); //var trainProvider = new ClicksProvider(module, TRAINSET_BIN_PATH, "train"); trainProvider._currentEpoch = 0; var holdoutProvider = new OneHotRecordProvider(module, holdoutRecords, "test");// new ClicksProvider(module, TESTSET_BIN_PATH, "test"); //var testProvider = new ClicksProvider(module, TESTSET_BIN_PATH, "test"); holdoutProvider._currentEpoch = 0; var trainer = new CriteoTrainer(net, trainProvider, holdoutProvider); trainer.Train(learnRate, momentum, epocsBeforeReport: 40, epocsBeforeMergeHoldout: epochsBeforeMergeHoldout, totalEpochs: totalEpochs, workDir: tmpDir); }
public static void Train(GPUModule module, List<OneHotRecordReadOnly> allTrainRecords, Network net, float learnRate = 0.02f, float momentum = 0.5f, int epochsBeforeMergeHoldout = 30, int totalEpochs = 50, string tmpDir = null) { // use roughly last day for validation var trainCount = allTrainRecords.Count; var holdoutCount = trainCount / 7; trainCount = trainCount - holdoutCount; var holdoutRecords = allTrainRecords.Skip(trainCount).ToList(); holdoutRecords.Shuffle(); var trainRecords = allTrainRecords.Take(trainCount).ToList(); var trainProvider = new OneHotRecordProvider(module, trainRecords, "train", shuffleEveryEpoch: true); //var trainProvider = new ClicksProvider(module, TRAINSET_BIN_PATH, "train"); trainProvider._currentEpoch = 0; var holdoutProvider = new OneHotRecordProvider(module, holdoutRecords, "test");// new ClicksProvider(module, TESTSET_BIN_PATH, "test"); //var testProvider = new ClicksProvider(module, TESTSET_BIN_PATH, "test"); holdoutProvider._currentEpoch = 0; var trainer = new CriteoTrainer(net, trainProvider, holdoutProvider); trainer.Train(learnRate, momentum, epocsBeforeReport: 40, epocsBeforeMergeHoldout: epochsBeforeMergeHoldout, totalEpochs: totalEpochs, workDir: tmpDir); }
public CriteoTrainer(Network net, OneHotRecordProvider trainDataProvider, OneHotRecordProvider testDataProvider) : base(net, trainDataProvider, testDataProvider) { }