static void DisplayActivation(double[] weights, int dim, int numData, string filename)
        {
            InputOutputHandler myInput = new InputOutputHandler(dim, numData, filename);

            double[][][]  data = myInput.GetInputs();
            ANNPerceptron res  = new ANNPerceptron();

            for (int i = 0; i < data.Length; i++)
            {
                double activation = res.Result(data[i][0], weights);
                //Console.WriteLine("Activation= " + activation.ToString() + " || actual sol= " + data[i][1][0].ToString() + " || single error= " + (activation - data[i][1][0]).ToString());
            }
        }
        static double Error(double[] weights, int dim, int numData, string filename)
        {
            InputOutputHandler myInput = new InputOutputHandler(dim, numData, filename);

            double[][][]  data  = myInput.GetInputs();
            ANNPerceptron res   = new ANNPerceptron();
            double        sumSq = 0;

            for (int i = 0; i < data.Length; i++)
            {
                double activation = res.Result(data[i][0], weights);
                //Console.WriteLine(" - activation= " + activation.ToString() + " - actual sol= " + data[i][1][0].ToString());

                sumSq += Math.Pow(activation - data[i][1][0], 2);
            }
            double err = Math.Sqrt((1.0 / data.Length) * sumSq);

            return(err);
        }
        public void WriteOutputs(double[] weights) //writes only output from testing data
        {
            string[][] csvData = new string[this.numRecs + 4][];
            for (int s = 0; s < csvData.Length; s++)
            {
                csvData[s] = new string[this.dim + 4];
                for (int d = 0; d < this.dim + 4; d++)
                {
                    csvData[s][d] = ".";
                }
            }

            csvData[0][0] = this.header;

            csvData[1][0] = "Weights:";
            Console.WriteLine("--------------------");
            ShowVector(csvData[0], true);
            ShowVector(csvData[1], true);

            for (int d = 0; d < weights.Length; d++)
            {
                csvData[2][d] = Convert.ToString(weights[d]);
            }

            Console.WriteLine("--------------------");
            ShowVector(csvData[0], true);
            ShowVector(csvData[1], true);
            ShowVector(csvData[2], true);

            for (int d = 0; d < weights.Length; d++)
            {
                csvData[3][d] = "t" + d.ToString();
            }
            csvData[3][(this.dim + 4) - 3] = "Predicted";
            csvData[3][(this.dim + 4) - 2] = "Actual";
            csvData[3][(this.dim + 4) - 1] = "Error";

            Console.WriteLine("--------------------");
            ShowVector(csvData[0], true);
            ShowVector(csvData[1], true);
            ShowVector(csvData[2], true);
            ShowVector(csvData[3], true);

            double[][][] testingData = this.GetTestingData();

            ANNPerceptron res = new ANNPerceptron();

            for (int d = 0; d < testingData.Length; d++)
            {
                double activation = res.Result(testingData[d][0], weights);
                int    x;
                for (x = 0; x < this.dim; x++)
                {
                    csvData[d + 4][x] = Convert.ToString(testingData[d][0][x]);
                }
                x++;
                csvData[d + 4][x++] = (activation).ToString("F2");
                csvData[d + 4][x++] = (testingData[d][1][0]).ToString();
                csvData[d + 4][x]   = (Math.Abs(activation - testingData[d][1][0])).ToString("F2");

                Console.Write("csvData[{0}] ", d + 4);
                ShowVector(csvData[d + 4], true);
            }

            Console.WriteLine("===================================");

            StringBuilder sb = new StringBuilder();

            for (int index = 0; index < csvData.Length; index++)
            {
                ShowVector(csvData[index], true);
                sb.AppendLine(string.Join(",", csvData[index]));
            }
            System.IO.File.WriteAllText(this.outputDir + this.filename, sb.ToString());
        }