-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The GMM model does not compile. Here is the full model.
(defn sample-components [_ zs pi]
(let [z (sample (categorical pi))]
(conj zs z)))
(defn observe-data [n _ ys zs mus]
(let [y (get ys n)
z (get zs n)
mu (get mus z)]
(observe (normal mu 2) y)
nil))
(let [ys (vector -2.0 -2.5 -1.7 -1.9 -2.2
1.5 2.2 3 1.2 2.8)
pi [0.5 0.5]
zs (loop 10 (vector) sample-components pi)
mus (vector (sample (normal 0 2))
(sample (normal 0 2)))]
(loop 10 nil observe-data ys zs mus)
(vector mus zs))The model is about clustering N data (ys) into K groups. Here N=10 and K=2. We have RVs of mus with length K and zs with length N. We first sample K prior cluster centers mus. Then for each data ys[n] where n = 1, ... , N, we sample its assignment zs[n] = k where k is an integer between 1 and K, and observe with corresponding mus[k].
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels