anchor.diff:      net))
   
   (defmethod output-layer-error ((net t-net) (outputs vector))
  -  (let ((e-total (loop for neuron across (neuron-array (output-layer net))
  -                    for neuron-index from 0 below (length outputs)
  -                    for target-output = (aref outputs neuron-index)
  -                    summing
  -                      (* 1/2 (expt (- target-output (output neuron)) 2)))))
  -    (loop for neuron across (neuron-array (output-layer net))
  -       do (setf (err neuron) e-total))
  -    e-total))
  +  (loop for neuron across (neuron-array (output-layer net))
  +     for expected-output across outputs
  +     for actual-output = (output neuron)
  +     do (setf (expected-output neuron) expected-output)
  +     summing
  +       (* 0.5 (expt (- expected-output actual-output) 2))))
   
   (defmethod learn-vector ((inputs vector) (outputs vector) (net t-net))
     (feed net inputs)
  
positive.code:     (map 'vector 'output (neuron-array (output-layer net)))))
  
  ;; Current
  (defgeneric backprop (component)
    (:method ((neuron t-neuron))
      (let ((err (loop for cx in (cxs neuron)
                    summing (* (err (target cx)) (weight cx))))
            (source-output (output neuron))
            (learning-rate (learning-rate (net neuron)))
            (momentum (momentum (net neuron))))
        (setf (err neuron)
              (if (eq (layer-type (layer neuron)) :input)
                  err
                  (* err (funcall (transfer-derivative neuron) neuron))))
        (loop for cx in (cxs neuron) do
             (setf (delta cx)
                   (+ (* (err (target cx)) source-output learning-rate)
                      (* (delta cx) momentum)))
             (incf (weight cx) (delta cx))))
      neuron)
    (:method ((layer t-layer))
      (loop for neuron across (neuron-array layer) do (backprop neuron))
  
negative.code: 
  (defmethod transfer ((neuron t-neuron))
    (setf (output neuron)
          (if (eq (layer-type neuron) :input)
              (input neuron)
              (setf (output neuron) (/ 1.0 (1+ (exp (- (input neuron))))))))
              ;;(funcall (transfer-function neuron) neuron)))
    (setf (input neuron) (if (biased neuron) 1.0 0.0))
    neuron)
  
  