Example #1
0
$posExamples = array('http://localhost/foo#heinrich', 'http://localhost/foo#alfred', 'http://localhost/foo#heinz', 'http://localhost/foo#hans', 'http://localhost/foo#alex');
$negExamples = array('http://localhost/foo#jan', 'http://localhost/foo#markus', 'http://localhost/foo#susi', 'http://localhost/foo#anna', 'http://localhost/foo#maria', 'http://localhost/foo#katrin', 'http://localhost/foo#johanna', 'http://localhost/foo#mandy', 'http://localhost/foo#miriam', 'http://localhost/foo#hanna');
$client->setLearningProblem($id, "posNegStandard");
$client->setPositiveExamples($id, $posExamples);
$client->setNegativeExamples($id, $negExamples);
// choose refinement operator approach
$client->setLearningAlgorithm($id, "celoe");
$client->initAll($id);
// start learning process in DL-Learner
$client->learnThreaded($id);
$sleeptime = 2;
$seconds = 0;
do {
    // sleep a while
    sleep($sleeptime);
    // see what we have learned so far
    $concept = $client->getCurrentlyBestConcept($id);
    $running = $client->isAlgorithmRunning($id);
    $seconds += $sleeptime;
    if ($seconds == 10) {
        $sleeptime = 5;
    }
    echo 'result after ' . $seconds . ' seconds: ' . $concept . '<br />';
    flush();
} while ($running);
// print best concepts found (not all of which are
// necessarily perfect solutions)
echo '<br />Algorithm finished. Best concepts: ';
echo '<pre>';
print_r($client->getCurrentlyBestConcepts($id, 10));
echo '</pre>';