本文整理匯總了PHP中Dataset::getFood方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dataset::getFood方法的具體用法?PHP Dataset::getFood怎麽用?PHP Dataset::getFood使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dataset
的用法示例。
在下文中一共展示了Dataset::getFood方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Dataset
<font size="2">
Note: adjust the server parameter settings in order to
cope with a long training time.
</font>
</p>
<hr>
<?php
if (isset($_POST["gotrain"])) {
if ($_POST["gotrain"] == "true") {
if ($_FILES["datafile"]["error"] > 0 || empty($_POST["newdbname"])) {
echo "Error!!! Missing parameters!\n";
} else {
try {
echo "<p>Loading dataset... ";
$dataset = new Dataset();
list($text, $labs) = $dataset->getFood($_FILES["datafile"]["tmp_name"]);
echo "OK</p>";
echo "<p>Training model... ";
$classifier = new MultinomialNaiveBayes();
$classifier->train($text, $labs);
echo "OK</p>";
echo "<p>Saving parameters... ";
$classifier->setDatabase($_POST["newdbname"]);
$classifier->save();
echo "OK</p>";
echo "<p><b>Training process completed " . "successfully!</b></p>";
} catch (Exception $e) {
echo "Caught exception: " . $e->getMessage() . "\n";
}
}
}