Package com.ipeirotis.gal.core

Examples of com.ipeirotis.gal.core.Category


   
    Collection<Category> categories = new HashSet<Category>();
   
   
    for (int i=1; i<5; i++) {
      Category c = new Category("cat"+i);
      categories.add(c);
    }
   
    cm = new ConfusionMatrix(categories);
    cm.empty();
View Full Code Here


      // First we check if we have fixed priors or not
      // If we have fixed priors, we have a TAB character
      // after the name of each category, followed by the prior value
      String[] l = line.split("\t");
      if (l.length == 1) {
        Category c = new Category(line);
        categories.add(c);
      } else if (l.length == 2) {
        String name = l[0];
        Double prior = new Double(l[1]);
        Category c = new Category(name);
        c.setPrior(prior);
        categories.add(c);
      }
    }
    return categories;
  }
View Full Code Here

    String from = cl.getCategoryFrom();
    String to = cl.getCategoryTo();
    Double cost = cl.getCost();

    Category c = this.categories.get(from);
    c.setCost(to, cost);
    this.categories.put(from, c);

  }
View Full Code Here

   */
  private void initializeCosts() {

    for (String from : categories.keySet()) {
      for (String to : categories.keySet()) {
        Category c = categories.get(from);
        if (from.equals(to)) {
          c.setCost(to, 0.0);
        } else {
          c.setCost(to, 1.0);
        }
        categories.put(from, c);
      }
    }
  }
View Full Code Here

  }

  private void initializePriors() {

    for (String cat : categories.keySet()) {
      Category c = categories.get(cat);
      c.setPrior(1.0 / categories.keySet().size());
      categories.put(cat, c);
    }
  }
View Full Code Here

    setPriors(priors);
  }

  private void setPriors(HashMap<String, Double> priors) {
    for (String c : this.categories.keySet()) {
      Category category = this.categories.get(c);
      Double prior = priors.get(c);
      category.setPrior(prior);
      this.categories.put(c, category);
    }
  }
View Full Code Here

TOP

Related Classes of com.ipeirotis.gal.core.Category

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.