Skip to content

Commit

Permalink
update the supervisedKGTrackMatcher example
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-h committed Aug 18, 2020
1 parent db11ee8 commit 72ba022
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 12 deletions.
29 changes: 29 additions & 0 deletions examples/supervisedKGTrackMatcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,33 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<mainClass>de.uni_mannheim.informatik.dws.melt.demomatcher.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public static void main(String[] args){
//CacheInit.populateKGTrack("E:\\tmp_tdb\\");

//analyzeIsolatedFeatures();
analyzeSupervisedLearningMatcher();
analyzeSupervisedLearningMatcher(0.2);
analyzeSupervisedLearningMatcher(0.4);
analyzeSupervisedLearningMatcher(0.6);
}


Expand All @@ -58,24 +60,19 @@ private static void analyzeIsolatedFeatures(){


ExecutionResultSet results = Executor.run(testCases, matchers);
results.addAll(Executor.run(testCases, new BaseMatcher()));

EvaluatorCSV e = new EvaluatorCSV(results);
e.setResourceExplainers(Arrays.asList(new ExplainerResourceProperty(RDFS.label, SKOS.altLabel), new ExplainerResourceType()));
e.writeToDirectory();
e.writeToDirectory();
}


private static void analyzeSupervisedLearningMatcher(){


private static void analyzeSupervisedLearningMatcher(double fraction){
List<TestCase> testCases = new ArrayList();
for(TestCase tc : TrackRepository.Knowledgegraph.V3.getTestCases()){
//sample 40 % reference alignemnt
testCases.add(TrackRepository.generateTestCaseWithSampledReferenceAlignment(tc, 0.4, 1324567));
testCases.add(TrackRepository.generateTestCaseWithSampledReferenceAlignment(tc, fraction, 1324567));
}
//testCases.add(TrackRepository.generateTestCaseWithSampledReferenceAlignment(TrackRepository.Knowledgegraph.V3.getTestCase("memoryalpha-memorybeta"), 0.4, 1324567));


ExecutionResultSet results = Executor.run(testCases, new SupervisedMatcher());
results.addAll(Executor.run(testCases, new BaseMatcher()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import de.uni_mannheim.informatik.dws.melt.matching_jena.MatcherYAAAJena;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.filter.ConceptType;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.filter.TypeFilter;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.filter.extraction.NaiveDescendingExtractor;
import de.uni_mannheim.informatik.dws.melt.matching_ml.python.MachineLearningScikitFilter;
import de.uni_mannheim.informatik.dws.melt.yet_another_alignment_api.Alignment;
import de.uni_mannheim.informatik.dws.melt.yet_another_alignment_api.Correspondence;
Expand Down Expand Up @@ -48,7 +49,12 @@ public Alignment match(OntModel source, OntModel target, Alignment inputAlignmen
);
}
}
MachineLearningScikitFilter filter = new MachineLearningScikitFilter(trainingAlignment);
return filter.match(source, target, recallAlignment, properties);
MachineLearningScikitFilter filter = new MachineLearningScikitFilter(trainingAlignment, 5, 40);

Alignment filteredAlignment = filter.match(source, target, recallAlignment, properties);

filteredAlignment = NaiveDescendingExtractor.filter(filteredAlignment);

return filteredAlignment;
}
}

0 comments on commit 72ba022

Please sign in to comment.