anchor.diff:    (let ((sampler (make-sampler images :max-n (length images)))
           (cache (clamping-cache bpn))
           (map-chunks-and-lumps (collect-map-chunks-and-lumps bpn dbm)))
  -    (do-batches-for-learner (samples (sampler dbm))
  -      (set-input samples dbm)
  -      (up-dbm dbm)
  -      (settle-hidden-mean-field dbm 10 (flt 0.5)
  -                                :initial-pass-done-p t)
  -      (loop for image in samples
  -            for stripe upfrom 0 do
  -            (let ((x ()))
  -              (loop for (chunk lump) in map-chunks-and-lumps
  -                    do
  -                    (with-stripes ((stripe chunk chunk-start chunk-end))
  -                      (let ((xxx (make-flt-array
  -                                  (- chunk-end chunk-start))))
  -                        (replace xxx (storage (nodes chunk))
  -                                 :start2 chunk-start :end2 chunk-end)
  -                        (push (list lump xxx) x))))
  -              (setf (gethash image cache) x))))))
  +    (let ((fn (make-instance 'periodic-fn :period 1000
  +                             :fn (lambda (n)
  +                                   (log-msg "populated: ~S~%" n))))
  +          (n 0))
  +      (do-batches-for-learner (samples (sampler dbm))
  +        (call-periodic-fn n fn n)
  +        (set-input samples dbm)
  +        (set-hidden-mean dbm)
  +        (loop for image in samples
  +              for stripe upfrom 0 do
  +              (let ((x ()))
  +                (loop for (chunk lump) in map-chunks-and-lumps
  +                      do
  +                      (with-stripes ((stripe chunk chunk-start chunk-end))
  +                        (let ((xxx (make-flt-array
  +                                    (- chunk-end chunk-start))))
  +                          (replace xxx (storage (nodes chunk))
  +                                   :start2 chunk-start :end2 chunk-end)
  +                          (push (list lump xxx) x))))
  +                (setf (gethash image cache) x)))
  +        (incf n (length samples)))
  +      (call-periodic-fn n fn n))))
   
   (defvar *dbn/2*)
   (defvar *dbm/2*)
  
positive.code:                    :dbn-initargs '(:max-n-stripes 100)))
  
  (defun unroll-mnist-dbm (dbm)
    (multiple-value-bind (defs inits) (unroll-dbm dbm)
      (prin1 inits)
      (terpri)
      (make-bpn dbm defs inits 'f2)))
  
negative.code:                         *dbn/1*))))
          (t
           (setq *dbn/1* (make-mnist-dbn/1))
           (init-mnist-dbn *dbn/1* :stddev 0.1)
           (train-mnist-dbn *dbn/1* :n-epochs 50 :learning-rate 0.1
                            :decay 0.0002 :visible-sampling nil)
           (save-weights (merge-pathnames "mnist-1.dbn" *mnist-dir*) *dbn/1*)))
  