anchor.diff:                   (or (get-error counter) #.(flt 0))
                    (n-sum-errors counter)
                    n-inputs)
  -        (reset-counter counter)))))
  +        (reset-counter counter)
  +        (when (mgl-bm::sparsity-gradient-sources trainer)
  +          (log-msg "Features average means:~%  ~A~%"
  +                   (features-average-mean trainer))
  +          (matlisp:fill-matrix (features-average-mean trainer) (flt 0)))))))
  +
  +(defmethod initialize-trainer ((trainer test-trainer) (rbm test-rbm))
  +  (call-next-method)
  +  (let ((features (find-chunk 'features rbm)))
  +    (when features
  +      (setf (features-average-mean trainer)
  +            (matlisp:make-real-matrix (size features) 1)))))
   
   (defun test-do-chunk ()
     (let ((chunk (make-instance 'sigmoid-chunk :size 5
  
positive.code:                                       (make-instance 'constant-chunk
                                                       :name 'constant2)))
                                   ,(make-instance hidden-type
                                                   :name 'features :size 1))
                  :clouds (if rank
                              `(:merge
                                (:class factored-cloud
  
negative.code:       (multiple-value-bind (e n) (get-squared-error rbm)
          (add-error counter e n)))
      (get-error counter)))
  
  (defun sum* (matrix)
    (if (= (matlisp:ncols matrix) 1)
        matrix
        (matlisp:sum matrix)))
  
  (defmethod positive-phase (batch (trainer test-trainer) (rbm test-rbm))
    (call-next-method)
    (let ((features (find-chunk 'features rbm)))
      (when features
        (matlisp:m+! (sum* (means features))
                     (features-average-mean trainer)))))
  
  (defmethod train-batch :around (batch (trainer test-trainer) rbm)
    (call-next-method)
  