anchor.diff:      (prediction (make-softmax f3))))
   
   (defun train-mnist/5 (&key training test quick-run-p bpn-var bpn-filename)
  -  (with-example-log ()
  -    (repeatably ()
  -      (log-msg "TRAIN-MNIST/5~%")
  -      (let ((bpn nil))
  -        (setq* (bpn bpn-var) (build-max-channel-mnist-bpn))
  -        (init-bpn-weights bpn :stddev 0.01)
  -        (train-mnist-bpn-gd bpn training test
  -                            :n-softmax-epochs 0
  -                            :n-epochs (if quick-run-p 2 3000)
  -                            :learning-rate 1
  -                            :learning-rate-decay 0.998
  -                            :l2-upper-bound (sqrt 3.75)
  -                            :input-weight-penalty 0.000001
  -                            :batch-size 96)
  -        (when (and bpn-filename (not quick-run-p))
  -          (save-weights bpn-filename bpn))))))
  +  (with-cuda* ()
  +    (with-example-log ()
  +      (repeatably ()
  +        (log-msg "TRAIN-MNIST/5~%")
  +        (let ((bpn nil))
  +          (setq* (bpn bpn-var) (build-max-channel-mnist-bpn))
  +          (init-bpn-weights bpn :stddev 0.01)
  +          (train-mnist-bpn-gd bpn training test
  +                              :n-softmax-epochs 0
  +                              :n-epochs (if quick-run-p 2 3000)
  +                              :learning-rate 1
  +                              :learning-rate-decay 0.998
  +                              :l2-upper-bound (sqrt 3.75)
  +                              :input-weight-penalty 0.000001
  +                              :batch-size 96)
  +          (when (and bpn-filename (not quick-run-p))
  +            (save-weights bpn-filename bpn)))))))
    
   
  
positive.code: 
  (defun train-mnist/1 (&key training test load-dbn-p quick-run-p dropoutp
                        dbn-var bpn-var dbn-filename bpn-filename)
    (with-example-log ()
      (log-msg "TRAIN-MNIST/1 :DROPOUTP ~S~%" dropoutp)
      (let ((dbn nil)
            (bpn nil))
        (cond (load-dbn-p
               (repeatably ()
                 (setq* (dbn dbn-var) (make-instance 'mnist-dbn/1))
                 (load-weights dbn-filename dbn)
                 (log-msg "Loaded DBN~%")
                 (log-padded
                  (monitor-dbn-mean-field-reconstructions
                   (make-sampler test) dbn
                   (make-reconstruction-monitors dbn)
                   :set-visible-p t))))
              (t
               (repeatably ()
                 (setq* (dbn dbn-var) (make-instance 'mnist-dbn/1))
                 (init-mnist-dbn dbn :stddev 0.1)
                 (train-mnist-dbn dbn training test
                                  :n-epochs (if quick-run-p 2 50) :n-gibbs 1
                                  :start-level 0 :learning-rate 0.1
                                  :decay 0.0002 :visible-sampling nil)
                 (unless quick-run-p
                   (save-weights dbn-filename dbn)))))
        (repeatably ()
          (setq* (bpn bpn-var) (unroll-mnist-dbn/1 dbn))
          (cond (dropoutp
                 (train-mnist-bpn-gd bpn training test
                                     :n-softmax-epochs (if quick-run-p 1 10)
                                     :n-epochs (if quick-run-p 2 1000)
                                     :learning-rate 1
                                     :learning-rate-decay 0.998
                                     :l2-upper-bound nil
                                     :set-dropout-p t
                                     :rescale-on-dropout-p t)
                 (unless quick-run-p
                   (save-weights bpn-filename bpn)))
                (t
                 (train-mnist-bpn-cg bpn training test
                                     :n-softmax-epochs (if quick-run-p 1 5)
                                     :n-epochs (if quick-run-p 2 37))
                 (unless quick-run-p
                   (save-weights bpn-filename bpn)))))
        (values bpn dbn))))
  
  
  
negative.code:     (prediction (make-softmax f2))))
  
  (defun train-mnist/4 (&key training test quick-run-p bpn-var bpn-filename)
    (with-cuda* ()
      (with-example-log ()
        (repeatably ()
          (log-msg "TRAIN-MNIST/4~%")
          (let ((bpn nil))
            (setq* (bpn bpn-var) (build-maxout-mnist-bpn))
            (init-bpn-weights bpn :stddev 0.01)
            (train-mnist-bpn-gd bpn training test
                                :n-softmax-epochs 0
                                :n-epochs (if quick-run-p 2 3000)
                                :learning-rate 1
                                :learning-rate-decay 0.998
                                :l2-upper-bound (sqrt 3.75)
                                :input-weight-penalty 0.000001
                                :batch-size 96)
            (when (and bpn-filename (not quick-run-p))
              (save-weights bpn-filename bpn)))))))
  
  
  