您的訂閱是我製作影片的動力
訂閱點這裡~
影片程式碼 (延續昨天)
#演算法
library(ClusterR)
opt_gmm = Optimal_Clusters_GMM(iris_no_na, max_clusters = 10, criterion = "BIC",
dist_mode = "eucl_dist", plot_data = T)
gmm = GMM(iris_no_na, 4, dist_mode = "eucl_dist", em_iter = 10) # EM調參
gmm_out <- as.data.frame(gmm$Log_likelihood) #大好
final <- cbind(iris_no_na,gmm_out)
final <- final %>%
mutate(最大=pmax(V1,V2,V3,V4)) %>%
mutate(分群=ifelse(最大==V1,"c1",
ifelse(最大==V2,"c2",
ifelse(最大==V3,"c3","c4"))))
若內容有誤,還請留言指正,謝謝您的指教