public static void writeToExcel <T>(NNsTestResults <T> testResults, string rootPath)
        {
            createRootResultsDirectoryIfNotExists(rootPath);

            List <int>       correctAnswersAmount = testResults.correctAnswersAmount;
            List <T>         correctAnswers       = testResults.correctAnswers;
            List <List <T> > answers = testResults.answers;

            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
            using ExcelPackage package  = new ExcelPackage(new FileInfo($"{rootPath}/test_results.xlsx"));
            ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Results");

            worksheet.Cells[1, 1].Value                  = "EXP";
            worksheet.Cells[1, 1].Style.Font.Bold        = true;
            worksheet.Cells[2, 1].Value                  = correctAnswers.Count;
            worksheet.Column(1).Style.Border.Right.Style = ExcelBorderStyle.Thin;

            for (int i = 0; i < correctAnswers.Count; i++)
            {
                worksheet.Cells[i + 4, 1].Value = correctAnswers[i];
            }

            for (int nnIndex = 0; nnIndex < answers.Count; nnIndex++)
            {
                int currentColumn = nnIndex + 2;

                worksheet.Cells[1, currentColumn].Value           = "NN " + (nnIndex + 1);
                worksheet.Cells[1, currentColumn].Style.Font.Bold = true;

                worksheet.Cells[2, currentColumn].Value = correctAnswersAmount[nnIndex];
                worksheet.Cells[3, currentColumn].Value = correctAnswersAmount[nnIndex] * 1d / answers[nnIndex].Count;

                for (int answerIndex = 0; answerIndex < answers[nnIndex].Count; answerIndex++)
                {
                    worksheet.Cells[4 + answerIndex, currentColumn].Value = answers[nnIndex][answerIndex];
                    if (!answers[nnIndex][answerIndex].Equals(correctAnswers[answerIndex]))
                    {
                        worksheet.Cells[4 + answerIndex, currentColumn].Style.Font.Color.SetColor(Color.Red);
                    }
                }

                worksheet.Column(currentColumn).Style.Border.Right.Style = ExcelBorderStyle.Thin;
            }

            package.Save();
        }
        public static void run()
        {
            Console.Write("Hello. Enter experiments title: ");
            string experimentTitle = Console.ReadLine();

            Console.Write("Enter experiments description: ");
            string experimentDescription = Console.ReadLine();

            string        rootPath = $"C://nnlib/experiments/{experimentTitle}";
            ExperimentLog log      = new ExperimentLog(experimentTitle, experimentDescription, parallelNns);

            Console.Write("Initialisation of NNs...");
            List <NeuralNetwork> nns = setupNNs(log);

            Console.WriteLine(" Done.");

            Console.WriteLine("Training started!");
            Console.Write("In progress");
            train(nns, trainSize, log);
            Console.WriteLine(" Done.");

            Console.WriteLine("Testing started!");
            Console.Write("In progress");
            NNsTestResults <int> testResults = test(nns, testSize, log);

            Console.WriteLine(" Done.");

            Console.Write("Saving log... ");
            Utils.endLogAndWriteToFile(log, rootPath);
            Console.WriteLine(" Done.");

            Console.Write("Writing results to excel... ");
            Utils.writeToExcel(testResults, rootPath);
            Console.WriteLine(" Done.");

            Console.Write("Writing NNs configurations to files... ");
            Utils.writeNNsToFiles(nns, rootPath);
            Console.WriteLine(" Done.");

            Console.WriteLine("Process is completed and result is saved in excel file.");
            Console.ReadKey();
        }
        public static void run()
        {
            Console.Write("Hello. Enter experiments title: ");
            string experimentTitle = Console.ReadLine();

            Console.Write("Enter experiments description: ");
            string experimentDescription = Console.ReadLine();

            string        rootPath = $"./experiments/{experimentTitle}";
            ExperimentLog log      = new ExperimentLog(experimentTitle, experimentDescription, 1);

            Console.Write("Enter config files name: ./experiments/loads/");
            string loadName = Console.ReadLine();

            Console.Write("Deserialization of NN...");
            NeuralNetwork nn = deserialize($"./experiments/loads/{loadName}", log);

            Console.WriteLine(" Done.");

            Console.WriteLine("Testing started!");
            Console.Write("In progress");
            NNsTestResults <int> testResults = Mnist.test(new List <NeuralNetwork> {
                nn
            }, testSize, log);

            Console.WriteLine(" Done.");

            Console.Write("Saving log... ");
            Utils.endLogAndWriteToFile(log, rootPath);
            Console.WriteLine(" Done.");

            Console.Write("Writing data to excel... ");
            Utils.writeToExcel(testResults, rootPath);
            Console.WriteLine(" Done.");

            Console.WriteLine("Process is completed and result is saved in excel file.");
            Console.ReadKey();
        }