Package uk.ac.cam.ha293.tweetlabel.util

Examples of uk.ac.cam.ha293.tweetlabel.util.Stopwords


    double cosineSum = 0.0;
    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++;
 
View Full Code Here


    double cosineSum = 0.0;
    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++;
 
View Full Code Here

    double cosineSum = 0.0;
    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;
 
View Full Code Here

    double cosineSum = 0.0;
    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;
 
View Full Code Here

    double cosineSum = 0.0;
    int cosineCount = 0;
    double squareSum = 0.0;
    for(Long uid : Tools.getCSVUserIDs()) {
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification fac = new FullAlchemyClassification(uid);
        FullSVMClassification fsm = new FullSVMClassification(topicType,uid);
        double sim = fsm.cosineSimilarity(fac);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
 
View Full Code Here

    double cosineSum = 0.0;
    int cosineCount = 0;
    double squareSum = 0.0;
    for(Long uid : Tools.getCSVUserIDs()) {
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification fac = new FullAlchemyClassification(uid);
        FullSVMClassification fsm = new FullSVMClassification(topicType,uid);
        double sim = cosineKSimilarity(fac,fsm,k);
        cosineSum += sim;
        squareSum += sim*sim;
        cosineCount++;
 
View Full Code Here

    //firstly create the baseline profile sets
    //IMPORTANT: profiles with no classifications aren't included in sets!
    for(Long uid : uids) {
      String topTopic = "";
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification c = new FullAlchemyClassification(uid);
        if(c.getCategorySet().size()==0) continue;
        topTopic = c.getCategorySet().toArray(new String[0])[0];
      } else if(topicType.equals("calais")) {
        FullCalaisClassification c = new FullCalaisClassification(uid);
        if(c.getCategorySet().size()==0) continue;
        topTopic = c.getCategorySet().toArray(new String[0])[0];
      } else if(topicType.equals("textwiseproper")) {
        FullTextwiseClassification c = new FullTextwiseClassification(uid,true);
        if(c.getCategorySet().size()==0) continue;
        topTopic = c.getCategorySet().toArray(new String[0])[0];
      }
      if(profileSets.containsKey(topTopic)) {
        profileSets.get(topTopic).add(uid);
      } else {
        Set<Long> newSet = new HashSet<Long>();
View Full Code Here

          FileOutputStream fileOut = new FileOutputStream("cosinesims/"+topicType+"-"+alpha+".csv");
          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) {
View Full Code Here

    double squareSum = 0.0;
    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++;
 
View Full Code Here

    }
    Set<Long> noClassifications = new HashSet<Long>();
    for(Long uid : Tools.getCSVUserIDs()) {
      String topTopic = "";
      if(topicType.equals("alchemy")) {
        FullAlchemyClassification c = new FullAlchemyClassification(uid);
        if(c.getCategorySet().size()==0) {
          noClassifications.add(uid);
          continue;
        }
        topTopic = c.getCategorySet().toArray(new String[1])[0];
      } else if(topicType.equals("calais")) {
        FullCalaisClassification c = new FullCalaisClassification(uid);
        if(c.getCategorySet().size()==0) {
          noClassifications.add(uid);
          continue;
        }
        topTopic = c.getCategorySet().toArray(new String[1])[0];
        if(topTopic.equals("Other") && c.getCategorySet().size() < 2) {
          noClassifications.add(uid);
          continue;
        } else if(topTopic.equals("Other")) {
          topTopic = c.getCategorySet().toArray(new String[1])[1];
        }
      } else if(topicType.equals("textwise")) {
        FullTextwiseClassification c = new FullTextwiseClassification(uid,true);
        if(c.getCategorySet().size()==0) {
          noClassifications.add(uid);
          continue;
        }
        topTopic = c.getCategorySet().toArray(new String[1])[0];
      }
      if(svm) {
        FullSVMClassification svmClassification = new FullSVMClassification(topicType,uid);
        String topSVMTopic = svmClassification.getCategorySet().toArray(new String[1])[0];
        gtTopicSets.get(topTopic).add(uid);
View Full Code Here

TOP

Related Classes of uk.ac.cam.ha293.tweetlabel.util.Stopwords

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.