當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Timer::format方法代碼示例

本文整理匯總了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);
}
開發者ID:gluwer,項目名稱:categorization,代碼行數:31,代碼來源:speed_goodness_test.php

示例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 
開發者ID:gluwer,項目名稱:categorization,代碼行數:31,代碼來源:demo.php


注:本文中的Timer::format方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。