@Override public void run() { la.start(); } });
@Override public void run() { // state.setAlgorithmRunning(true); state.getLearningAlgorithm().start(); // state.setAlgorithmRunning(false); } };
private EvaluatedDescription<? extends Score> computePartialSolution() { log.info("computing next partial solution..."); la.start(); EvaluatedDescription<? extends Score> partialSolution = la.getCurrentlyBestEvaluatedDescription(); return partialSolution; }
/** * Starts the learning algorithm and returns the best concept found. This * method will block until learning is completed. * * @param id Session ID. * @param format The format of the result string: "manchester", "kb", "dl". * @return The best solution found. * @throws ClientNotKnownException Thrown if client (session ID) is not known. */ @WebMethod public String learn(int id, String format) throws ClientNotKnownException { ClientState state = getState(id); state.getLearningAlgorithm().start(); OWLClassExpression solution = state.getLearningAlgorithm().getCurrentlyBestDescription(); switch (format) { case "manchester": return OWLAPIRenderers.toManchesterOWLSyntax(solution); case "kb": return OWLAPIRenderers.toManchesterOWLSyntax(solution); default: return solution.toString(); } }
la.start(); long algorithmDuration = System.nanoTime() - algorithmStartTime; runtime.addNumber(algorithmDuration/(double)1000000000);
/** * Returns a list of JSON encoded description including extra information * (which partially depends on the learning problem) such as the accuracy * of the learned description. * * @param id The session ID. * @param limit Maximum number of results desired. * @return A JSON string encoding learned descriptions. * @throws ClientNotKnownException Thrown if client (session ID) is not known. */ @WebMethod public String learnDescriptionsEvaluatedLimit(int id, int limit) throws ClientNotKnownException { ClientState state = getState(id); state.getLearningAlgorithm().start(); List<? extends EvaluatedDescription> descriptions = state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(limit); String json = "{"; int count = 1; for(EvaluatedDescription description : descriptions) { if (count>1) json += ",\"solution" + count + "\" : " + description.asJSON(); else json += "\"solution" + count + "\" : " + description.asJSON(); count++; } json+="}"; return json; }
cela.start(); cela.getReasoner().releaseKB(); celaTimeMills = System.currentTimeMillis() - celaTimeMills;
/** * Returns a list of JSON encoded description including extra information * (which partially depends on the learning problem) such as the accuracy * of the learned description. * * @param id The session ID. * @return A JSON string encoding learned descriptions. * @throws ClientNotKnownException Thrown if client (session ID) is not known. */ @WebMethod public String learnDescriptionsEvaluated(int id) throws ClientNotKnownException { ClientState state = getState(id); state.getLearningAlgorithm().start(); NavigableSet<? extends EvaluatedDescription> descriptions = state.getLearningAlgorithm() .getCurrentlyBestEvaluatedDescriptions(); String json = "{"; int count = 1; for (EvaluatedDescription description : descriptions.descendingSet()) { if (count > 1) json += ",\"solution" + count + "\" : " + description.asJSON(); else json += "\"solution" + count + "\" : " + description.asJSON(); count++; } json += "}"; return json; }
la.start(); long algorithmDuration = System.nanoTime() - algorithmStartTime; runtime.addNumber(algorithmDuration/(double)1000000000);
cela.start(); celaTimeMills = System.currentTimeMillis() - celaTimeMills;
la.start(); System.out.println(la.getCurrentlyBestEvaluatedDescriptions(10, 0.8, true));
la.start(); timer.cancel(); List<? extends EvaluatedDescription> currentlyBestEvaluatedDescriptions = la.getCurrentlyBestEvaluatedDescriptions(0.8);