2017年4月28日 星期五

melt() 使用時 measure variable 的型態要一致

使用 melt() 來 reshape 資料時, measure variable 的型態要一致,否則會出現警告。

例如有以下的資料:


資料中,subject 欄位為 factor。若使用 subject 為 id.var 進行 melt,則會出現以下警告訊息:


因為,第一個欄位為 Factor 型態,melt() 把後面其他的欄位也視為 Factor,造成轉換時的錯誤。


Reference:
[1] thiagogm, 2013. Reshape and aggregate data with the R package reshape2, www.r-bloggers.com.

2017年4月27日 星期四

ui:debug 和 flash.keep 的衝突

若在 facelet 中使用 ui:debug,則在同一個 facelet 中使用 flash.keep 時無法正常顯示 flash scope 中的變數。

測試資料

References:
[1] ui:debug
[2] Flash class

2017年4月15日 星期六

Expectation-Maximization (EM) Algorithm 介紹


演算法,用來計算混合模型(Mixture Model)下的 Maximum Likelyhood 估計。

混合模型(Mixture Model):
觀察到的資料點(Data Point) 來自於兩個分配(Distribution), 哪些資料點是屬於那個分配呢?




Youtube 影片介紹
EM Algorithm: How it works (1) by Victor Lavrenco
EM Algorithm: How it words (2) by Victor Lavrenco