     (.mmul (.transpose feature-mat)
            (.transpose (.sub labels prob-seq)))))
 
-;; (defn score-seq
-;;   "returns the scores for each parameter"
-;;   [beta-seq label-seq feature-mat]
-;;   (let [prob-seq (probability-calc beta-seq feature-mat)
-;;         features (to-double-matrix feature-mat)]
-;;     (.mmul (.transpose features)
-;;            (DoubleMatrix.
-;;             (double-array
-;;              (map - label-seq prob-seq))))))
-
-(defn to-double-rowmat
-  [coll]
-  (to-double-matrix [(vec coll)]))
-
-(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))
 ;; (score-seq b lab feat)
 ;; #<DoubleMatrix [-450.0; -459.9999546021313; -469.9999092042626; -479.9998638063939; -489.9998184085252]>
 

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

;; (defn logistic-prob
;;   "returns the probability of a binary outcome given a parameter
;;   vector `beta-seq` and a feature vector for a given observation"
;;   [beta-seq feature-seq]
;;   (logistic-fn (dot-product beta-seq feature-seq)))

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


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

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

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