From: <lor...@us...> - 2013-06-17 10:35:34
|
Revision: 4002 http://sourceforge.net/p/dl-learner/code/4002 Author: lorenz_b Date: 2013-06-17 10:35:31 +0000 (Mon, 17 Jun 2013) Log Message: ----------- Updated eval script. Modified Paths: -------------- trunk/scripts/pom.xml trunk/scripts/src/main/java/org/dllearner/scripts/pattern/OWLAxiomPatternUsageEvaluation.java Modified: trunk/scripts/pom.xml =================================================================== --- trunk/scripts/pom.xml 2013-06-16 10:40:01 UTC (rev 4001) +++ trunk/scripts/pom.xml 2013-06-17 10:35:31 UTC (rev 4002) @@ -146,7 +146,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> - <version>1.2</version> + <version>1.2.1</version> <executions> <execution> @@ -159,7 +159,7 @@ <executable>java</executable> <arguments> <argument>-Xms512m</argument> - <argument>-Xmx3000m</argument> + <argument>-Xmx10000m</argument> </arguments> </configuration> </plugin> Modified: trunk/scripts/src/main/java/org/dllearner/scripts/pattern/OWLAxiomPatternUsageEvaluation.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/pattern/OWLAxiomPatternUsageEvaluation.java 2013-06-16 10:40:01 UTC (rev 4001) +++ trunk/scripts/src/main/java/org/dllearner/scripts/pattern/OWLAxiomPatternUsageEvaluation.java 2013-06-17 10:35:31 UTC (rev 4002) @@ -74,6 +74,7 @@ import org.semanticweb.owlapi.model.OWLEntity; import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom; import org.semanticweb.owlapi.model.OWLLiteral; +import org.semanticweb.owlapi.model.OWLLogicalAxiom; import org.semanticweb.owlapi.model.OWLObjectComplementOf; import org.semanticweb.owlapi.model.OWLObjectIntersectionOf; import org.semanticweb.owlapi.model.OWLOntology; @@ -373,7 +374,7 @@ e.printStackTrace(); } } - System.exit(0); +// System.exit(0); Monitor patternTimeMon = MonitorFactory.getTimeMonitor("pattern-runtime"); //for each pattern @@ -438,10 +439,46 @@ } } +// private List<OWLAxiom> createSample(OWLOntology ontology, Collection<NamedClass> classes){ +// List<OWLAxiom> sample = new ArrayList<OWLAxiom>(); +// +// Set<OWLAxiom> axioms = ontology.getAxioms(); +// //filter out trivial axioms, e.g. A SubClassOf Thing or A EquivalentTo A and B +// filterOutTrivialAxioms(axioms); +// //filter out axioms below threshold +// filterOutAxiomsBelowThreshold(axioms, sampleThreshold); +// //get for each class some random axioms +// for (NamedClass cls : classes) { +// List<OWLAxiom> relatedAxioms = new ArrayList<OWLAxiom>(ontology.getReferencingAxioms(df.getOWLClass(IRI +// .create(cls.getName())))); +// Multimap<Double, OWLAxiom> accuracyWithAxioms = TreeMultimap.create(); +// for (OWLAxiom axiom : relatedAxioms) { +// double accuracy = getAccuracy(axiom); +// if(accuracy >= sampleThreshold){ +// accuracyWithAxioms.put(accuracy, axiom); +// } +// } +// //pick the set of axioms with highest score +// NavigableSet<Double> keySet = (NavigableSet<Double>)accuracyWithAxioms.keySet(); +// if(!keySet.isEmpty()){ +// Double score = keySet.first(); +// Collection<OWLAxiom> axiomsWithHighestScore = accuracyWithAxioms.get(score); +// List<OWLAxiom> axiomList = new ArrayList<OWLAxiom>(axiomsWithHighestScore); +// Collections.shuffle(axiomList, new Random(123)); +// if(!axiomList.isEmpty()){ +// sample.add(axiomList.get(0)); +// } +// } +// } +// +// Collections.shuffle(sample, new Random(123)); +// return sample.subList(0, Math.min(sampleSize, sample.size())); +// } + private List<OWLAxiom> createSample(OWLOntology ontology, Collection<NamedClass> classes){ List<OWLAxiom> sample = new ArrayList<OWLAxiom>(); - Set<OWLAxiom> axioms = ontology.getAxioms(); + Set<OWLLogicalAxiom> axioms = ontology.getLogicalAxioms(); //filter out trivial axioms, e.g. A SubClassOf Thing or A EquivalentTo A and B filterOutTrivialAxioms(axioms); //filter out axioms below threshold @@ -526,8 +563,8 @@ return axiomList.subList(0, Math.min(sampleSize, axiomList.size())); } - private void filterOutAxiomsBelowThreshold(Set<OWLAxiom> axioms, double threshold) { - for (Iterator<OWLAxiom> iter = axioms.iterator(); iter.hasNext();) { + private void filterOutAxiomsBelowThreshold(Set<? extends OWLAxiom> axioms, double threshold) { + for (Iterator<? extends OWLAxiom> iter = axioms.iterator(); iter.hasNext();) { OWLAxiom axiom = iter.next(); if(getAccuracy(axiom) < threshold){ iter.remove(); @@ -535,8 +572,8 @@ } } - private void filterOutTrivialAxioms(Set<OWLAxiom> axioms) { - for (Iterator<OWLAxiom> iter = axioms.iterator(); iter.hasNext();) { + private void filterOutTrivialAxioms(Set<? extends OWLAxiom> axioms) { + for (Iterator<? extends OWLAxiom> iter = axioms.iterator(); iter.hasNext();) { OWLAxiom axiom = iter.next(); if (axiom.isOfType(AxiomType.EQUIVALENT_CLASSES)) { if(((OWLEquivalentClassesAxiom) axiom).getClassExpressions().size() == 1){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |