问题
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