anchor.diff:  (defclass mnist-logging-trainer (logging-trainer) ())
   
   (defmethod log-training-period ((trainer mnist-logging-trainer) learner)
  -  10000)
  +  1000)
   
   (defmethod log-test-period ((trainer mnist-logging-trainer) learner)
  -  (length *training-images*))
  +  10000 #+nil(length *training-images*))
    
   
  
positive.code: 
  ;;;; Sampling, clamping, utilities
  
  (defun make-sampler (images &key max-n)
    (make-instance 'counting-function-sampler
                   :max-n-samples max-n
                   :sampler (make-random-generator images)))
  
  (defun clamp-array (image array start)
    (declare (type flt-vector array)
             (optimize (speed 3)))
    (replace array (image-array image) :start1 start))
  
  (defun clamp-striped-nodes (samples striped)
    (let ((nodes (storage (nodes striped))))
      (loop for sample in samples
            for stripe upfrom 0
            do (with-stripes ((stripe striped start))
                 (clamp-array sample nodes start)))))
  
  (defun bias-cloud-p (cloud)
    (or (typep (chunk1 cloud) 'constant-chunk)
  
negative.code:              (or (get-error counter) #.(flt 0))
               n-inputs)
      (reset-counter counter)))
  
  ;;;;;;;;;;;;;;;
  
  (defgeneric label (obj))
  
  (defun count-misclassifications (examples striped
                                   &key (label-fn #'label)
                                   (stripe-label-fn #'stripe-label))
    "Return the number of classification errors and the number of
  examples. The length of EXAMPLES must be equal to the number of
  stripes in STRIPED. LABEL-FN takes an example and returns its label
  that compared by EQL to what STRIPE-LABEL-FN returns for STRIPED and
  the index of the stripe."
    (let ((n 0))
      (loop for example in examples
            for stripe upfrom 0
            do  (unless (= (funcall label-fn example)
                           (funcall stripe-label-fn striped stripe))
                  (incf n)))
      (values n (length examples))))
  
  (defclass labeled () ()
    (:documentation "Mixin for chunks/whatever that hold labels."))
  
  (defclass softmax-label-chunk (softmax-chunk labeled) ())
  
  (defgeneric maybe-make-misclassification-measurer (obj)
    (:method (obj)
      (values nil nil))
    (:method ((labeled labeled))
      (lambda (examples)
        (count-misclassifications examples labeled))))
  
  (defun max-position (array start end)
    (position (loop for i upfrom start below end maximizing (aref array i))
              array :start start :end end))
  
  (defgeneric stripe-label (obj stripe)
    (:method ((chunk softmax-label-chunk) stripe)
      (with-stripes ((stripe chunk start end))
        (- (max-position (storage (nodes chunk)) start end)
           start))))
  
  (defun make-reconstruction-misclassification-counters-and-measurers
      (dbn &key (rbm (last1 (rbms dbn))))
    (loop for chunk in (apply #'append
                              (mapcar #'chunks
                                      (subseq (rbms dbn)
                                              0 (1+ (position rbm (rbms dbn))))))
          for measurer = (maybe-make-misclassification-measurer chunk)
          when measurer
          collect (cons (make-instance 'error-counter)
                        measurer)))
  ;;;;;;;;;;
  
  (defmethod log-test-error ((trainer mnist-rbm-trainer) (rbm mnist-rbm))
    (log-msg "DBN TEST RMSE: ~{~,5F~^, ~} (~D)~%"
  