Package com.clearnlp.util.pair

Examples of com.clearnlp.util.pair.IntDoublePair


 
  /** Each cluster contains indices of {@link Kmeans#v_units}. */
  private List<List<IntDoublePair>> getClusters()
  {
    List<List<IntDoublePair>> cluster = new ArrayList<List<IntDoublePair>>(K);
    IntDoublePair max = new IntDoublePair(-1, -1);
    int[] unit;
    int i, k;  double sim;
   
    for (k=0; k<K; k++)
      cluster.add(new ArrayList<IntDoublePair>());
   
    System.out.print("Clustering: ");
   
    for (i=0; i<N; i++)
    {
      unit = v_units.get(i);
      max.set(-1, -1);
     
      for (k=0; k<K; k++)
      {
        if ((sim = cosine(unit, k)) > max.d)
          max.set(k, sim);
      }
     
      cluster.get(max.i).add(new IntDoublePair(i, max.d));
      if (i%10000 == 0System.out.print(".");
    }
   
    System.out.println();
   
View Full Code Here

TOP

Related Classes of com.clearnlp.util.pair.IntDoublePair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.