private void ComputeDeltas(Matrix <float> target) { Matrix <float> a = Output._beta.Clone(); // Perform the derivative of the activation function on the values of the nodes Matrix <float> b = Output.ActivationFunctionDerivative(Output._alpha); // Adds the negative of each column vector in the target matrix to the respective column vector in ______ //a.EnumerateColumnsIndexed().Select(t => t.Item2.Add(target.Column(t.Item1).Negate())); a = a - target; Matrix <float> OutLayerDeltas = a.PointwiseMultiply(b); Output._delta = OutLayerDeltas; NodeLayer current = Output.Previous; bool inputLayer = false; while (!inputLayer) { Matrix <float> transWeight = current.Next.Weights().TransposeThisAndMultiply(current.Next._delta); // MISSING CODE HERE if (current.Previous == null) { inputLayer = true; } } }
// ------------------------ // End Variables // ------------------------ // ------------------------ // Begin Constructors // ------------------------ /// <summary> /// Initialize variables. /// </summary> protected NodeLayer() { Previous = null; Next = null; _omega = null; _delta = null; _beta = null; _alpha = null; Nodes = 0; Passes = 1; }
/// <summary> /// Adds reference to the previous layer. /// </summary> /// <param name="nodes">Number of nodes in this layer. (number of rows)</param> /// <param name="numPasses">Number of input passes. (number of columns)</param> /// <param name="prev">Reference to the previous layer in the network.</param> protected NodeLayer(int nodes, int numPasses, NodeLayer prev) : this(nodes, numPasses) { Previous = prev; }