Examples of SimilarityMatrix


Examples of de.lmu.ifi.dbs.elki.evaluation.similaritymatrix.ComputeSimilarityMatrixImage.SimilarityMatrix

        }
        img.setRGB(x, y, col);
        img.setRGB(y, x, col);
      }
    }
    SimilarityMatrix smat = new ComputeSimilarityMatrixImage.SimilarityMatrix(img, relation, ids);
    database.getHierarchy().add(database, smat);

    VisualizerContext context = vispar.newContext(database);

    // Attach visualizers to results
View Full Code Here

Examples of uk.ac.cam.ch.wwmm.ptc.experimental.termsimilarity.SimilarityMatrix

    List<String> dfl = StringTools.getSortedList(docFreqs);
    int maxSize = 20000;
    if(dfl.size() > maxSize) dfl = dfl.subList(0, maxSize);
    System.out.println("Have " + dfl.size() + " terms");
   
    SimilarityMatrix sm = new SimilarityMatrix(dfl);
    for(int i=0;i<dfl.size();i++) {
      for(int j=i+1;j<dfl.size();j++) {
        sm.setSimilarity(i, j, (float)wordSimilarity(dfl.get(i), dfl.get(j)));
      }
    }
    System.out.println("Similarity matrix made");
    QTClusterer qt = new QTClusterer(sm);
    qt.makeClusters(0.5);
View Full Code Here

Examples of uk.ac.cam.ch.wwmm.ptc.experimental.termsimilarity.SimilarityMatrix

      vectors.add(vector);
    }
    System.out.println("Read vectors in: " + (System.currentTimeMillis() - time));
    time = System.currentTimeMillis();

    SimilarityMatrix sm = new SimilarityMatrix(docFiles);
   
    int goodCosines = 0;
    int totalCosines = 0;
    for(int i=0;i<vectors.size();i++) {
      for(int j=i+1;j<vectors.size();j++) {
        double cosine = cosine(vectors.get(i), vectors.get(j));
        sm.setSimilarity(i, j, (float)cosine);
        if(cosine > 0.05) goodCosines++;
        totalCosines++;
      }
    }
    System.out.println("Fraction of pairwise similarities: " + goodCosines * 1.0 / totalCosines);
View Full Code Here

Examples of uk.ac.cam.ch.wwmm.ptc.experimental.termsimilarity.SimilarityMatrix

   
    time = System.currentTimeMillis();
    if(true) {   
      Set<Integer> assigned = new HashSet<Integer>();
      Matrix docMatrix = svdh.getVt().transpose();
      SimilarityMatrix simMatrix = new SimilarityMatrix(docFiles);
      for(int i=0;i<docFiles.size();i++) {
        for(int j=i+1;j<docFiles.size();j++) {
          simMatrix.setSimilarity(i, j, (float)cosine(docMatrix, i, j, svals));
          //simMatrix.setSimilarity(i, j, (float)tanimoto(docMatrix, i, j, svals));
        }
      }
      //System.out.println(Math.min(svals.length, docMatrix.getRowDimension()));
      //VirtualSimilarityMatrix simMatrix = new VirtualSimilarityMatrix(docMatrix, docFiles, Math.min(svals.length, docMatrix.getRowDimension()-1));
View Full Code Here

Examples of uk.ac.cam.ha293.tweetlabel.eval.SimilarityMatrix

  public static void similarityStuff() {
    String[] topicTypes = {"alchemy","calais","textwiseproper"};
    double[] alphas = {0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0};
   
    for(double alpha : alphas) {
      SimilarityMatrix lda = SimilarityMatrix.load("lda-50-1000-100-"+alpha);
      for(String topicType : topicTypes) {
        SimilarityMatrix llda = SimilarityMatrix.load("llda-"+topicType+"-"+alpha);
        System.out.println(topicType+"\t"+alpha+"\t"+SpearmanRank.srcc(lda,llda));
      }
    }

   
View Full Code Here

Examples of uk.ac.cam.ha293.tweetlabel.eval.SimilarityMatrix

  public static void srccKFinder(String topicType, double alpha) {
    System.out.println("Finding optimal SRCC K for "+topicType+" "+alpha);
    String[] topics = Tools.getTopics(topicType);
    int maxK = topics.length;
    for(int k=1; k<=maxK; k++) {
      SimilarityMatrix baseline = new SimilarityMatrix(2506);
      baseline.fillRestricted(true, topicType, k, 0);
      SimilarityMatrix llda = new SimilarityMatrix(2506);
      llda.fillRestricted(false, topicType, k, alpha);
      System.out.println(alpha+","+topicType+","+k+","+SpearmanRank.jscSRCC(baseline, llda));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.