title: Clustering on tweets
body: <p>I have 800,000 tweets. And i am clustering them as follow:</p>
  
  <pre><code>for i &lt;- 1 to 800,000  
     for j &lt;- i+1 to 800,000  
         if ( dist(i,j) &lt;= threhold_dist){  
                 if (jacard_similarity(i,j) &gt;= threshold_tweetsim){  
                                   cluster them.  
                 }  
         }   
     }  
  }  
  </code></pre>
  
  <p>How I am doing is as follows:</p>
  
  <p>I made a <code>HashMap mp&lt;String1, HashMap&lt;String2, Integer&gt;&gt;</code>
  where String1 is my geocode ("[40.323243 -70.435443]") , String2 is my Hashtag in tweet and Integer is my occurence of that Hashtag.  (This Hashmap is taking only approx. 60 seconds of time.)</p>
  
  <p>Then according to above algorithm:</p>
  
  <p>I am extracting my geocode from Hashmap which is String1 in outer loop and comparing with other geocode in inner loop, according to algo mentioned above.( doing regex and doubleParse for getting my geocodes into numbers)</p>
  
  <p>If geocodes are closer to each other then i am extracting my nested HashMap which contains my Hashtags,
  For threshold_tweetssim, i am checking the minimum lenth of respective Hashtags and overlapping, then divide the overlapping(which is count of my overlapped hashtags) by minimum length of respective tweet.</p>
  
  <p>For each iteration of i am getting again 1.5 second of time. 
  But overall according to my calculation this program will going to take 8 or more days. 
  Can any body suggest me how to do it efficiently or any technique so that i can reduce my time to large extent.  </p>