            (dec iter)
            diff))))))
 
+
+
 (defn estimated-probabilities
   "returns the set of probabilities, after applying the parameter
   values estimated over the training data; both `label-seq` and

  (reduce + (map (partial log-likelihood beta-seq)
                 label-seq
                 feature-mat)))

;; (defn probability-calc
;;   "returns a vector of probabilities for each observation"
;;   [beta-seq feature-mat]
;;   (map (partial logistic-prob beta-seq)
;;        feature-mat))

(defn copy-row
  [^DoubleMatrix row]
  (.copy (to-double-matrix [[]]) row))

(defn in-place-apply-fn
  [f ^DoubleMatrix row-mat]

  (DoubleMatrix.
   (into-array (map double-array mat))))

(defn to-double-rowmat
  [coll]
  (to-double-matrix [(vec coll)]))

(defn copy-row
  [^DoubleMatrix row]
  (.copy (to-double-matrix [[]]) row))

(def bm (to-double-rowmat (repeat 5 1)))
(def ym (to-double-rowmat (interleave (repeat 10 0) (repeat 10 1))))
(defn reshape [v c]
  (if (= (count v) 1)
    c
    (recur (butlast v)
           (partition (last v) c))))
(def feat (reshape '(10 5) (range 100)))
(def Xm (to-double-matrix  feat))

(defn logistic-prob
  [^DoubleMatrix beta ^DoubleMatrix features]
  (logistic-fn
   (.dot beta features)))

;; TODO: convert the functions that are useful but not actually used
;; in estimation, like `log-likelihood` and `total-log-likelihood`.

(defn log-likelihood
  "returns the log likelihood of a given pixel, conditional on its
