/// <summary> /// Construct the gradient calculation class. /// </summary> /// <param name="theNetwork">The network to use.</param> /// <param name="ef">The error function to use.</param> /// <param name="theOwner">The owner (usually a trainer).</param> public GradientCalc(BasicNetwork theNetwork, IErrorFunction ef, IGradientCalcOwner theOwner) { _network = theNetwork; errorFunction = ef; _layerDelta = new double[_network.LayerOutput.Length]; _gradients = new double[_network.Weights.Length]; _actual = new double[_network.OutputCount]; _weights = _network.Weights; _layerOutput = _network.LayerOutput; _layerSums = _network.LayerSums; _owner = theOwner; }