如何组织一个列表,保持相似性矩阵中相邻元素之间的最小相似性?
我有 24 个样本的清单。对于每个样本,我都有一个向量,其中包含与其他样本的距离。这构成了 24 x 24 相似度矩阵。在该矩阵中,相似度值的范围从0到100,其中100是样本与其自身的相似度值。
这是相似性矩阵的图像(带有树状图)和矩阵的子集
> similarity_matrix[1:10,1:10]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 100 10 15 0 15 50 25 10 25 10
[2,] 10 100 0 20 0 30 10 30 50 70
[3,] 15 0 100 0 15 0 15 0 15 0
[4,] 0 20 0 100 50 20 0 20 0 20
[5,] 15 0 15 50 100 0 15 0 15 0
[6,] 50 30 0 20 0 100 10 30 10 30
[7,] 25 10 15 0 15 10 100 50 25 10
[8,] 10 30 0 20 0 30 50 100 10 30
[9,] 25 50 15 0 15 10 25 10 100 50
[10,] 10 70 0 20 0 30 10 30 50 100
从该相似性矩阵中并选择起始样本 我希望能够生成一个列表,最大限度地减少样本与其两个相邻样本的相似性。
到目前为止我还没有想到一个有效的方法来做到这一点。通过数学运算或使用循环。
I have a list of 24 samples. For each sample I have a vector with the distances to the other samples. This constitutes a 24 by 24 similarity matrix. In this matrix the similarity values range from 0 to 100, where 100 is the similarity value of a sample to itself.
Here's An image of the similarity matrix (with dendrogram) and a subset of the matrix
> similarity_matrix[1:10,1:10]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 100 10 15 0 15 50 25 10 25 10
[2,] 10 100 0 20 0 30 10 30 50 70
[3,] 15 0 100 0 15 0 15 0 15 0
[4,] 0 20 0 100 50 20 0 20 0 20
[5,] 15 0 15 50 100 0 15 0 15 0
[6,] 50 30 0 20 0 100 10 30 10 30
[7,] 25 10 15 0 15 10 100 50 25 10
[8,] 10 30 0 20 0 30 50 100 10 30
[9,] 25 50 15 0 15 10 25 10 100 50
[10,] 10 70 0 20 0 30 10 30 50 100
From this similarity matrix and choosing a starting sample I would like to be able to generate a list that minimises the similarity of a sample to its two adjacent samples.
So far I have not been able to think of an efficient way to do this. Either through mathematical operations or using loops.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道r,但是我猜想您可以做矩阵的第一个索引,然后将模拟性带到其后值和之后。
之后,您只需要对值进行排序,同时跟踪索引获得该值的值。
I dont know R but im guessing you could do just loop the first index of the matrix and get the simularitys to the value befor and after it.
After that you just need to sort the values while keeping track of what index got that value.