         :let [[in-count out-count] (net/get-layer-shape layer)]]
     (m/zero-matrix in-count out-count)))
 
+(defn get-initial-delta-b
+  [net]
+  (for [layer (:layers net)
+        :let [[_ out-count] (net/get-layer-shape layer)]]
+    (m/zero-vector out-count)))
+
 (defn backprop-step-delta
   "Performs forward & backward passes of single data entry.
   Returns vector of [delta-weights delta-biases cost-val] where:
     delta-weights - coll of matrixes of weights deltas for each layer
     delta-biases - coll of vectors of biases deltas for each layer"
-  [net entry e-count t-opts prev-delta-w]
+  [net entry e-count t-opts prev-delta-w prev-delta-b]
   (let [{:keys [input-vec target-vec]} entry
         {:keys [in-node-prob hidden-node-prob]} t-opts
         forward-vecs (forward-pass net input-vec in-node-prob hidden-node-prob)


  Params:
   - deltas-vec - vector of deltas (errors) of current layer"
  [t-opts deltas-vec]
  (m/mul -1
         (:learning-rate t-opts)
         deltas-vec))

(defn get-initial-delta-w
  "Returns collection of matrixes of initial delta weights of layers"

  (let [e-count (count entries)]
    (loop [curr-net start-net
           entry-i 0
           curr-delta-w (get-initial-delta-w curr-net)
           curr-delta-b (get-initial-delta-b curr-net)]
      (if (>= entry-i e-count)
        curr-net
        (let [entry (nth entries entry-i)
              step-result (backprop-step curr-net entry e-count t-opts curr-delta-w curr-delta-b)
              [new-net new-delta-w new-delta-b] step-result]
          (recur new-net (inc entry-i) new-delta-w new-delta-b))))))

(defn train
  "Trains given network on a dataset during multiple epochs.
