/** * Computes the <code>Score</code> of a given hypothesis * with respect to this learning problem. * This can (but does not need to) be used by learning algorithms * to measure how good the hypothesis fits the learning problem. * Score objects are used to store e.g. covered examples, accuracy etc., * so often it is more efficient to only create score objects for * promising hypotheses. * @param hypothesis A hypothesis (as solution candidate for this learning problem). * @return A <code>Score</code> object. */ public T computeScore(V hypothesis) { return computeScore(hypothesis, 0.0); }
/** * Evaluates the hypothesis by computing the score and returning an * evaluated hypothesis of the correct type (ClassLearningProblem * returns EvaluatedDescriptionClass instead of generic EvaluatedDescription). * @param hypothesis Hypothesis to evaluate. * @return an evaluated hypothesis */ public W evaluate(V hypothesis){ return evaluate(hypothesis, 1.0); }
/** * This method returns a value, which indicates how accurate a * hypothesis solves a learning problem. There can be different * ways to compute accuracy depending on the type of learning problem * and other factors. However, all implementations are required to * return a value between 0 and 1, where 1 stands for the highest * possible accuracy and 0 for the lowest possible accuracy. * * @return A value between 0 and 1 indicating the quality (of a hypothesis). * or -1 as described above. */ public double getAccuracyOrTooWeak(V object) { return getAccuracyOrTooWeak(object, 0.0); }
public void changeSourcesOntology(OWLOntology ontology) { sourcesOntology = ontology; learningProblem.getReasoner().changeSources(Collections.singleton((KnowledgeSource) new OWLAPIOntology(ontology))); // learningProblem.getReasoner().changeSources(Collections.singleton((KnowledgeSource) ontology)); }
+ "negative examples. Selecting the instances of Thing which " + "are non instances of ClasstoDescribe as negative Examples"); AbstractReasonerComponent reasoner = lp.getReasoner(); ((PosNegLP) lp).setNegativeExamples(trainNeg); try { lp.init(); } catch (ComponentInitException e) { logger.error(e); lp.init(); } catch (ComponentInitException e) { logger.error(e);
public void changeSourcesOntology(OWLOntology ontology) { sourcesOntology = ontology; edge.setOntologies(ontology); learningProblem.getReasoner().changeSources(Collections.singleton((KnowledgeSource) new OWLAPIOntology(ontology))); // learningProblem.getReasoner().changeSources(Collections.singleton((KnowledgeSource) ontology)); }
@Override public void init() throws ComponentInitException { AbstractReasonerComponent rc = learningProblem.getReasoner(); if (rc instanceof ClosedWorldReasoner) { sourcesOntology = ((ClosedWorldReasoner) rc).getReasonerComponent().getOntology(); } else if (rc instanceof OWLAPIReasoner) { sourcesOntology = ((OWLAPIReasoner) rc).getOntology(); } else { throw new ComponentInitException("Unsupported Reasoning: " + rc.getClass()); } }
positiveIndividuals = ((PosOnlyLP) learningProblem).getPositiveExamples(); negativeIndividuals = Sets.difference(learningProblem.getReasoner().getIndividuals(), positiveIndividuals); } else if (learningProblem instanceof ClassLearningProblem) {
edge.setTimeOut(timeout); AbstractReasonerComponent rc = learningProblem.getReasoner(); if (rc instanceof ClosedWorldReasoner) { sourcesOntology = ((ClosedWorldReasoner) rc).getReasonerComponent().getOntology();