Mentions légales du service

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

- Genericised a bit evaluation output

parent 1089eac8
No related branches found
No related tags found
No related merge requests found
......@@ -154,12 +154,15 @@ public class GenPlot extends CommonCLI {
System.exit(-1);
}
Class<?> graphClass = Class.forName(graphCN);
Class<?> graphClass = Class.forName( graphCN );
Class[] cparams = {};
graphConstructor = graphClass.getConstructor( cparams );
//Class<?> evalClass = Class.forName(evalCN);
//evalConstructor = evalClass.getConstructor( cparams );
// JE: This is not used
Class<?> evalClass = Class.forName( evalCN );
Class<?> alClass = Class.forName( "org.semanticweb.owl.align.Alignment" );
Class[] caparams = { alClass, alClass };
evalConstructor = evalClass.getConstructor( caparams );
// Collect correspondences from alignments in all directories
// . -> Vector<EvalCell>
......
......@@ -28,6 +28,7 @@ import org.semanticweb.owl.align.Alignment;
import org.semanticweb.owl.align.Evaluator;
import fr.inrialpes.exmo.align.impl.eval.PRecEvaluator;
import fr.inrialpes.exmo.align.impl.eval.WeightedPREvaluator; //JE:merge
import fr.inrialpes.exmo.ontowrap.OntologyFactory;
import fr.inrialpes.exmo.ontowrap.OntowrapException;
......@@ -37,6 +38,7 @@ import java.io.PrintStream;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.lang.Integer;
import java.lang.reflect.Constructor;
import java.util.Hashtable;
import java.util.Vector;
import java.util.Enumeration;
......@@ -68,6 +70,7 @@ import fr.inrialpes.exmo.align.parser.AlignmentParser;
where the options are:
<pre>
-o filename --output=filename
-e classname --evaluator=classname
-f format = prfot (precision/recall/f-measure/overall/time) --format=prfot
-r filename --reference=filename
-s algo/measure
......@@ -101,11 +104,14 @@ public class GroupEval extends CommonCLI {
int size = 0;
String color = null;
String ontoDir = null;
String classname = "fr.inrialpes.exmo.align.impl.eval.PRecEvaluator";
Constructor evalConstructor = null;
public GroupEval() {
super();
options.addOption( OptionBuilder.withLongOpt( "list" ).hasArgs().withValueSeparator(',').withDescription( "List of FILEs to be included in the results (required)" ).withArgName("FILE").create( 'l' ) );
options.addOption( OptionBuilder.withLongOpt( "color" ).hasOptionalArg().withDescription( "Color even lines of the output in COLOR (default: lightblue)" ).withArgName("COLOR").create( 'c' ) );
options.addOption( OptionBuilder.withLongOpt( "evaluator" ).hasArg().withDescription( "Use CLASS as evaluation plotter" ).withArgName("CLASS").create( 'e' ) );
options.addOption( OptionBuilder.withLongOpt( "format" ).hasArg().withDescription( "Used MEASures and order (precision/recall/f-measure/overall/time) (default: "+format+")" ).withArgName("MEAS").create( 'f' ) );
options.addOption( OptionBuilder.withLongOpt( "type" ).hasArg().withDescription( "Output TYPE (html|xml|tex|ascii|triangle; default: "+type+")" ).withArgName("TYPE").create( 't' ) );
//options.addOption( OptionBuilder.withLongOpt( "sup" ).hasArg().withDescription( "Specifies if dominant columns are algorithms or measure" ).withArgName("algo").create( 's' ) );
......@@ -129,6 +135,7 @@ public class GroupEval extends CommonCLI {
if ( line == null ) return; // --help
// Here deal with command specific arguments
if ( line.hasOption( 'e' ) ) classname = line.getOptionValue( 'e' );
if ( line.hasOption( 'f' ) ) format = line.getOptionValue( 'f' );
if ( line.hasOption( 'r' ) ) reference = line.getOptionValue( 'r' );
if ( line.hasOption( 's' ) ) dominant = line.getOptionValue( 's' );
......@@ -145,6 +152,11 @@ public class GroupEval extends CommonCLI {
System.exit( -1 );
}
Class<?> evalClass = Class.forName( classname );
Class<?> alClass = Class.forName( "org.semanticweb.owl.align.Alignment" );
Class[] cparams = { alClass, alClass };
evalConstructor = evalClass.getConstructor( cparams );
print( iterateDirectories() );
}
......@@ -153,9 +165,9 @@ public class GroupEval extends CommonCLI {
File [] subdir = null;
try {
if (ontoDir == null) {
subdir = (new File(System.getProperty("user.dir"))).listFiles();
subdir = ( new File(System.getProperty("user.dir") ) ).listFiles();
} else {
subdir = (new File(ontoDir)).listFiles();
subdir = ( new File(ontoDir) ).listFiles();
}
} catch ( Exception e ) {
logger.error( "Cannot stat dir ", e );
......@@ -219,7 +231,9 @@ public class GroupEval extends CommonCLI {
Alignment align2 = aparser.parse( alignName2 );
//logger.trace(" Alignment structure2 parsed");
// Create evaluator object
eval = new PRecEvaluator( align1, align2 );
//eval = new PRecEvaluator( align1, align2 );
Object[] mparams = { align1, align2 };
eval = (Evaluator) evalConstructor.newInstance(mparams);
// Compare
eval.eval( parameters ) ;
} catch (Exception ex) {
......
......@@ -80,7 +80,7 @@ public class PRecEvaluator extends BasicEvaluator implements Evaluator {
* The two parameters are transformed into URIAlignment before being processed
* Hence, if one of them is modified after initialisation, this will not be taken into account.
**/
public PRecEvaluator(Alignment align1, Alignment align2) throws AlignmentException {
public PRecEvaluator( Alignment align1, Alignment align2 ) throws AlignmentException {
super(((BasicAlignment)align1).toURIAlignment(), ((BasicAlignment)align2).toURIAlignment());
}
......
......@@ -49,7 +49,7 @@ import org.slf4j.LoggerFactory;
* Basic relation sensitivity has been implemented
*
* @author Jerome Euzenat
* @version $Id: PRecEvaluator.java 1494 2010-07-23 14:43:36Z euzenat $
* @version $Id: WeightedPRecEvaluator.java 1494 2010-07-23 14:43:36Z euzenat $
*/
public class WeightedPREvaluator extends BasicEvaluator implements Evaluator {
......
......@@ -906,11 +906,11 @@ if [ -s $RESDIR/genplot-w2.tex ]; then diff $RESDIR/genplot-o1.tex $RESDIR/genpl
echo "\t-e,--evaluator <CLASS>"
mv lev1.table $RESDIR/lev1-init.table
java -cp $CP fr.inrialpes.exmo.align.cli.GenPlot -e fr.inrialpes.exmo.align.impl.eval.WeightedPRecEvaluator -l "refalign,edna1,streq1,lev1" -w $RESDIR/smalltest -o $RESDIR/genplot-e1.tex
java -cp $CP fr.inrialpes.exmo.align.cli.GenPlot -e fr.inrialpes.exmo.align.impl.eval.WeightedPREvaluator -l "refalign,edna1,streq1,lev1" -w $RESDIR/smalltest -o $RESDIR/genplot-e1.tex
if [ -s lev1.table ]; then diff $RESDIR/lev1-init.table lev1.table > $RESDIR/smalltest/diffgrev-e1.txt; else echo error with GENPLOT-EVA1; fi
echo "--> These are the same values for both evaluators, so the error"
echo "--> This is not used yet!"
if [ ! -s $RESDIR/smalltest/diffgrev-e1.txt ]; then echo error with GENPLOT-EVA2; fi
java -cp $CP fr.inrialpes.exmo.align.cli.GenPlot --evaluator fr.inrialpes.exmo.align.impl.eval.WeightedPRecEvaluator -l "refalign,edna1,streq1,lev1" -w $RESDIR/smalltest -o $RESDIR/genplot-e2.tex
java -cp $CP fr.inrialpes.exmo.align.cli.GenPlot --evaluator fr.inrialpes.exmo.align.impl.eval.WeightedPREvaluator -l "refalign,edna1,streq1,lev1" -w $RESDIR/smalltest -o $RESDIR/genplot-e2.tex
if [ -s $RESDIR/genplot-e2.tex ]; then diff $RESDIR/genplot-e1.tex $RESDIR/genplot-e2.tex ; else echo error with GENPLOT-EVA3; fi
#-------------------
......
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