I have a dataset of photographs of forms (say 1000 images). Since the forms belong to about 50 different layouts (i.e. templates), I expect the corresponding images to be clustered. I want to visualize these clusters prior to performing any classification or advanced processing.

My approach is to compute a 64-bit hash for each image and reduce to two dimensions before plotting. Conceptually, hash("img001.jpg") = "0100101...1" (64 bits). When applied on all 1000 images, this yields a 1000 x 64 matrix. However, I have doubts about PCA being the right tool for the dimensionality reduction step.

PCA seems appropriate for quantitative-valued matrices with Euclidean distance metric. For hashes, the proper distance metric is different (Hamming distance, for instance). As a result, I'm not sure if the traditional PCA-based visualization would make sense.

What is a more appropriate dimensionality-reduction approach for bit strings with Hamming-like similarity measure? More generally, is there a better approach to visualize clusters of images than my current hash -> dimensionality reduction -> visualization approach?

I've researched (1) Correspondence Analysis and (2) Nonlinear PCA but am yet to find an example applying it to hash-like objects.


Your Answer


Browse other questions tagged or ask your own question.