I modified the following script for Optics clustering ( http://chemometria.us.edu.pl/download/OPTICS.M ) in order to work with DTW distance instead than Euclidean's.

I obtained the Order vector (order), Reachability distances (RD) vector and Core distances (CD) vector.

As I read from Wikipedia (http://en.wikipedia.org/wiki/OPTICS_algorithm#Extracting_the_clusters)

Using a reachability-plot (a special kind of dendrogram), the hierarchical structure of the clusters can be obtained easily. It is a 2D plot, with the ordering of the points as processed by OPTICS on the x-axis and the reachability distance on the y-axis. Since points belonging to a cluster have a low reachability distance to their nearest neighbor, the clusters show up as valleys in the reachability plot. The deeper the valley, the denser the cluster. The image above illustrates this concept. In its upper left area, a synthetic example data set is shown. The upper right part visualizes the spanning tree produced by OPTICS, and the lower part shows the reachability plot as computed by OPTICS. Colors in this plot are labels, and not computed by the algorithm; but it is well visible how the valleys in the plot correspond to the clusters in above data set. The yellow points in this image are considered noise, and no valley is found in their reachability plot. They will usually not be assigned to clusters except the omnipresent "all data" cluster in a hierarchical result.

I can represent the results on a scatter plot using the Order as X-axis, and RD as Y-axis.

How can I obtain a hierarchical dendrogram from my data? How can I obtain a spanning tree from my data (and display it)?

  • $\begingroup$ Consider using ELKI, which was used to make the figure on Wikipedia. It supports DTW out of the box. The Matlab implementations of DBSCAN and OPTICS are said to be of low quality. $\endgroup$ – Has QUIT--Anony-Mousse May 19 '14 at 8:19
  • $\begingroup$ Have a look on this PDF on page 16. osl.iu.edu/~chemuell/projects/presentations/optics-v1.pdf They explain very simply how to construct an hierarchical clustering from a reachability plot. $\endgroup$ – buras Dec 4 '14 at 9:14
  • $\begingroup$ There is an example implementation of OPTICS clustering algorithm on this webpage: mi.eng.cam.ac.uk/~agk34/software.html $\endgroup$ – user69433 Feb 20 '15 at 16:18

Browse other questions tagged or ask your own question.