anchor.diff:  ;;;; DBN-to-DBM-to-BPN
   ;;;;
   ;;;; A 784-500-1000 DBM is pretrained as a DBN then the DBM is
  -;;;; translated to a BPN. It's pretty much the same training process.
  +;;;; translated to a BPN. It's pretty much the same training process
  +;;;; except that after the DBN the DBM is trained by PCD before
  +;;;; unrolling that into a BPN. Accuracy is ~99.09% a bit higher than
  +;;;; the reported 99.05%.
   
   (in-package :mgl-example-mnist)
   
  
positive.code: 
  (defun train-mnist-bpn (bpn &key (batch-size
                                    (min (length *training-images*) 1000))
                          n-epochs)
    (log-msg "Starting to train the softmax layer of BPN~%")
    (train (make-sampler *training-images*
                         :max-n (* 5 (length *training-images*))
                         :omit-label-p t)
           (make-instance 'mnist-cg-bp-trainer
                          :cg-args (list :max-n-line-searches 3)
  
negative.code:          bpn)
    (log-msg "Starting to train the whole BPN~%")
    (train (make-sampler *training-images*
                         :max-n (* (- n-epochs n-softmax-epochs)
                                   (length *training-images*))
                         :omit-label-p t)
           (make-instance 'mnist-cg-bp-trainer
                          :cg-args (list :max-n-line-searches 3)
                          :batch-size batch-size)
           bpn))
  
  