/** * Funkce inicializující PmmlSerializer za využití konfigurace úlohy * @param Task $task * @param bool $includeFrequencies=true * @return GuhaPmmlSerializer */ private function initPmmlSerializer(Task $task, $includeFrequencies = true) { $pmmlSerializer = $this->xmlSerializersFactory->createGuhaPmmlSerializer($task, null); $pmmlSerializer->appendTaskSettings(); $pmmlSerializer->appendDataDictionary($includeFrequencies); $pmmlSerializer->appendTransformationDictionary($includeFrequencies); return $pmmlSerializer; }
/** * Funkce pro vytvoření PMML z konkrétní úlohy * @param Task $task * @return string */ private function prepareTaskPmml(Task $task) { $pmmlSerializer = $this->xmlSerializersFactory->createGuhaPmmlSerializer($task, null); $pmmlSerializer->appendTaskSettings(); $pmmlSerializer->appendDataDictionary(false); $pmmlSerializer->appendTransformationDictionary(false); $pmmlSerializer->appendRules(); return $pmmlSerializer->getPmml()->asXML(); }
/** * @param Task $task * @param bool $includeFrequencies=true * @return \SimpleXMLElement */ private function prepareTaskGuhaPmml(Task $task, $includeFrequencies = true) { /** @var Metasource $metasource */ $pmmlSerializer = $this->xmlSerializersFactory->createGuhaPmmlSerializer($task, null); $pmmlSerializer->appendTaskSettings(); $pmmlSerializer->appendDataDictionary($includeFrequencies); $pmmlSerializer->appendTransformationDictionary($includeFrequencies); $pmmlSerializer->appendRules(); return $pmmlSerializer->getPmml(); }
/** * Funkce pro definování úlohy na základě dat z EasyMineru * @return TaskState */ public function startMining() { $pmmlSerializer = $this->xmlSerializersFactory->createGuhaPmmlSerializer($this->task); $taskSettingsSerializer = new TaskSettingsSerializer($pmmlSerializer->getPmml()); $pmml = $taskSettingsSerializer->settingsFromJson($this->task->taskSettingsJson); //import úlohy a spuštění dolování... $numRequests = 1; sendRequest: $result = $this->queryPost($pmml, array('template' => self::PMML_LM_TEMPLATE)); $ok = strpos($result, 'kbierror') === false && !preg_match('/status=\\"failure\\"/', $result); if (++$numRequests < self::MAX_MINING_REQUESTS && !$ok) { sleep(self::REQUEST_DELAY); goto sendRequest; } $taskState = $this->parseTaskState($result); if ($taskState->rulesCount > 0) { try { $this->parseRulesPMML($result); } catch (\Exception $e) { } } return $taskState; }