You can use the vector of integer cluster numbers with silhouette() from the cluster package.
https://www.rdocumentation.org/packages/cluster/versions/2.1.0/topics/silhouette But note that silhouette as an assessment metric makes roughly the same assumptions that k-means does about the data structure, and may not return useful results with other clustering methods. Sarah On Mon, Sep 9, 2019 at 12:01 PM Nicola Fiedler <nicolafied...@gmx.de> wrote: > > Hi together, > > I’m new using R and have a question concerning the Silhouette coefficient. > I’ve clustered very easy objects with Affinity Propagation. > My data just has one numeric attribute. > > apres <- apcluster(negDistMat(r=2), data, details=TRUE) > show(apres) > > > > This worked very well. To compare with other algorithms I want to know the > Silhouette coefficient. > The function I use for the other algorithms doesn’t work for AP (clvalid or > fviz_nbclust). > So my question is, how I can get the Silhouette coefficient for the > clustering with AP? > > Thank you very much in advance for your help. > -- Sarah Goslee (she/her) http://www.numberwrigtht.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.