Package uk.ac.cam.ha293.tweetlabel.topics

Examples of uk.ac.cam.ha293.tweetlabel.topics.FullLLDAClassification


      //System.out.println(totalCount);
      Set<String> lldaTopicSet = new HashSet<String>();
      Set<String> baselineTopicSet = new HashSet<String>();
      String modTopic = topicType;
      if(modTopic.equals("textwise")) modTopic = "textwiseproper";
      FullLLDAClassification llda = new FullLLDAClassification(modTopic,alpha,fewerProfiles,reduction,uid);
      if(llda.getCategorySet().isEmpty()) continue;
      totalCount++;
      int kCount=0;
      for(String topic : llda.getCategorySet()) {
        if(kCount == k) break;
        kCount++;
        lldaTopicSet.add(topic);
      }
      if(topicType.equals("alchemy")) {
View Full Code Here


    int cosineCount = 0;
    double squareSum = 0.0;
    for(Long uid : uids) {
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification baseline = new FullAlchemyClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,uid);
        double sim = inferred.cosineSimilarity(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("calais")) {
        FullCalaisClassification baseline = new FullCalaisClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,uid);
        double sim = inferred.cosineSimilarity(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("textwise")) {
        FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
        FullLLDAClassification inferred = new FullLLDAClassification("textwiseproper",alpha,uid);
        double sim = inferred.cosineSimilarity(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      }
      //System.out.println("UID:"+uid+", CS:"+sim);
View Full Code Here

    int cosineCount = 0;
    double squareSum = 0.0;
    for(Long uid : uids) {
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification baseline = new FullAlchemyClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,uid);
        double sim = cosineKSimilarity(baseline,inferred,k);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("calais")) {
        FullCalaisClassification baseline = new FullCalaisClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,uid);
        double sim = cosineKSimilarity(baseline,inferred,k);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("textwise")) {
        FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
        FullLLDAClassification inferred = new FullLLDAClassification("textwiseproper",alpha,uid);
        double sim = cosineKSimilarity(baseline,inferred,k);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      }
 
View Full Code Here

    int cosineCount = 0;
    double squareSum = 0.0;
    for(Long uid : uids) {
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification baseline = new FullAlchemyClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,fewerProfiles,reduction,uid);
        if(inferred.getCategorySet().isEmpty()) continue;
        double sim = inferred.cosineSimilarity(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("calais")) {
        FullCalaisClassification baseline = new FullCalaisClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,fewerProfiles,reduction,uid);
        if(inferred.getCategorySet().isEmpty()) continue;
        double sim = inferred.cosineSimilarity(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("textwise")) {
        FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
        FullLLDAClassification inferred = new FullLLDAClassification("textwiseproper",alpha,fewerProfiles,reduction,uid);
        if(inferred.getCategorySet().isEmpty()) continue;
        double sim = inferred.cosineSimilarity(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      }
      //System.out.println("UID:"+uid+", CS:"+sim);
View Full Code Here

    int cosineCount = 0;
    double squareSum = 0.0;
    for(Long uid : uids) {
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification baseline = new FullAlchemyClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,fewerProfiles,reduction,uid);
        if(inferred.getCategorySet().isEmpty()) continue;
        double sim = cosineKSimilarity(baseline,inferred,k);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("calais")) {
        FullCalaisClassification baseline = new FullCalaisClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,fewerProfiles,reduction,uid);
        if(inferred.getCategorySet().isEmpty()) continue;
        double sim = cosineKSimilarity(baseline,inferred,k);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("textwise")) {
        FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
        FullLLDAClassification inferred = new FullLLDAClassification("textwiseproper",alpha,fewerProfiles,reduction,uid);
        if(inferred.getCategorySet().isEmpty()) continue;
        double sim = cosineKSimilarity(baseline,inferred,k);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      }
 
