protected internal override void BackPropagationStep(BackPropagationNetworkEntryContext context) { var nodeCtx = context.NodeContext; var lowerCtxs = context.LowerConnectionContexts; var upperCtxs = context.UpperConnectionContexts; double error = 0.0; foreach (var lCtx in lowerCtxs) { double currentError = ((ErrorContext)lCtx.RuleContext).Error; var syn = lCtx.Connection as Synapse; if (syn != null) { error += syn.Weight * currentError; } else { error += currentError; } } var neuron = nodeCtx.Node as ActivationNeuron; if (neuron != null) { error = neuron.ActivationFunction.Derivate(neuron.OutputValue) * error; Adjust((IAdjustableItem)neuron, error, 1.0, (DeltaContext)nodeCtx.RuleContext); } foreach (var uCtx in upperCtxs) { var currentContext = ((ErrorContext)uCtx.RuleContext); currentContext.Error = error; var synapse = uCtx.Connection as Synapse; if (synapse != null) Adjust((IAdjustableItem)synapse, error, synapse.InputValue, currentContext); } }
protected internal abstract void BackPropagationStep(BackPropagationNetworkEntryContext context);
protected internal virtual void EndBackPropagation(BackPropagationNetworkEntryContext[] contexts) { }