          betas (c/to-vect (c/mmult (pseudo-inverse-matrix H) T))]
      (Model. ass bs betas))))
 
-(defn ^Integer predict  
-  ([^Model model ^clojure.lang.PersistentVector xs]
+(defn predict  
+  ([model xs]
    {:pre [(instance? Model model) (coll? xs)]}
    (predict (:ass model) (:bs model) (:betas model) xs))
-  ([^clojure.lang.PersistentVector ass ^clojure.lang.PersistentVector bs
-    ^clojure.lang.PersistentVector betas ^clojure.lang.PersistentVector 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 ^Number evaluation
-  ([^clojure.lang.PersistentVector results ^clojure.lang.PersistentVector facts]
+(defn evaluation
+  ([results facts]
    {:pre [(coll? results) (coll? facts)]}
    (let [numd (count results)]
      (->> (pmap #(= %1 %2) results facts)


(defrecord Model [ass bs betas])

(defn ^Model train-model
  ([^DataSet dataset ^Integer L & {:keys [^Boolean norm] :or {norm false}}]
   {:pre [(instance? DataSet dataset) (integer? L)]}
   (let [normf (if norm data/normalize identity)
         d (data/num-of-feature dataset)
         ass (make-ass d L)

            [incanter.core :as c :exclude [update]])
  (:import [clj_elm.data DataSet]))

(defn sign
  "The signum function for a real number x."
  ([x]
   {:pre [(number? x)]}
   (cond
     (> x 0) 1
     (= x 0) 0
     :else -1)))

(defn make-weights
  "Make a d-dimension-random-feature vector. d is number of dimention of
   feature. All elements are in [-1,1]"
  ([d]
   {:pre [(integer? d)]}
   (take d (repeatedly #(dec (rand 2))))))

(defn make-ass
  ([d L]
   {:pre [(integer? d) (integer? L)]}
   (take L (repeatedly #(make-weights d)))))

(defn make-bs
  ([L]
   {:pre (integer? L)}
   (take L (repeatedly #(first (make-weights 1))))))

(defn standard-sigmoid
  ([x]
   {:pre [(number? x)]
    :post [(number? %)]}
   (/ 1 (+ 1 (Math/exp (- x))))))
