Examples of Datum


Examples of com.ipeirotis.gal.core.Datum

  private HashMap<String, Double> getObjectClassProbabilities(
      String objectName, String workerToIgnore) {

    HashMap<String, Double> result = new HashMap<String, Double>();

    Datum d = this.objects.get(objectName);

    // If this is a gold example, just put the probability estimate to be
    // 1.0
    // for the correct class
    if (d.isGold()) {
      for (String category : this.categories.keySet()) {
        String correctCategory = d.getGoldCategory();
        if (category.equals(correctCategory)) {
          result.put(category, 1.0);
        } else {
          result.put(category, 0.0);
        }
      }
      return result;
    }

    // Let's check first if we have any workers who have labeled this item,
    // except for the worker that we ignore
    Set<AssignedLabel> labels = d.getAssignedLabels();
    if (labels.isEmpty())
      return null;
    if (workerToIgnore != null && labels.size() == 1) {
      for (AssignedLabel al : labels) {
        if (al.getWorkerName().equals(workerToIgnore))
          return null;
      }
    }

    // If it is not gold, then we proceed to estimate the class
    // probabilities using the method of Dawid and Skene and we proceed as
    // usual with the M-phase of the EM-algorithm of Dawid&Skene

    // Estimate denominator for Eq 2.5 of Dawid&Skene, which is the same
    // across all categories
    Double denominator = 0.0;

    // To compute the denominator, we also compute the nominators across
    // all categories, so it saves us time to save the nominators as we
    // compute them
    HashMap<String, Double> categoryNominators = new HashMap<String, Double>();

    for (Category category : categories.values()) {

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

Examples of edu.stanford.nlp.ling.Datum

          logProbs.setCount(tag, Double.NEGATIVE_INFINITY);
        }
      }
      return;
    }
    Datum datum = new BasicDatum(featExtractor.makeFeatures(wordIndex.get(word)));
    logProbs = scorer.logProbabilityOf(datum);
    if (subtractTagScore) {
      Set<String> tagSet = logProbs.keySet();
      for (String tag : tagSet) {
        logProbs.incrementCount(tag, -Math.log(tagDist.probabilityOf(tag)));
View Full Code Here

Examples of hivemind.test.config.impl.Datum

        DatumHolder h = (DatumHolder) l.get(0);

        assertListsEqual(new Object[]
        { "fred", "wilma" }, h.getKeys());

        Datum d = h.getDatum("fred");
        assertNotNull(d.getLocation());
        assertEquals("barney", d.getValue());
    }
View Full Code Here

Examples of hivemind.test.config.impl.Datum

        List l = (List) r.getConfiguration("hivemind.test.config.Structured");

        assertEquals(2, l.size());

        Datum d = (Datum) l.get(0);

        assertEquals("key_1", d.getKey());
        assertEquals("value_1", d.getValue());
        assertNotNull(d.getLocation());

        d = (Datum) l.get(1);

        assertEquals("key_2", d.getKey());
        assertEquals("value_2", d.getValue());
    }
View Full Code Here

Examples of hivemind.test.config.impl.Datum

        List l = (List) r.getConfiguration("hivemind.test.config.Symbols");

        assertEquals(3, l.size());

        Datum d = (Datum) l.get(0);

        assertEquals("wife", d.getKey());
        assertEquals("wilma", d.getValue());

        d = (Datum) l.get(1);

        assertEquals("husband", d.getKey());
        assertEquals("fred", d.getValue());

        d = (Datum) l.get(2);

        assertEquals("work", d.getKey());
        assertEquals("${work}", d.getValue());

        assertLoggedMessagePattern("No value available for symbol 'work'");
    }
View Full Code Here

Examples of hivemind.test.config.impl.Datum

        Registry r = buildFrameworkRegistry("Localized.xml");

        List l = (List) r.getConfiguration("hivemind.test.config.Localized");
        assertEquals(1, l.size());

        Datum d = (Datum) l.get(0);

        assertEquals("message", d.getKey());
        assertEquals("Some Damn Thing", d.getValue());
    }
View Full Code Here

Examples of hivemind.test.config.impl.Datum

    {
        Registry r = buildFrameworkRegistry("CustomRule.xml");

        List l = (List) r.getConfiguration("hivemind.test.config.CustomRule");

        Datum d = (Datum) l.get(0);

        // Put this check second, just to get some code coverage
        // on ElementsInnerProxyList

        assertEquals(2, l.size());

        assertEquals("hivemind.test.config", d.getContributingModule().getModuleId());
    }
View Full Code Here

Examples of hivemind.test.config.impl.Datum

        List l = (List) r.getConfiguration("hivemind.test.config.Simple");

        assertEquals(2, l.size());

        Datum d = (Datum) l.get(0);

        assertEquals("key1", d.getKey());
        assertEquals("value1", d.getValue());
        assertNotNull(d.getLocation());

        d = (Datum) l.get(1);

        assertEquals("key2", d.getKey());
        assertEquals("value2", d.getValue());
    }
View Full Code Here

Examples of hivemind.test.config.impl.Datum

        Registry r = buildFrameworkRegistry("AttributeDefaults.xml");

        List l = (List) r.getConfiguration("hivemind.test.config.AttributeDefaults");

        assertEquals(1, l.size());
        Datum d = (Datum) l.get(0);

        assertEquals("DEFAULT_KEY", d.getKey());
        assertNull(d.getValue());
    }
View Full Code Here

Examples of hivemind.test.config.impl.Datum

        List l = r.getConfiguration("hivemind.test.config.Simple");

        assertEquals(2, l.size());

        Datum d = (Datum) l.get(0);

        assertEquals("key1", d.getKey());
        assertEquals("value1", d.getValue());
        assertNotNull(d.getLocation());

        d = (Datum) l.get(1);

        assertEquals("key2", d.getKey());
        assertEquals("value2", d.getValue());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.