View Full Code Here

        averageTopicCosinesSum.put(setName, sim);
        averageTopicCosinesCount.put(setName, 1);
      }
     
      //work out top-topic, does it match?
      FullLLDAClassification llda = new FullLLDAClassification(topicType,alpha,uid);
      if(llda.getCategorySet().size()==0) continue;
      String topTopic = llda.getCategorySet().toArray(new String[0])[0];
      if(topTopic.equals(userSetLookup.get(uid))) {
        //managed to correctly infer the most prominent topic
        if(correctTopTopicClassifications.containsKey(topTopic)) {
          correctTopTopicClassifications.put(topTopic, correctTopTopicClassifications.get(topTopic)+1);
        } else {
View Full Code Here

          PrintWriter writeOut = new PrintWriter(fileOut);
          writeOut.println("\"uid\",\"similarity\"");
          if(topicType.equals("alchemy")) {
            for(long uid : uids) {
              FullAlchemyClassification baseline = new FullAlchemyClassification(uid);
              FullLLDAClassification llda = new FullLLDAClassification(topicType,alpha,uid);
              writeOut.println(uid+","+llda.cosineSimilarity(baseline));
            }
          } else if(topicType.equals("calais")) {
            for(long uid : uids) {
              FullCalaisClassification baseline = new FullCalaisClassification(uid);
              FullLLDAClassification llda = new FullLLDAClassification(topicType,alpha,uid);
              writeOut.println(uid+","+llda.cosineSimilarity(baseline));
            }
          } else if(topicType.equals("textwise")) {
            for(long uid : uids) {
              FullTextwiseClassification baseline = new FullTextwiseClassification(uid,false);
              FullLLDAClassification llda = new FullLLDAClassification(topicType,alpha,uid);
              writeOut.println(uid+","+llda.cosineSimilarity(baseline));
            }
          }else if(topicType.equals("textwiseproper")) {
            for(long uid : uids) {
              FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
              FullLLDAClassification llda = new FullLLDAClassification(topicType,alpha,uid);
              writeOut.println(uid+","+llda.cosineSimilarity(baseline));
            }
          }
          writeOut.close();
          fileOut.close();
        }
View Full Code Here

    int cosineCount = 0;
    for(Long uid : uids) {
      //System.out.println(cosineCount);
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification baseline = new FullAlchemyClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,uid);
        double sim = inferred.jsDivergence(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("calais")) {
        FullCalaisClassification baseline = new FullCalaisClassification(uid);
        FullLLDAClassification inferred = new FullLLDAClassification(topicType,alpha,uid);
        double sim = inferred.jsDivergence(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      } else if(topicType.equals("textwise")) {
        FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
        FullLLDAClassification inferred = new FullLLDAClassification("textwiseproper",alpha,uid);
        double sim = inferred.jsDivergence(baseline);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
      }
      //System.out.println("UID:"+uid+", CS:"+sim);
View Full Code Here

        FullSVMClassification svmClassification = new FullSVMClassification(topicType,uid);
        String topSVMTopic = svmClassification.getCategorySet().toArray(new String[1])[0];
        gtTopicSets.get(topTopic).add(uid);
        lldaTopicSets.get(topSVMTopic).add(uid);
      } else {
        FullLLDAClassification llda = new FullLLDAClassification(topicType,alpha,uid);
        if(topicType.equals("textwise")) llda = new FullLLDAClassification("textwiseproper",alpha,uid);
        String topLLDATopic = llda.getCategorySet().toArray(new String[1])[0];
        gtTopicSets.get(topTopic).add(uid);
        lldaTopicSets.get(topLLDATopic).add(uid);
      }
    }
   
View Full Code Here

 
  public void fillSVM(String topicType) {
    System.out.println("Filling from SVM "+topicType+" classifications");
    FullSVMClassification[] classifications = new FullSVMClassification[d];
    for(long id : Tools.getCSVUserIDs()) {
      classifications[indexLookup.get(id)] = new FullSVMClassification(topicType,id);
    }
   
    //cosine similarities!
    for(int m=0; m<d; m++) {
      System.out.println("On row "+m);
View Full Code Here

TOP

Related Classes of uk.ac.cam.ha293.tweetlabel.topics.FullLLDAClassification

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.