Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 16b24366 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- added relation sensitivity to evaluators

parent f4e9cd54
No related branches found
No related tags found
No related merge requests found
/*
* $Id$
*
* Copyright (C) INRIA, 2004-2011
* Copyright (C) INRIA, 2004-2011, 2013
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -44,8 +44,7 @@ import java.net.URI;
* This function implements Precision/Recall. The first alignment
* is thus the expected one.
*
* NOTE: This measure does not take relations nor confidences into account
* For relation, this will wait for algebra based relations
* Basic relation sensitivity has been implemented
*
* @author Jerome Euzenat
* @version $Id$
......@@ -61,6 +60,8 @@ public class PRecEvaluator extends BasicEvaluator implements Evaluator {
protected double fmeasure = 0.;
protected boolean relsensitive = false;
protected long time = 0;
protected int nbexpected = 0;
......@@ -109,6 +110,7 @@ public class PRecEvaluator extends BasicEvaluator implements Evaluator {
public double eval( Properties params ) throws AlignmentException {
init();
nbfound = align2.nbCells();
if ( params.getProperty("relations") != null ) relsensitive = true;
for ( Cell c1 : align1 ) {
URI uri1 = c1.getObject2AsURI();
......@@ -117,7 +119,8 @@ public class PRecEvaluator extends BasicEvaluator implements Evaluator {
if( s2 != null ){
for( Cell c2 : s2 ) {
URI uri2 = c2.getObject2AsURI();
if ( uri1.equals( uri2 ) ) {
if ( uri1.equals( uri2 )
&& ( !relsensitive || c1.getRelation().equals( c2.getRelation() ) ) ) {
nbcorrect++;
break;
}
......
/*
* $Id: WeightedPRecEvaluator.java 1494 2010-07-23 14:43:36Z euzenat $
*
* Copyright (C) INRIA, 2004-2012
* Copyright (C) INRIA, 2004-2013
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -44,8 +44,7 @@ import java.net.URI;
* This function implements Precision/Recall. The first alignment
* is thus the expected one.
*
* NOTE: This measure does not take relations nor confidences into account
* For relation, this will wait for algebra based relations
* Basic relation sensitivity has been implemented
*
* @author Jerome Euzenat
* @version $Id: PRecEvaluator.java 1494 2010-07-23 14:43:36Z euzenat $
......@@ -61,6 +60,8 @@ public class WeightedPREvaluator extends BasicEvaluator implements Evaluator {
protected double fmeasure = 0.;
protected boolean relsensitive = false;
protected long time = 0;
protected double nbexpected = 0.;
......@@ -109,6 +110,7 @@ public class WeightedPREvaluator extends BasicEvaluator implements Evaluator {
public double eval( Properties params ) throws AlignmentException {
init();
for ( Cell c2 : align2 ) nbfound += c2.getStrength();
if ( params.getProperty("relations") != null ) relsensitive = true;
for ( Cell c1 : align1 ) {
URI uri1 = c1.getObject2AsURI();
......@@ -117,7 +119,8 @@ public class WeightedPREvaluator extends BasicEvaluator implements Evaluator {
if( s2 != null ){
for( Cell c2 : s2 ) {
URI uri2 = c2.getObject2AsURI();
if ( uri1.equals( uri2 ) ) {
if ( uri1.equals( uri2 )
&& ( !relsensitive || c1.getRelation().equals( c2.getRelation() ) ) ) {
double diff = c1.getStrength() - c2.getStrength();
nbcorrect += 1. - ((diff>0.)?diff:-diff);
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment