protected NeuralNetworkStore CreateNeuralNetworkStore()
        {
            List <float[]> matrixDataList = new List <float[]>();
            List <float[]> biasDataList   = new List <float[]>();

            this.neuralLayers.ForEach(l =>
            {
                biasDataList.Add(l.Bias.GetValue());
                if (!l.IsOutputLayer)
                {
                    matrixDataList.Add(l.NeuralLink.Weights.GetValue());
                }
            });

            NeuralNetworkStore nnStore = new NeuralNetworkStore(this.configuration, matrixDataList.AsEnumerable(), biasDataList.AsEnumerable());

            return(nnStore);
        }
 public NeuralNetwork(MathOperationManager mathManager, NeuralNetworkStore nnStore)
 {
     this.CreateNeuralNetwork(mathManager, nnStore.Configuration);
     this.LoadFromNeuralNetworkStore(nnStore);
 }
 public NeuralNetwork(MathOperationManager mathManager, NeuralNetworkStore nnStore)
 {
     this.CreateNeuralNetwork(mathManager, nnStore.Configuration);
     this.LoadFromNeuralNetworkStore(nnStore);
 }
 internal void LoadFromNeuralNetworkStore(NeuralNetworkStore nnStore)
 {
     // First layer is the input layer, last layer is the output layer and the rest are hidden layers.
     Debug.Assert(this.neuralLayers.Count == nnStore.BiasDataList.Count());
     for (int i = 0; i < this.neuralLayers.Count; i++)
     {
         var layer = this.neuralLayers.ElementAt(i);
         layer.Bias.SetValue(nnStore.BiasDataList.ElementAt(i));
         if (!layer.IsOutputLayer)
         {
             layer.NeuralLink.Weights.SetValue(nnStore.MatrixDataList.ElementAt(i));
         }
     }
 }
        protected NeuralNetworkStore CreateNeuralNetworkStore()
        {
            List<float[]> matrixDataList = new List<float[]>();
            List<float[]> biasDataList = new List<float[]>();

            this.neuralLayers.ForEach(l =>
            {
                biasDataList.Add(l.Bias.GetValue());
                if (!l.IsOutputLayer)
                {
                    matrixDataList.Add(l.NeuralLink.Weights.GetValue());
                }
            });

            NeuralNetworkStore nnStore = new NeuralNetworkStore(this.configuration, matrixDataList.AsEnumerable(), biasDataList.AsEnumerable());
            return nnStore;
        }