/** * @param la the basic learning algorithm */ public DisjunctiveCELA(AbstractCELA la) { this.la = la; this.lp = la.getLearningProblem(); }
private void reset() { currentPosExamples = new TreeSet<>(((PosNegLP) la.getLearningProblem()).getPositiveExamples()); currentNegExamples = new TreeSet<>(((PosNegLP) la.getLearningProblem()).getNegativeExamples()); // keep copy of the initial pos examples initialPosExamples = new TreeSet<>(currentPosExamples); }
private void updateLearningProblem(EvaluatedDescription<? extends Score> partialSolution) { // get individuals covered by the solution SortedSet<OWLIndividual> coveredExamples = la.getReasoner().getIndividuals(partialSolution.getDescription()); // remove from pos examples as those are already covered currentPosExamples.removeAll(coveredExamples); // remove from neg examples as those will always be covered in the combined solution currentNegExamples.removeAll(coveredExamples); // update the learning problem itself // TODO do we need some re-init of the lp afterwards? if(lp instanceof PosNegLP) { ((PosNegLP) la.getLearningProblem()).setPositiveExamples(currentPosExamples); ((PosNegLP) la.getLearningProblem()).setNegativeExamples(currentNegExamples); } else if(lp instanceof PosOnlyLP) { ((PosOnlyLP) la.getLearningProblem()).setPositiveExamples(currentPosExamples); } else if(lp instanceof ClassLearningProblem){ // TODO } }
private OWLOntology replaceSuperClass(OWLOntology finalOntology, Set<OWLSubClassOfAxiom> learnedAxioms) { logger.debug(myRank + " - Replacing super class \"dummyClass\" with \"classToDescribe\""); ClassLearningProblem clp = (ClassLearningProblem) cela.getLearningProblem();
if (cela.getLearningProblem() instanceof ClassLearningProblem) { try { finalOntology = replaceDummyClass(finalOntology, learnedAxioms);
Set<OWLIndividual> positiveIndividuals; Set<OWLIndividual> negativeIndividuals; AbstractClassExpressionLearningProblem lp = cela.getLearningProblem(); if (lp instanceof PosNegLP) { positiveIndividuals = ((PosNegLP) lp).getPositiveExamples();
ClassLearningProblem clp = (ClassLearningProblem) cela.getLearningProblem(); OWLOntologyManager man = finalOntology.getOWLOntologyManager(); OWLDataFactory df = man.getOWLDataFactory();
Set<OWLIndividual> negativeIndividuals; if (learningProblem == null) { learningProblem = cela.getLearningProblem();
if (cela.getLearningProblem() instanceof ClassLearningProblem) { finalOntology = replaceSuperClass(finalOntology, bestRevision.getLearnedAxioms()); } else {