User Tools

Site Tools


cs401r_w2016:lab9

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cs401r_w2016:lab9 [2018/03/16 20:24]
wingated
cs401r_w2016:lab9 [2018/03/26 18:08]
sadler [Hints:]
Line 120: Line 120:
  
 # topic distributions # topic distributions
-topics ​= np.zeros((V,​K))+bs = np.zeros((V,​K)) + (1/V)
 # how should this be initialized?​ # how should this be initialized?​
  
 # per-document-topic distributions # per-document-topic distributions
-pdtm = np.zeros((K,​D)) ​ +pis = np.zeros((K,​D)) ​+ (1/K)
 # how should this be initialized?​ # how should this be initialized?​
  
 for iters in range(0,​100):​ for iters in range(0,​100):​
-    p = compute_data_likelihood( docs_i, qs, topicspdtm +    p = compute_data_likelihood( docs_i, qs, bspis
-    print "Iter %d, p=%.2f"​ % (iters,p)+    print("Iter %d, p=%.2f"​ % (iters,p))
  
-    # resample per-word topic assignments ​qs+    # resample per-word topic assignments ​bs
  
-    # resample per-document topic mixtures ​pdtm+    # resample per-document topic mixtures ​pis
  
     # resample topics     # resample topics
cs401r_w2016/lab9.txt · Last modified: 2021/06/30 23:42 (external edit)