예제 #1
0
        private void ui_load_Click(object sender, EventArgs e)
        {
            DataLoader fileLoader = new DataLoader();
            fileLoader.prepareOpen(dataPath, "train", "gauss_5", 1000, 0);
            fileLoader.open();
            data.trainingData = fileLoader._imgArr;

            fileLoader.prepareOpen(labelPath, "train", "clean", 1000, 0);
            fileLoader.open();
            data.trainingLabels = fileLoader._imgArr;

            for (int i=0; i<999; i++)
            {
                double[] input = data.normalize(data.trainingData[i]);
                double[] target = data.normalize(data.trainingLabels[i]);
                nn.prepareFeed(input, target);
                nn.feedForward();
                nn.backprop();
                nn.trainingErrors[i] = nn.getError();
            }

            //FileLoader testDataLoader = new FileLoader();
            //FileLoader testLabelLoader = new FileLoader();
            //FileLoader trainDataLoader = new FileLoader();
            //FileLoader trainLabelLoader = new FileLoader();
            //status_bar.Text = "Loading test Data. PLease wait!";
            //int type = ui_noiseType.SelectedIndex;
            //string noiseType = string.Empty;

            //switch (type)
            //{
            //    case 0:
            //        noiseType = "gauss_5";
            //        break;
            //    case 1:
            //        noiseType = "gauss_10";
            //        break;
            //    case 2:
            //        noiseType = "gauss_15";
            //        break;
            //    case 3:
            //        noiseType = "snp_002";
            //        break;
            //    case 4:
            //        noiseType = "snp_005";
            //        break;
            //    case 5:
            //        noiseType = "snp_01";
            //        break;
            //    case 6:
            //        noiseType = "gauss_5_snp_005";
            //        break;
            //    case 7:
            //        noiseType = "gauss_10_snp_002";
            //        break;
            //    case 8:
            //        noiseType = "gauss_15_snp_01";
            //        break;
            //    case 9:
            //        noiseType = "random";
            //        break;
            //}

            //try
            //{
            //    testDataLoader.prepareOpen(dataPath, "test", noiseType, 100);
            //    Thread testDataThread = new Thread(new ThreadStart(testDataLoader.open));
            //    testLabelLoader.prepareOpen(labelPath, "test", "clean", 100);
            //    Thread testLabelThread = new Thread(new ThreadStart(testLabelLoader.open));
            //    trainDataLoader.prepareOpen(dataPath, "train", noiseType, 600);
            //    Thread trainDataThread = new Thread(new ThreadStart(trainDataLoader.open));
            //    trainLabelLoader.prepareOpen(labelPath, "train", "clean", 600);
            //    Thread trainLabelThread = new Thread(new ThreadStart(trainLabelLoader.open));

            //    testDataThread.Start();
            //    testDataThread.Join();
            //    testLabelThread.Start();
            //    testLabelThread.Join();
            //    trainDataThread.Start();
            //    trainDataThread.Join();
            //    trainLabelThread.Start();
            //    trainLabelThread.Join();
            //    //file_loader.open(label_path, "test", "clean", 10000);
            //}
            //catch (Exception ex)
            //{
            //    //somethign went wrong
            //    status_bar.Text = "Shit happened with the file loader... fix it!";
            //}

            //data.testData = testDataLoader._imgArr;
            //data.testLabels = testLabelLoader._imgArr;
            //data.trainingData = trainDataLoader._imgArr;
            //data.trainingLabels = trainLabelLoader._imgArr;
        }
예제 #2
0
        private void ui_experiment_Click(object sender, EventArgs e)
        {
            DataLoader fileLoader = new DataLoader();
            fileLoader.prepareOpen(dataPath, "train", "gauss_15", 1000, 0);
            fileLoader.open();
            data.trainingData = fileLoader._imgArr;

            fileLoader.prepareOpen(labelPath, "train", "clean", 1000, 0);
            fileLoader.open();
            data.trainingLabels = fileLoader._imgArr;

            NN nn = new NN(9, 2, 4); //units, (hidden) layers, sidmoid levels
            for (int i = 0; i < 999; i++)
            {
                for (int j = 1; j <= 9; j++)
                {
                    for (int k = 1; k <= 9; k++)
                    {

                    }
                }
                double[] input = data.normalize(data.trainingData[i]);
                double[] target = data.normalize(data.trainingLabels[i]);
                nn.prepareFeed(input, target);
                nn.feedForward();
                nn.backprop();
                nn.trainingErrors[i] = nn.getError();
            }
        }