matrix row comparison and fetch data with numpy
variety jones
varietyjones10 at gmail.com
Tue Oct 26 07:20:59 EDT 2021
I have 2 matrix with , M and M' , The M' matrix is the result of calculation "order preserving" of the matrix M so i will explain more by examples , so here is the matrix M :
M= np.array([
[15,4,-1,9,10,7],
[-4,2,29,11,98,5],
[101,24,3,19,77,53],
[0,88,34,62,13,-9],
[52,93,44,46,24,125],
[0,17,26,8,87,0],
[103,19,52,173,66,24],
[26,78,123,-5,13,41]
])
so lets take the row L1 from the matrix M so the smallest integer is - 1 so we take the position of -1 from the matrix M which is in the column C3 and write 1 in L1 of the matrix M', and here we go for the other numbers we compare them and take the right order , in case of similarity we give them the same order ,
this part is looking fine i write a program who take a matrix and calculate the order preserving of it and show the results in the second matrix , here is my code :
https://pastebin.com/jpaZfVsB
so the second step is , We will take the columns similar to X% from the matrix M'
In this case there are two conditions : X% = 100% similar
The number of minimum similar columns : 𝑁𝑏𝑟𝑒 𝑐𝑜𝑙 𝑚𝑖𝑛=2
so from the matrix M' we will compare row by row : L1 to L2 , L2 to L 3 until we find similar rows and here is the results :
Seed1= {L1 l2 c2 c4 c6}
Seed2= {L1 l3 c1 c3 c5}
Seed3={L3 l6 c2 c4 c5}
Seed4={L4l6 c3 c6}
Seed5= {L7 l8 c3 c5 c6}
In order to build a bi-group , We must combine the seeds with each other: we will unite the rows of the seed and the intersection of the columns of the seed By respecting: 𝑁𝑏𝑟𝑒 𝑐𝑜𝑙 𝑚𝑖𝑛 = 2
the final results :
Bi-groupe 1={L1 l2 l3 l6 c2 c4}
Bi-groupe2={L1 l3 l7 l8 c3 c5}
Bi-groupe 3={L4 l6 l7 l8 c3 c6}
i just want a function or away to figured out the seeds by rows comparison and show the bi-groupe results
Many Thanks
More information about the Python-list
mailing list