title: How does one cluster by dissimilarity rather than similarity? Is using inverse Euclidean distance acceptable?
body: <p>I am trying to cluster a suite of products by how <strong>dissimilar</strong> they are rather than by how similar they are.
  That is, if Product1 is selling in Week 1 and not selling in Week 2, I want to pair it with a Product that is not selling in Week 1 but is selling in Week 2.</p>
  
  <p>As the end product, I'd like to present a seaborn clustermap that illustrate the inverse relationship between products. </p>
  
  <p>I have attempted to use the Inverse of Euclidean distance as my clustering metric as opposed to Euclidean distance. to achieve this task.</p>
  
  <p>Sample code below:</p>
  
  <pre><code>import numpy as np
  import seaborn as sns
  import pandas as pd
  
  np.random.seed(0)
  a = np.random.randint(2,size=(5,10))
  </code></pre>
  
  <p>Sample dataframe, Five products with 10 "weeks" of data. 1 = Sales, 0 = No Sales</p>
  
  <pre><code>df = pd.DataFrame(a, 
                    index='Product1 Product2 Product3 Product4 Product5'.split(),
                    columns=np.arange(1,11))
  </code></pre>
  
  <p>Define distance metric, inverse of Euclidean distance:</p>
  
  <pre><code>invEucl = lambda u, v: 1 / np.sqrt(((u-v)**2).sum())
  </code></pre>
  
  <p>Compare clustermaps, Euclidean vs Inverse: </p>
  
  <pre><code>sns.clustermap(df,col_cluster=False)
  
  sns.clustermap(df,
                 col_cluster=False,
                metric=invEucl)
  </code></pre>
  
  <p>The results seem to work graphically, with the clustermap grouping dissimilar items together, but I want to confirm that using something like an Inverse of Euclidean distance is appropriate. </p>
  
  <p>If it is, are you aware of any literature that uses a similar approach?</p>
  
  <p>If not, are there any metrics out there that would be appropriate for this type of analysis? 
  Essentially I am looking for a metric that will assign a lower distance to vectors that are least similar.</p>