public void OnlineTrain() { int trainCnt = 0; Random rnd = new Random(); while (!stopCriteria(trainCnt)) { Console.Write("\n"); for (int i = 0; i < _trainSetSize; i++) { int index = rnd.Next(_dataMgr.count - 1); double[] input = _dataMgr.GetNormalizedInputData(index); //double[] label = _dataMgr.GetIntLabelData(index); _autoEncoder.GetMLP().OnlineTrain(input, input); } //Console.Write("\n"); Test(); trainCnt++; Console.WriteLine("TRAINING TIME " + trainCnt + " mse " + _mse); } }
public void OnlineTrain() { int layerNum = _lrbm.layerCnt; for (int l = 0; l < layerNum; l++) { for (int i = 0; i < _trainSetSize; i++) { int index = _rnd.Next(_dataMgr.count - 1); double[] input = _dataMgr.GetNormalizedInputData(index); if (l == 0) { _lrbm._rbms[l].OnlineTrain(input); } else { input = _lrbm.Feedforward(l - 1, input); _lrbm._rbms[l].OnlineTrain(input); } Console.WriteLine("Layer: " + l + " Index:" + index + " Error:" + _lrbm._rbms[l].GetMSE() + " Energy:" + _lrbm._rbms[l].GetFreeEnergy()); } } }
public void OnlineTrain() { for (int i = 0; i < _trainSetSize; i++) { int index = _rnd.Next(_dataMgr.count - 1); double[] input = _dataMgr.GetNormalizedInputData(index); _rbm.OnlineTrain(input); Console.WriteLine("Index:" + index + " Error:" + _rbm.GetMSE() + " Energy:" + _rbm.GetFreeEnergy()); } }
public void Test() { int successTime = 0; double mse = 0; for (int i = 0; i < _testSetSize; i++) { double labelData = _dataMgr.GetDoubleLabelData(i); double [] inputData = _dataMgr.GetNormalizedInputData(i); double[] labelData2 = _dataMgr.GetIntLabelData(i); _mlp.SetInput(inputData); _mlp.Feedfowrad(); double maxIndex = _mlp.GetMaxOutputIndex(); if (labelData == maxIndex) { successTime++; } double[] outputData = _mlp.GetIntOutput(); mse += GetMSE(outputData, labelData2); } _mse = mse / (double)_testSetSize; _successRate = (double)successTime / (double)_testSetSize; Console.WriteLine("Test set - success rate : " + _successRate + " - mse : " + _mse); }
public void OnlineTrain() { int trainCnt = 0; Random rnd = new Random(); while (!stopCriteria(trainCnt)) { Console.Write("\n"); for (int i = 0; i < _trainSetSize; i++) { int index = rnd.Next(_dataMgr.count - 1); //Console.WriteLine(i); //Console.Write("-"); if (!_normalizeOuput) { double[] input; if (_normalizeInput) { input = _dataMgr.GetNormalizedInputData(index); } else { input = _dataMgr.GetInputData(index); } double[] label = _dataMgr.GetIntLabelData(index); _network.OnlineTrain(input, label); } } //Console.Write("\n"); Test(); trainCnt++; if (trainCnt % 5 == 0) { _network.DumpToFile(); } Console.WriteLine("TRAINING TIME " + trainCnt + " with successrate " + _successRate + " and mse " + _mse); } }