             [incanter.core :as c :exclude [update]])
   (:import [clj_elm.data DataSet]))
 
-(defn ^Number sign
+(defn sign
   "The signum function for a real number x."
-  ([^Number x]
+  ([x]
    {:pre [(number? x)]}
    (cond
      (> x 0) 1
      (= x 0) 0
      :else -1)))
 
-(defn ^clojure.lang.PersistentVector make-weights
+(defn make-weights
   "Make a d-dimension-random-feature vector. d is number of dimention of
    feature. All elements are in [-1,1]"
-  ([^Integer d]
+  ([d]
    {:pre [(integer? d)]}
    (take d (repeatedly #(dec (rand 2))))))
 
-(defn ^clojure.lang.PersistentVector make-ass
-  ([^Integer d ^Integer L]
+(defn make-ass
+  ([d L]
    {:pre [(integer? d) (integer? L)]}
    (take L (repeatedly #(make-weights d)))))
 
-(defn ^clojure.lang.PersistentVector make-bs
-  ([^Integer L]
+(defn make-bs
+  ([L]
    {:pre (integer? L)}
    (take L (repeatedly #(first (make-weights 1))))))
 
-(defn ^Number standard-sigmoid
-  ([^Number x]
+(defn standard-sigmoid
+  ([x]
    {:pre [(number? x)]
     :post [(number? %)]}
    (/ 1 (+ 1 (Math/exp (- x))))))

          (count)
          (#(/ % numd))))))

(defn ^Number _cross-validate
  ([^DataSet dataset ^Integer a ^Integer b ^Integer L]
   {:pre [(instance? DataSet dataset) (integer? a) (integer? b) (> b a)]}
   (let [test (DataSet. (data/extract-list (:classes dataset) a b)
                        (data/extract-list (:features dataset) a b))

         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)
