Marvins.seins Marvins.seins - 1 year ago 111
R Question

NMI from external clustering

I want to compare the Normalized Mutual Inforamtion of different clustering solutions. Those clustering solutions come form different sources but I want to compare them with NMI.

I know there is the compare() function in igraph, but that needs the objects to be of class communities.

From the help file: Compares community structures using various metrics.

Now is there an as.communities or as_communities command or someway to get the NMI of two matrixes.

karate <- graph.famous("Zachary")

igraph_community <- cluster_infomap(karate)

v <- as.vector(V(karate))
external <- cbind (v, c(rep(1,10),rep(2,10),rep(3,14)) )

compare(igraph_community,external, method = "nmi" )

Which throws an error.

Answer Source

compare looks for either a communities object or a vector. Right now, you are sending it a 2 x n matrix in external. Subset it to just the vector of community membership:

compare(igraph_community,external[,2], method = "nmi" )
[1] 0.3105313
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download