Example #1
0
        public HiddenLayer(uint numberOfNeurons, Layer previous)
            : base(numberOfNeurons)
        {
            this.previousLayer = previous;
            // default activation function is logsig
            this.activationFunction = ActivationFunction.LogSig;
            this.pointer = new ToActivationFunction(NMath.LogSig);
            this.pDeriv = new ToActivationDerivative(NMath.DLogSig);
            this.input = previous.GetOutputVector();
            //
            try
            {

                layerNeurons = new Neuron[numberOfNeurons];
                //
                for(int i=0; i<numberOfNeurons; i++)
                {
                    layerNeurons[i] = new Neuron(previous.GetSize());
                    layerNeurons[i].SetInputVector(input);
                }
                //
            }
            catch(System.Exception exception)
            {
                Console.WriteLine("****EXCEPTION****\n {0} {1}", exception.Message);
                previousLayer = null;
                pointer = null;
                layerNeurons = null;
            }
        }
Example #2
0
 //
 public OutputLayer(uint numOfNeurons,  Layer previous)
     : base(numOfNeurons, previous)
 {
     error = new double[numOfNeurons];
 }