2

Let's assume a pivot table $P$ of shape $m\times n$ where $p_{i,j}$ is number of coincidences of $i$ and $j$.

I would like to have to permute the columns and rows to see some blocks of similarity.

Some artificial data generated in the following code:

import matplotlib
import numpy as np 
import matplotlib.pyplot as plt
m=50
n=100
P = np.zeros([m,n])
for i in range(10):
    P[i*5:((i+1)*5),i*10:((i+1)*10)]=1
permute_rows = np.random.permutation(m).tolist()
permute_columns = np.random.permutation(n).tolist()
P_to_solve = P[np.ix_(permute_rows, permute_columns)]
fig,[ax1,ax2] = plt.subplots(2)
ax1.imshow(P_to_solve)
ax1.set_ylabel('What I have')
ax2.imshow(P)
ax2.set_ylabel('What I want')

enter image description here

amoeba
  • 93,463
  • 28
  • 275
  • 317
Karel Macek
  • 2,463
  • 11
  • 23

1 Answers1

1

One of the biclustering algorithms might be useful. It finds simultaneous permutations of rows and columns which increase blocks' intra-similarities.

Ami Tavory
  • 4,410
  • 11
  • 20
  • How could one produce a "yellow block along one of the edges" via row and column permutations of the original matrix? – whuber Sep 26 '17 at 20:06