Nikhil
Nikhil

Reputation: 1

Different Distance Matrix with Different Linkage used in Hierarchical Clustering

How can we get quickly result from Hierarchical clustering using different distance matrix and linkage method in R?

Upvotes: 0

Views: 48

Answers (1)

Nikhil
Nikhil

Reputation: 1

I got the answer, we can write custom function with which can handle this type of problem in R and with little bit change in python as well.

hierarchical_clust <- function(orig_data_frame,x1,x2,n)
{
 y= dist(orig_data_frame,method =x1)
 fit <- hclust(y,method=x2)
 groups <- cuttree(fit,n)
 clust_centers <- aggregate(orig_data_frame,list(groups),mean)

}

   

Upvotes: 0

Related Questions