public LearningNet(NeuralNet net)      // param jasonFile
        {
            this.net = net;

            CostType = CostType.SquaredMeanError;

            Z            = new Matrix[net.L];
            A            = new Matrix[net.L];
            dadz_OfLayer = new Matrix[net.L];
            Delta        = new Matrix[net.L];
        }
        static void Main(string[] args)
        {
            NeuralNet net     = NeuralNetFactory.GetNeuralNet("Implement jsonSource later!");
            Trainer   trainer = new Trainer(net);

            //net.DumpToExplorer();
            net.DumpToConsole();

            Sample[] trainingData = DataFactory.GetTrainingData(100);
            Sample[] testingData  = DataFactory.GetTestingData();
            trainer.Train(trainingData, testingData, 0.02f, 10);

            Console.ReadLine();

            // net.DumpToConsole(true);
            // var test = net.GetTotalOutput(trainer.trainingData.First());
        }
        public static NeuralNet DumpToConsole(this NeuralNet net, bool waitForEnter = false)
        {
            Console.WriteLine($"\n                                    T H E   N E U R A L   N E T");
            Console.WriteLine($"                                  - - - - - - - - - - - - - - - -\n");
            Console.WriteLine($"                                    NeuronsPerLayer : {net.WeightRange}");
            Console.WriteLine($"                                    WeightRange     : {net.WeightRange}");
            Console.WriteLine($"                                    BiasRange       : {net.BiasRange}");
            Console.WriteLine();

            for (int i = 0; i < net.L; i++)
            {
                //Console.WriteLine($"    -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   \n");
                Console.WriteLine($"\n                                            L a y e r  {i}");
                Console.WriteLine($"                                  - - - - - - - - - - - - - - - -\n");
                Console.WriteLine($"                                    Neurons   : {net.NeuronsPerLayer[i]}");
                Console.WriteLine($"                                    Activator : {net.Activations[i]}");

                Matrix w = net.W[i];
                if (w != null)
                {
                    w.DumpToConsole($"\nw = ");
                }

                Matrix b = net.B[i];
                if (b != null)
                {
                    b.DumpToConsole($"\nb = ");
                }
            }

            if (waitForEnter)
            {
                Console.ReadLine();
            }
            return(net);
        }
        public static NeuralNet GetNeuralNet(string jsonSource)
        {
            // Get from jsonSource later.

            var   layers      = new[] { 4, 4, 4, 8, 4 };
            float weightRange = 2;
            float biasRange   = .1f;

            var result = new NeuralNet()
            {
                NeuronsPerLayer = layers,
                L = layers.Length,

                WeightRange = weightRange,
                BiasRange   = biasRange,

                W           = GetWeights(layers, weightRange),
                B           = GetBiases(layers, biasRange),
                Activations = GetActivations("Implement jsonSource later!"),
                Derivations = GetDerivationsOfActivations("Implement jsonSource later!")
            };

            return(result);
        }