anchor.diff:  
   (defmethod log-test-error ((trainer mnist-dbm-trainer) (dbm mnist-dbm))
     (describe-trainer trainer)
  -  (unless (zerop (n-inputs trainer))
  -    (log-msg "DBM TEST RMSE: ~{~,5F~^, ~} (~D)~%"
  -             (map 'list
  -                  #'get-error
  -                  (bm-mean-field-errors (make-sampler *test-images*
  -                                                      :max-n #+nil
  -                                                      1000
  -                                                      (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 #+nil
  -                                                               1000
  -                                                               (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)))))))
  +  (log-msg "DBM TEST RMSE: ~{~,5F~^, ~} (~D)~%"
  +           (map 'list
  +                #'get-error
  +                (bm-mean-field-errors (make-sampler *test-images*
  +                                                    :max-n #+nil
  +                                                    1000
  +                                                    (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 #+nil
  +                                                             1000
  +                                                             (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)
  
positive.code: 
  (defclass mnist-dbm-segment-trainer (batch-gd-trainer) ())
  
  (defun linear (a b x)
    (+ a (* b x)))
  
  (defun linear-at-points (x1 y1 x2 y2 x)
    (let ((b (/ (- y2 y1) (- x2 x1))))
      (linear (- (* b (- x1 (/ y1 b)))) b x)))
  
  (assert (= 0 (linear-at-points 3 1 5 2 1)))
  (assert (= 1 (linear-at-points 3 1 5 2 3)))
  (assert (= 2 (linear-at-points 3 1 5 2 5)))
  (assert (= 3 (linear-at-points 3 1 5 2 7)))
  
  (defmethod learning-rate ((trainer mnist-dbm-segment-trainer))
    ;; This is adjusted for each batch. Ruslan's code adjusts it per
  
negative.code:                  (if (listp x)
                       (elt x i)
                       x)))
            (train (make-sampler *training-images*
                                 :max-n (* n-epochs (length *training-images*))
                                 :sample-visible-p (this visible-sampling))
  