           (pmap #(_cross-validate norm-dataset % (+ % (dec groupn)) L))
           (reduce +)          
           (* (/ 1 k))))))
-

    :post [(number? %)]}
   (dec (/ 2 (+ 1 (Math/exp (- x)))))))

(defn ^Number g
  ([^Number x]
   (standard-sigmoid x)))

(defn ^Number a-hidden-layer-output
  "Return output of hidden-layer_i with xs. As_i is d-dimension. B_i is number.
   Xs is d-dimension."
  ([^clojure.lang.PersistentVector as_i ^Number b_i ^clojure.lang.PersistentVector xs]
   {:pre [(coll? as_i) (number? b_i) (coll? xs)]}
   (g (+ (c/inner-product as_i xs)
         b_i))))

(defn ^clojure.lang.PersistentVector hidden-layer-output-matrix
  "Ass is d-L-dimension. Xss is d-L-dimesion. Bs is L-dimension."
  ([^clojure.lang.PersistentVector ass ^Number bs ^clojure.lang.PersistentVector xss]
   {:pre [(coll? ass) (coll? (first ass)) (number? (first (first ass)))
          (coll? bs) (number? (first bs))
          (coll? xss) (coll? (first xss))]
    :post [(= (count (first %)) (count ass)) (= (count %) (count xss))]}
   (pmap (fn [xs_i] (pmap #(a-hidden-layer-output %1 %2 xs_i) ass bs)) xss)))

(defn ^clojure.lang.PersistentVector pseudo-inverse-matrix
  ([^clojure.lang.PersistentVector mat]
   {:pre [(coll? mat) (coll? (first mat))]}
   (let [matrix (c/matrix mat)
         transmat (c/trans matrix)

         betas (c/to-vect (c/mmult (pseudo-inverse-matrix H) T))]
     (Model. ass bs betas))))

(defn predict  
  ([model xs]
   {:pre [(instance? Model model) (coll? xs)]}
   (predict (:ass model) (:bs model) (:betas model) xs))
  ([ass bs betas xs]
   {:pre [(coll? ass) (coll? (first ass)) (coll? bs) (coll? betas) (coll? xs)]}
   (-> (pmap #(* %1 (a-hidden-layer-output %2 %3 xs)) betas ass bs)
       (c/sum)
       (sign))))

(defn evaluation
  ([results facts]
   {:pre [(coll? results) (coll? facts)]}
   (let [numd (count results)]
     (->> (pmap #(= %1 %2) results facts)
