anchor.diff:        (- (max-position (storage (nodes chunk)) start end)
            start))))
   
  -(defun make-reconstruction-misclassification-counters-and-measurers
  +(defun make-dbn-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)))
  +
  +(defun make-bm-reconstruction-misclassification-counters-and-measurers (bm)
  +  (loop for chunk in (chunks bm)
           for measurer = (maybe-make-misclassification-measurer chunk)
           when measurer
           collect (cons (make-instance 'error-counter)
  
positive.code:                                        (dbn rbm) :rbm rbm))
             (n-inputs trainer))
    (let ((counters-and-measurers
           (make-reconstruction-misclassification-counters-and-measurers
            (dbn rbm) :rbm rbm)))
      (when counters-and-measurers
        (let ((errors (map 'list
  
negative.code:     (reset-counter counter)))
  
  (defmethod log-test-error ((trainer mnist-dbm-trainer) (dbm mnist-dbm))
    (log-msg "DBM TEST RMSE: ~{~,5F~^, ~} (~D)~%"
             (map 'list
                  #'get-error
                  (bm-mean-field-errors (make-sampler *test-images*
                                                      :max-n 1000
                                                      #+nil
                                                      (length *test-images*))
                                        dbm))
             (n-inputs trainer))
    (let ((counters-and-measurers
           (make-bm-reconstruction-misclassification-counters-and-measurers dbm)))
      (when counters-and-measurers
        (let ((errors (map 'list
                           #'get-error
                           (bm-mean-field-errors (make-sampler *test-images*
                                                               :max-n 1000
                                                               #+nil
                                                               (length
                                                                *test-images*)
                                                               :omit-label-p t)
                                                 dbm
                                                 :counters-and-measurers
                                                 counters-and-measurers))))
          (log-msg "DBM TEST CLASSIFICATION ACCURACY: ~{~,2F%~^, ~} (~D)~%"
                   (mapcar (lambda (e)
                             (* 100 (- 1 e)))
                           errors)
                   (n-inputs trainer))))))
  
  (defmethod positive-phase :around (batch trainer (dbm mnist-dbm))
    (call-next-method)
  