Package uk.ac.cam.ha293.tweetlabel

Examples of uk.ac.cam.ha293.tweetlabel.TweetLabel


        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;
 
View Full Code Here


        //if(fac.getScore(topic) < scoreThreshold) break; //stop getting low-prob topics
        topics.add(topic);
        count++;
      }
    } else if(topicType.equals("textwise")) {
      FullTextwiseClassification ftc = new FullTextwiseClassification(userID,false);
      int topTopics = 3;
      int count = 0;
      for(String topic : ftc.getCategorySet()) {
        if(count == topTopics) break; //stop getting more than 3 topics
        //if(fac.getScore(topic) < scoreThreshold) break; //stop getting low-prob topics
        topics.add(topic);
        count++;
      }
    } else if(topicType.equals("textwiseproper")) {
      FullTextwiseClassification ftc = new FullTextwiseClassification(userID,true);
      int topTopics = 3;
      int count = 0;
      for(String topic : ftc.getCategorySet()) {
        if(count == topTopics) break; //stop getting more than 3 topics
        //if(fac.getScore(topic) < scoreThreshold) break; //stop getting low-prob topics
        topics.add(topic);
        count++;
      }
View Full Code Here

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

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

          }
          classifications.add(classification);
        }
      } else if(topicType.equals("textwise")) {
        for(long id : Tools.getCSVUserIDs()) {
          FullTextwiseClassification c = new FullTextwiseClassification(id,true);
          Map<String,Double> classification = new HashMap<String,Double>();
          int topicCount = 0;
          for(String topic : c.getCategorySet()) {
            if(topicCount == topTopics) break;
            classification.put(topic, c.getScore(topic));
            topicCount++;
          }
          classifications.add(classification);
        }
      }
    } else {
      for(long id : Tools.getCSVUserIDs()) {
        FullLLDAClassification c = new FullLLDAClassification(topicType,alpha,id);
        Map<String,Double> classification = new HashMap<String,Double>();
        int topicCount = 0;
        for(String topic : c.getCategorySet()) {
          if(topicCount == topTopics) break;
          if(topic.equals("Other")) continue;
          classification.put(topic, c.getScore(topic));
          topicCount++;
        }
        classifications.add(classification);
      }
    }
View Full Code Here

              FullLLDAClassification llda = new FullLLDAClassification(topicType,alpha,false,reduction,uid);
              double sim = llda.cosineSimilarity(baseline);
              cosineSum += sim;
              cosineCount++;
            } else if(topicType.equals("textwiseproper")) {
              FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
              FullLLDAClassification llda = new FullLLDAClassification(topicType,alpha,false,reduction,uid);
              double sim = llda.cosineSimilarity(baseline);
              cosineSum += sim;
              cosineCount++;
            }
View Full Code Here

            if(topic.equals("Other")) continue;
            kCount++;
            baselineTopicSet.add(topic);
          }
        } else if(topicType.equals("textwise")) {
          FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
          kCount=0;
          for(String topic : baseline.getCategorySet()) {
            if(kCount == k) break;
            kCount++;
            baselineTopicSet.add(topic);
          }
        }
View Full Code Here

            if(topic.equals("Other")) continue;
            kCount++;
            baselineTopicSet.add(topic);
          }
        } else if(topicType.equals("textwise")) {
          FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
          kCount=0;
          for(String topic : baseline.getCategorySet()) {
            if(kCount == k) break;
            kCount++;
            baselineTopicSet.add(topic);
          }
        }
View Full Code Here

        String topTopic = c.getCategorySet().toArray(new String[1])[0];
        if(topTopic.equals("Other") && c.getCategorySet().size() > 1topTopic = c.getCategorySet().toArray(new String[1])[1];
        else if(topTopic.equals("Other")) continue;
        topicCounts.put(topTopic,topicCounts.get(topTopic)+1);
      } else if(topicType.equals("textwise")) {
        FullTextwiseClassification c = new FullTextwiseClassification(uid,true);
        if(c.getCategorySet().size() == 0) continue;
        String topTopic = c.getCategorySet().toArray(new String[1])[0];
        topicCounts.put(topTopic,topicCounts.get(topTopic)+1);
      }
      count++;
    }
    double sum = 0.0;
View Full Code Here

          if(topic.equals("Other")) continue;
          kCount++;
          baselineTopicSet.add(topic);
        }
      } else if(topicType.equals("textwise")) {
        FullTextwiseClassification baseline = new FullTextwiseClassification(uid,true);
        kCount=0;
        for(String topic : baseline.getCategorySet()) {
          if(kCount == k) break;
          kCount++;
          baselineTopicSet.add(topic);
        }
      }
View Full Code Here

TOP

Related Classes of uk.ac.cam.ha293.tweetlabel.TweetLabel

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.