public void Export(string dir = null)
        {
            _network.CopyToHost();
            if (dir == null)
            {
                dir = Directory.GetCurrentDirectory();
            }
            _network.CopyToHost();
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            var subDir = Path.Combine(dir, "asciidata");

            if (!Directory.Exists(subDir))
            {
                Directory.CreateDirectory(subDir);
            }
            var files = Directory.GetFiles(subDir, "*.txt");

            foreach (var file in files)
            {
                File.Delete(file);
            }
            ReportLayers(dir, subDir);
        }
Exemple #2
0
        public virtual void DoTest(int epochNo, int batchNo)
        {
            var testBatch = _testDataProvider.GetNextBatch();

            _network.InputLayer.SetData(testBatch.Inputs);
            _network.InputLayer.CopyToGpu();
            _network.LabelLayer.SetData(testBatch.Labels);
            _network.LabelLayer.CopyToGpu();
            _network.Calculate(train: false);
            _network.CopyToHost();

            var costLayer = _network.CostLayer as SoftMaxCostLayer;
            var sum       = 0f;

            testBatch.PredictedLabels = costLayer.GetPredictedLabels();
            var correctPercentage = _testDataProvider.GetCorrectLabelPercentage();
            var fNo = (epochNo + "." + batchNo).PadRight(10);

            Console.WriteLine("Test " + fNo + " correct : " + correctPercentage);
            _network.CopyToHost();
        }