本文整理汇总了PHP中Timer::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Timer::format方法的具体用法?PHP Timer::format怎么用?PHP Timer::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::format方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
// wygeneruj wyniki testowe i zapisz je
$str = "Wyniki cz±stkowe (dla ka¿dej 50-ki) i ³±czne dla klasyfikatora {$k}, pakiet komentarzy {$idc}, test {$sub}\n\n";
$str .= "PoNk | TP | TN | FP | FN | UC | Precis | Recall | F1 | accurP | accurN | accura | errorP | errorN | error | unclas\n";
$template = "%4s | %3d | %3d | %3d | %3d | %3d | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f\n";
foreach ($partialResults["{$sub}_{$idc}"] as $kk => &$vv) {
$t =& $vv[$k];
$str .= sprintf($template, $kk, $t['TP'], $t['TN'], $t['FP'], $t['FN'], $t['UC'], 100 * $t['precision'], 100 * $t['recall'], 100 * $t['F1'], 100 * $t['accuracyP'], 100 * $t['accuracyN'], 100 * $t['accuracy'], 100 * $t['errorP'], 100 * $t['errorN'], 100 * $t['error'], 100 * $t['unclassified']);
}
$t =& $summedResults["{$sub}_{$idc}"][$k];
$str .= sprintf("\nSUMA | %3d | %3d | %3d | %3d | %3d | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f | %6.2f\n", $t['TP'], $t['TN'], $t['FP'], $t['FN'], $t['UC'], 100 * $t['precision'], 100 * $t['recall'], 100 * $t['F1'], 100 * $t['accuracyP'], 100 * $t['accuracyN'], 100 * $t['accuracy'], 100 * $t['errorP'], 100 * $t['errorN'], 100 * $t['error'], 100 * $t['unclassified']);
file_put_contents($directory . '/' . sprintf($resultsFileTemp, $idc, $k, $sub), $str);
}
}
}
// zapisz wyniki czasowe do odpowiednich plików
for ($idc = 1; $idc <= 3; ++$idc) {
$str = "¦rednia suma czasów wykonania poszczególnych metod dla pakietu komentarzy {$idc}\n\n";
$str .= "Metoda ";
foreach ($times["{$idc}"]['Winnow'] as $k => $v) {
$str .= sprintf("| %-15s ", $k);
}
$str .= "\n";
foreach ($times["{$idc}"] as $k => &$v) {
$str .= sprintf("%-7s ", $k);
foreach ($v as $kk => $vv) {
$str .= sprintf("| %-15s ", Timer::format($vv / $subTests));
}
$str .= "\n";
}
file_put_contents($directory . '/' . sprintf($timeFileTemp, $idc), $str);
}
示例2: foreach
$classifiers[$k] = $v[$_POST['set']];
if ($suppressThreshold) {
$classifiers[$k]['threshold'] = 0.0;
}
}
}
// utwórz obiekty klasyfikatorów, obiekty czasomierzy a nastêpnie klasyfikuj
foreach ($classifiers as $k => $v) {
$tmpc = new ReflectionClass($k);
$classObj[$k] = $tmpc->newInstance($db, $dictionaries, $_POST['set'], false, $v);
$time = new Timer();
if (is_null($prepText)) {
$time->set('start');
$prepText = $classObj[$k]->doPreparation($_POST['comment']);
$time->set('doPreparation');
$prepResult['time'] = '<b>' . $time->format($time->get('doPreparation')) . '</b>';
if ($prepText === false) {
break;
}
}
$time->set('start');
$results[$k] = $classObj[$k]->doClassify($prepText, true);
$time->set('doClassify');
$times[$k] = $time->format($time->get('doClassify'));
}
unset($classObj);
$prepResult['org'] = $_POST['comment'];
?>
<!--<h4>Testowany komentarz</h4>
<textarea readonly="true" cols="60" rows="15" name="comment" id="comment" title="Tre¶æ komentarza">
<?php