Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn zero-if-nil [m k]
- (let [x (m k)]
- (if (nil? x)
- 0
- x)))
- (defn train [model features]
- (loop [my-model model
- my-features features]
- (if (seq my-features)
- (recur (assoc my-model (first my-features) (+ 1 (zero-if-nil my-model (first my-features)))) (rest my-features))
- my-model)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement