Created
January 17, 2012 01:55
-
-
Save sritchie/1624059 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn feature-stream [] | |
(repeatedly #(cons 1 (repeatedly 22 rand)))) | |
(defn label-stream [] | |
(repeatedly #(rand-int 2))) | |
(defn profile-log-likelihood | |
[iterations batch-size] | |
(let [beta-seq (repeat 22 0)] | |
(loop [iter iterations | |
labels (take iterations (label-stream)) | |
features (take iterations (feature-stream))] | |
(when (pos? iter) | |
(time (dorun (map (partial log-likelihood beta-seq) | |
(take batch-size labels) | |
(take batch-size features)))) | |
(recur (- iter batch-size) | |
(drop batch-size labels) | |
(drop batch-size features)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment