“Statistical results can never be better than the data, whose value depends on the ethnological competence with which they are collected and analyzed. To a large extent trait-count computations merely corroborate the ordinary ethnological findings made by students who know their field comparatively…On the other hand, statistical treatment usually expresses results more precisely and definitely. In all cases examined it also indicates greater or less corrections of the ethnological interpretations. These corrections we believe to be valid.”

-Driver and Kroeber, Quantitative expression of cultural relationships, p 51

Introduction

In many ways, the end goal of the PreciseDist framework is to cluster. Our philosophy though, is that the actual clustering algorithm is the least important step in distance-based-clustering because garbage-in-garbage-out. Although we are tempted to expound much further on our philosophical and technical views concerning the art and science of clustering, we will rather redirect the reader to this insightful paper on cluster reasoning and this interesting Stack Exchange post on the merits and draw-backs of visual clustering (be sure to read the second answer as well as the first).

What we will briefly comment on and show below though, are some of the ways in which we can utilize precise_cluster(), and how valuable visualizations can be at validating clusters, which is exemplified here by use of the trellis_descriptors() function. Of course though, at anytime the user can pull out the results obtained with PreciseDist and use any algorithm they see fit to cluster. Thus, for convenience, we have provided a repository of code that takes distances or similarities as input into the clustering algorithm. Please see the Clustering with Other Algorithms vignette for more details.

Clustering the distance

We will begin by visualizing the distance matrix we just produced without any labels. It will become evident in a moment why we are choosing a 2D plot as our visualization technique rather than a (often) beautiful 3D graph:

As we can see, the visualization of the original matrix without any augmentation does not show any obvious clusters. Let’s cluster the original matrix now, and add on the true labels for reference:

Now that we have our clusters, we will introduce the trellis_descriptors() function to simultaneously map all of our clusters onto the visualization we just produced. It is important to note here, that while we use the results of precise_viz() here as the input visualization, we could use any two column matrix as input, for example, the results of Rtsne() or umap():


We can see that the clusters from the different algorithms map in what seems like a consistent and stable fashion, but with this view it is very hard to know if the clusters are of any potential use. In this instance, there are three obvious solutions: Improve the visualization, add extra descriptors which can explain the clusters or both. First, we will improve the visualization by running the matrix through precise_graph():

Now let’s add the original clusters back on to see how they correlate with our new visualization:


Clustering the graph

There are, of course, other ways to cluster with precise_cluster(). Above, we clustered with the matrix, saw that the clusters perhaps made sense but that the visualization was probably sub-optimal, and then we mapped the clusters onto a superior visualization made by precise_graph() + precise_viz(). Rather than clustering the original matrix, however, we can extract the graph from the above call to precise_graph() and then cluster that:

Now we can map these clusters onto the same visualization we used before to see how the clusterings differ:


In this instance, it seems some of the clusterings probably make more sense while the others make less sense. The important point is that clustering the graph directly gives us additional clustering options, some of which may fit our data more usefully.

Clustering the visualization

The final clustering option that we will show here, is the option to cluster the output of precise_viz() directly, which means we are clustering literally what we see:


This last clustering gives us fairly divergent results compared to the other two methods, but it is arguably the most flexible method because all we have to do is change the visualization to change the clusters. Of course, this should be done with knowledge and caution of what you are trying to accomplish, but there are times when it can be a useful option.

The take-home points

  • There is no right way to cluster, and there is no best clustering method. There are only useful clusterings.

  • trellis_descriptors() provides a useful way of both visualizing the clusterings, and far more importantly, validating them.

  • Of course, there are numerous other ways to cluster. As mentioned at the beginning, take a look at Clustering with Other Algorithms vignette for other potential options.