title: Implementing a custom agglomerative algorithm from scratch
body: <p>I know about agglomerative clustering algorithms, the way it starts with each data point as individual clusters and then combines points to form clusters. </p>
  
  <p>Now, I have a <em>n</em> dimensional space and several data points that have values across each of these dimensions. I want to cluster two points/clusters based on business rules like:</p>
  
  <ul>
  <li>Cluster two points c1 and c2 if the distance between the clusters across dimension 1 is &lt; T1, and the distance across dimension 2 &lt; T2, ... and distance across dimension n &lt; Tn. </li>
  <li>If the rule across dimension 1 is met and rule across dimension 2 is met, then cluster them without bothering about the other dimensions...</li>
  </ul>
  
  <p>.... and similar custom rules.</p>
  
  <p>In addition, I have my own way of defining and measuring the distance between any two clusters in any particular dimension. The dimension may be holding just strings, and I want to define my own string distance metric. In another dimension, it may hold names of locations, and the distance between the two points along this dimension is the geographical distance between location named, and so on for other dimensions as well.</p>
  
  <p>Is there a framework/software that lets me implement this way of defining custom distance metrics, and then to implement agglomerative clustering? Of course, the agglomerative clustering stops when the business rules are not met at any point of time, and we have clusters formed in the n dimensional space at the end.</p>
  
  <p>Thanks
  Abhishek S</p>