// public BackPropNet(uint inputSize, uint outSize, params uint[] hiddenSizes) { try { iLayer = new InputLayer(inputSize); uint numberOfHiddenLayers = (uint)hiddenSizes.Length; hLayers = new HiddenLayer[numberOfHiddenLayers]; // hLayers[0] = new HiddenLayer(hiddenSizes[0], iLayer); // if(numberOfHiddenLayers > 1) { for(int i=1; i<numberOfHiddenLayers; i++) hLayers[i] = new HiddenLayer(hiddenSizes[i], hLayers[i-1]); } // oLayer = new OutputLayer(outSize, hLayers[numberOfHiddenLayers-1]); depth = numberOfHiddenLayers + 2; } catch(System.Exception ex) { Console.WriteLine(ex.Message); iLayer = null; hLayers = null; oLayer = null; } }
// public void BackPropagateError(HiddenLayer nextLayer) { for(uint i=0; i<size; i++) { double sum = 0.0; double outp = output[i]; // for(uint j=0; j<nextLayer.GetSize(); j++) { sum += nextLayer.layerNeurons[j].GetWeight(i)*nextLayer.layerNeurons[j].GetDelta(); } // this.layerNeurons[i].SetDelta(pDeriv(outp)*sum); } // if(this.previousLayer is HiddenLayer) ((HiddenLayer)previousLayer).BackPropagateError(this); }