Package com.ipeirotis.gal.core

Examples of com.ipeirotis.gal.core.Worker


        String assignedLabel = al.getCategoryName();
       
        Map<String, Double> estimatedCorrectLabel = d.getProbabilityVector(ClassificationMethod.DS_Soft);
       
        for (String from: estimatedCorrectLabel.keySet()) {
          Worker w = this.getWorkers().get(workerName);
          Double categoryProbability = estimatedCorrectLabel.get(from);
          Double labelingProbability = w.getConfusionMatrix().getErrorRate(from, assignedLabel);
          if (categoryProbability == 0.0 || Double.isNaN(labelingProbability) || labelingProbability == 0.0 )
            continue;
          else
            result += Math.log(categoryProbability) + Math.log(labelingProbability);
        }
View Full Code Here


    // If we already have the worker, then just add the label
    // in the set of labels assigned by the worker.
    // If it is the first time we see the object, then create
    // the appropriate entry in the objects hashmap
    Worker w;
    if (this.workers.containsKey(workerName)) {
      w = this.workers.get(workerName);
    } else {
      w = new Worker(workerName, this);
    }
   
    w.addAssignedLabel(al);
    this.workers.put(workerName, w);

  }
View Full Code Here

      // We estimate now Equation 2.5 of Dawid & Skene
      Double categoryNominator = category.getPrior();

      // We go through all the labels assigned to the d object
      for (AssignedLabel al : d.getAssignedLabels()) {
        Worker w = workers.get(al.getWorkerName());

        // If we are trying to estimate the category probability
        // distribution
        // to estimate the quality of a given worker, then we need to
        // ignore
        // the labels submitted by this worker.
        if (workerToIgnore != null
            && w.getName().equals(workerToIgnore))
          continue;

        String assigned_category = al.getCategoryName();
        double evidence_for_category = w.getErrorRate(
            category.getName(), assigned_category);
        if (Double.isNaN(evidence_for_category))
          continue;
        categoryNominator *= evidence_for_category;
      }
View Full Code Here

  /**
   * @param lid
   */
  private void updateWorkerConfusionMatrix(String workerName) {

    Worker w = this.workers.get(workerName);

    ConfusionMatrix cm = new ConfusionMatrix(this.categories.values());
    cm.empty();

    // Scan all objects and change the confusion matrix for each worker
    // using the class probability for each object
    for (AssignedLabel al : w.getAssignedLabels()) {

      // Get the name of the object and the category it
      // is classified from this worker.
      String objectName = al.getObjectName();
      String destination = al.getCategoryName();

      // We get the classification of the object
      // based on the votes of all the other workers
      // We treat this classification as the "correct" one
      HashMap<String, Double> probabilities = this
          .getObjectClassProbabilities(objectName, workerName);
      if (probabilities == null)
        continue; // No other worker labeled the object

      for (String source : probabilities.keySet()) {
        Double error = probabilities.get(source);
        cm.addError(source, destination, error);
      }

    }
    cm.normalize();

    w.setConfusionMatrix(cm);

  }
View Full Code Here

TOP

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

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.