当前位置: 首页>>代码示例>>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;未经允许,请勿转载。