I had a basic familiarity with what a U-Matrix is, but I never fully understand something until I can code it and run it. So, during a lunch break I fired up Notepad and created a small Python language demo to illustrate the idea.
The source data for a U-Matrix is a matrix of vector values. For my demo, I created a source matrix with 20 rows and 20 columns, where each cell of the source matrix is a numeric vector with 10 values. I supplied random values for the source matrix but in a non-demo scenario the vectors will usually have some sort of relationship with each other.
A U-Matrix is a matrix with the same shape as the source data. The value in cell [i,j] of the U-Matrix is the average distance of source data cell [i,j] with its four neighbors (above, below, left, right).
In my demo, the visualization of the U-Matrix shows more or less randomness, as you’d expect because the source data is random. But with non-demo data, sometimes patterns appear in the U-Matrix, which can give you insights into the nature of the source data.