示例#1
0
        public void CalculateOutput()
        {
            foreach (var inputNeuron in InputLayer.Neurons)
            {
                inputNeuron.Input = Activation.Sigmoid(inputNeuron.Input);
                inputNeuron.Activate();
            }

            for (var i = 0; i < HiddenLayers.Count; i++)
            {
                foreach (var currentLayerNeuron in HiddenLayers[i].Neurons)
                {
                    if (i == 0)
                    {
                        //Cross point between first hidden layer and input layer
                        foreach (var inputNeuron in InputLayer.Neurons)
                        {
                            currentLayerNeuron.Input += inputNeuron.Output;
                        }
                    }
                    else
                    {
                        foreach (var hiddenLayerNeuron in HiddenLayers[i - 1].Neurons)
                        {
                            currentLayerNeuron.Input += hiddenLayerNeuron.Output;
                        }
                    }
                    currentLayerNeuron.Activate();
                }
            }

            foreach (var outputNeuron in OutputLayer.Neurons)
            {
                foreach (var hiddenLayerNeuron in HiddenLayers[HiddenLayers.Count - 1].Neurons)
                {
                    outputNeuron.Input += hiddenLayerNeuron.Output;
                }
                outputNeuron.Activate();
            }
        }
示例#2
0
 public Dropout(Activation activation, double width = 0.25f) : base(activation)
 {
     this.width = width;
 }
示例#3
0
 public Layer(int dimIn, int dimOut, Activation activation = null)
 {
     _W          = new double[dimIn, dimOut];
     _b          = new double[dimOut];
     _activation = activation;
 }
示例#4
0
 public Layer(Activation activation)
 {
     func = activation;
 }
示例#5
0
 public MaxPool2D(Activation activation, int width, int height) : base(activation)
 {
     this.width  = width;
     this.height = height;
 }
 public FullyConnLayar(Activation activation, Size output) : base(activation)
 {
     this.output_size = output;
 }
示例#7
0
 public Conv2D(Activation activation, int width, int height, int count = 1) : base(activation)
 {
     this.width  = width;
     this.height = height;
     this.count  = count;
 }
示例#8
0
 protected double GetChunkOfDeltaH(double weightSynapse, double neuronInBeginSynapse, double deltaInEndSynapse) =>
 weightSynapse *deltaInEndSynapse *Activation.DeriveFunc(neuronInBeginSynapse);
示例#9
0
 protected Vector GetDelta0(Vector actual, Vector ideal) =>
 Vector.Combine(actual, ideal, (actualItem, idealItem) => (idealItem - actualItem) * Activation.DeriveFunc(actualItem));