Computer Vision News - December 2020

The value in the SOM ( v ) corresponds to the current U-Matrix cell. Every adjacent cell in the SOM (above, below, left, right) is processed and the sum of the Euclidean distances is computed: To visualize what is happening for a cell in the SOM with value (2.0, 1.0, 1.5, 0.7) and the Euclidean distances to the four neighbor cells are 7.0, 12.5, 11.5, 5.0, then the corresponding cell in the U-Matrix holds 36.0 before averaging and then 9.0 after averaging: When the value in U-Matrix is small, it means that: the A small value in a U-Matrix cell indicates that the relative cell in the SOM is very near to its neighbors and therefore the neighboring cells are part of a similar group. The U-Matrix is displayed: Visualize the dimensionality reduction When the data has class labels (as in the previous example), the SOM is able to reduce the dimensionality, so that data can be visualized and represented as a two- dimensional graph. The code to do this is shown below: The class label is associated to each cell depending on the proximity of the corresponding cell in the SOM and then it’s added to the cell list: Computer Vision Tool 14 if i- 1 >= 0 : # above sum_dists += euc_dist(v, map[i- 1 ][j]) ct += 1 if i+ 1 <= Rows- 1 : # below sum_dists += euc_dist(v, map[i+ 1 ][j]) ct += 1 if j- 1 >= 0 : # left sum_dists += euc_dist(v, map[i][j- 1 ]) ct += 1 if j+ 1 <= Cols- 1 : # right sum_dists += euc_dist(v, map[i][j+ 1 ]) ct += 1 u_matrix[i][j] = sum_dists / ct plt.imshow(u_matrix, cmap='gray') plt.show() print ("Assign data labels to map nodes") mapping = np.empty(shape=(rows, cols), dtype=object) for i in range(rows): for j in range(cols): mapping[i][j] = [] for t in range(len(data_x)): (m_row, m_col) = closest_node(data_x, t, map, rows, cols) mapping[m_row][m_col].append(data_y[t])

RkJQdWJsaXNoZXIy NTc3NzU=