Split matrix so that new matrices have equivalent properties
10 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a large 400x2 matrix.
There are 400 items, which have the properties A and B (correspond to the columns).
The goal is to decompose the matrix into 10 matrices of 40 items each, so that in the end I have 40 10x2 matrices.
The matrices should be comparable regarding their mean values per column. Therefore, there is probably an optimization problem here.
The target is that column 1 of the matrices roughly corresponds to the mean value of A and column 2 roughly corresponds to the mean value of B.
In the first step, I randomly decomposed the large matrix into 40 10x2 matrices. This represents the initial position.
I know that I have to swap the rows between the matrices until the target is reached, that is, I have reached the minima (difference between target value and current mean). However, I do not know how to solve this most effectively.
I am looking forward to any tips and suggestions.
Thank you in advance :-)
0 件のコメント
回答 (1 件)
Walter Roberson
2022 年 10 月 25 日
If you only had one value to worry about, then there would be an algorithm:
after you have randomly split the matrix, repeat:
swap the smallest row of the matrix with the smallest mean, with the largest row of the matrix with the largest mean
At the moment I am not sure what the termination condition would be.
However with you having two values to worry about, the general case might be much harder. I am not sure at the moment whether it is always possible; I worry that there might be constructed conditions that cannot be improved, since there is an implication that a linear ordering might have to be imposed on 2d data.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!