Example #1
0
        public void AddDataAfterEducate(NeuralNetworkObj neuralNetworkObj, Dictionary <double[], double[]> prepareData)
        {
            data.Add("#########################################");
            data.Add("#########################################");

            int id = 1;

            foreach (var entity in prepareData)
            {
                double[] inputVector          = entity.Key;
                double[] expectedResultVector = entity.Value;

                neuralNetworkObj.Clear();
                neuralNetworkObj.SetInputVector(inputVector);
                neuralNetworkObj.Process();

                double[] resultVector = GetResultVector(neuralNetworkObj);

                data.Add($"ID: {id}");
                data.Add($"Epoch:  {neuralNetworkObj.GetCountEpochPassed()} (After educate)");
                data.Add($"Error:  {this.errorMethod.GetError(expectedResultVector, resultVector).ToString()}");
                data.Add("Expected Result:");
                foreach (var item in expectedResultVector)
                {
                    data.Add(item.ToString());
                }
                data.Add("Result:");
                foreach (var item in resultVector)
                {
                    data.Add(item.ToString());
                }
                data.Add("#########################################");
                id++;
            }
        }
Example #2
0
        public void SaveReport(NeuralNetworkObj neuralNetworkObj)
        {
            var dirPath = $"{this.pathToFileStorage}\\REPORT_{neuralNetworkObj.Name}";

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }

            using (StreamWriter sw = new StreamWriter($"{dirPath}\\report_{neuralNetworkObj.GetCountEpochPassed()}.txt", false, System.Text.Encoding.Unicode))
            {
                foreach (var text in data)
                {
                    sw.WriteLine(text);
                }
            }

            this.data = new List <string>();
        }