Silhouette plot is not working for more than 200 rows of data

旧巷老猫 提交于 2021-02-10 16:21:17

问题


I am trying to plot the silhouette for my k-means, using shiny. Below is the piece of code:

dissE <- daisy(pima_diabetes_kmean[, c(input$models_to_consider)])
dE2   <- dissE ^ 2
sk2   <- silhouette(k.means.fit.knn()$cl, dE2)
plot(sk2)

It results in the following plot, where clusters are missing:

However, if I change the code to use only 200 rows of data (or use window()), it does work. But I do not want my results in a separate window, as I am using shiny. I want the results to be on the same page, where rest of results are.

dissE <- daisy(pima_diabetes_kmean[1:200, c(input$models_to_consider)])
dE2 <- dissE ^ 2
sk2 <- silhouette(k.means.fit.knn()$cl[1:200], dE2)
plot(sk2)


回答1:


I had the same issue. I exported it to a pfd file and then you could see all the observations their width. The maximum number of observations I tried was 1148 and it worked.



来源:https://stackoverflow.com/questions/43533823/silhouette-plot-is-not-working-for-more-than-200-rows-of-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!