Ejemplo n.º 1
0
  private static Multiset toMultiSet(HeuristicsNet net) {
    Multiset ms = new HashMultiset();
    for (int i = 0; i < net.getDuplicatesMapping().length; i++) {
      if ((net.getInputSet(i).size() > 0) || (net.getOutputSet(i).size() > 0)) {
        ms.add(net.getLogEvents().getEvent(net.getDuplicatesMapping()[i]));
      }
    }

    return ms;
  }
Ejemplo n.º 2
0
  private void calculatePrecisionAndRecall() {

    Multiset tasksBaseNetMS = null;
    Multiset taskstFoundNetMS = null;
    Multiset intersectionTasksMS = null;

    tasksBaseNetMS = toMultiSet(baseHN);
    taskstFoundNetMS = toMultiSet(foundHN);
    intersectionTasksMS = tasksBaseNetMS.intersection(taskstFoundNetMS);

    try {
      recall = ((double) intersectionTasksMS.size() / tasksBaseNetMS.size());
    } catch (ArithmeticException exc) {
      // division by zero
      recall = 0.0;
    }

    try {
      precision = ((double) intersectionTasksMS.size() / taskstFoundNetMS.size());
    } catch (ArithmeticException exc) {
      // division by zero
      precision = 0.0;
    }
  }