Calculating weights for a Cluster matrix
1
0
Entering edit mode
9.3 years ago
pbio ▴ 150

Hi All,

I have a clustered matrix, but now I need to give some weights to the matrix based on the important nodes.

Suppose A and B are the two nodes in the cluster, I want to check and calculate the distance between the nodes in the cluster by giving weights to each node of the cluster.

Is there any R package to weight the nodes of the cluster. The cluster is in the form of a matrix.

Even I am not much clear about it. I just need some idea to go green with such analysis.

Any suggestions or naming any R packages would be surely of great help!

Thanks!

R matrix • 4.3k views
ADD COMMENT
0
Entering edit mode

You should describe more what you're trying to do. Which weighting scheme you use ultimately depends on what you're trying to achieve with it. Thus, any weighting scheme will be based on some assumptions about the data and/or its context e.g. you can weight items based on their frequency in the data or based on when/how the data was collected.

ADD REPLY
1
Entering edit mode
9.0 years ago

hclust is a built in R function used for clustering. The members parameter offers an easy way to add weights to the matrix.

First you calculate the distances between your raw values:

vals = as.matrix(raw_data)
distance.col = dist(vals, method = "euclidean")

Then you cluster the distance matrix. The "methods" argument is where you put a vector of weighted values corresponding to the columns of your raw_data matrix.

cluster.col = hclust(distance.col, method = "average", members = weights)
ADD COMMENT

Login before adding your answer.

Traffic: 1258 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6