当前位置: 首页>>代码示例>>PHP>>正文


PHP pts_math::standard_deviation方法代码示例

本文整理汇总了PHP中pts_math::standard_deviation方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_math::standard_deviation方法的具体用法?PHP pts_math::standard_deviation怎么用?PHP pts_math::standard_deviation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pts_math的用法示例。


在下文中一共展示了pts_math::standard_deviation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_graph_bars

 protected function render_graph_bars()
 {
     $bar_count = count($this->graph_data);
     $separator_width = ($a = 8 - floor($bar_count / 2) * 2) > 0 ? $a : 0;
     $bar_width = floor(($this->i['identifier_width'] - $separator_width - $bar_count * $separator_width) / $bar_count);
     for ($i_o = 0; $i_o < $bar_count; $i_o++) {
         $paint_color = $this->get_paint_color(isset($this->graph_data_title[$i_o]) ? $this->graph_data_title[$i_o] : null);
         foreach (array_keys($this->graph_data[$i_o]) as $i) {
             $value = pts_math::set_precision($this->graph_data[$i_o][$i], 2);
             $graph_size = round($value / $this->i['graph_max_value'] * ($this->i['graph_top_end'] - $this->i['top_start']));
             $value_plot_top = max($this->i['graph_top_end'] + 1 - $graph_size, 1);
             $px_bound_left = $this->i['left_start'] + $this->i['identifier_width'] * $i + $bar_width * $i_o + $separator_width * ($i_o + 1);
             $px_bound_right = $px_bound_left + $bar_width;
             $title_tooltip = $this->graph_identifiers[$i] . ': ' . $value;
             $run_std_deviation = isset($this->graph_data_raw[$i_o][$i]) ? pts_math::standard_deviation(pts_strings::colon_explode($this->graph_data_raw[$i_o][$i])) : 0;
             if ($run_std_deviation > 0) {
                 $title_tooltip .= ' || ' . pts_math::set_precision($run_std_deviation, 1) . ' STD';
             }
             $this->svg_dom->add_element('rect', array('x' => $px_bound_left + 1, 'y' => $value_plot_top, 'width' => $bar_width, 'height' => $this->i['graph_top_end'] - $value_plot_top, 'fill' => in_array($this->graph_identifiers[$i], $this->value_highlights) ? self::$c['color']['alert'] : $paint_color, 'stroke' => self::$c['color']['body_light'], 'stroke-width' => 1, 'xlink:title' => $title_tooltip));
             if ($px_bound_right - $px_bound_left < 15) {
                 // The bars are too skinny to be able to plot anything on them
                 continue;
             }
             $x = $px_bound_left + ($px_bound_right - $px_bound_left) / 2;
             if ($graph_size > 18) {
                 $this->svg_dom->add_text_element($value, array('x' => $x, 'y' => $value_plot_top + 2, 'font-size' => floor(self::$c['size']['bars'] * 0.9), 'fill' => self::$c['color']['body_text'], 'text-anchor' => 'middle', 'dominant-baseline' => 'text-before-edge'));
             } else {
                 // Make things more compact
                 $this->svg_dom->add_text_element($value, array('x' => $x, 'y' => $value_plot_top + 2, 'font-size' => floor(self::$c['size']['bars'] * 0.6), 'fill' => self::$c['color']['body_text'], 'text-anchor' => 'middle', 'dominant-baseline' => 'text-before-edge'));
             }
         }
     }
     // write a new line along the bottom since the draw_rectangle_with_border above had written on top of it
     $this->svg_dom->draw_svg_line($this->i['left_start'], $this->i['graph_top_end'], $this->i['graph_left_end'], $this->i['graph_top_end'], self::$c['color']['notches'], 1);
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:35,代码来源:pts_VerticalBarGraph.php

示例2: percent_standard_deviation

 public static function percent_standard_deviation($values)
 {
     if (count($values) == 0) {
         // No values
         return 0;
     }
     $standard_deviation = pts_math::standard_deviation($values);
     $average_value = array_sum($values) / count($values);
     return $average_value != 0 ? $standard_deviation / $average_value * 100 : 0;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:10,代码来源:pts_math.php

示例3: result_file_to_result_table

 public static function result_file_to_result_table(&$result_file, &$system_id_keys = null, &$result_object_index = -1, &$flag_delta_results = false, $extra_attributes = null)
 {
     $result_table = array();
     $result_tests = array();
     $result_counter = 0;
     foreach ($result_file->get_system_identifiers() as $sys_identifier) {
         $result_table[$sys_identifier] = null;
     }
     foreach ($result_file->get_result_objects($result_object_index) as $ri => $result_object) {
         if ($result_object->test_profile->get_identifier() == null) {
             continue;
         }
         if ($extra_attributes != null) {
             if (isset($extra_attributes['reverse_result_buffer'])) {
                 $result_object->test_result_buffer->buffer_values_reverse();
             }
             if (isset($extra_attributes['normalize_result_buffer'])) {
                 if (isset($extra_attributes['highlight_graph_values']) && is_array($extra_attributes['highlight_graph_values']) && count($extra_attributes['highlight_graph_values']) == 1) {
                     $normalize_against = $extra_attributes['highlight_graph_values'][0];
                 } else {
                     $normalize_against = false;
                 }
                 $result_object->normalize_buffer_values($normalize_against);
             }
         }
         if ($result_object_index != -1) {
             if (is_array($result_object_index)) {
                 $result_tests[$result_counter] = new pts_graph_ir_value($result_object->get_arguments_description());
             } else {
                 $result_tests[$result_counter] = new pts_graph_ir_value('Results');
             }
         } else {
             $result_tests[$result_counter] = new pts_graph_ir_value($result_object->test_profile->get_title());
             $result_tests[$result_counter]->set_attribute('title', $result_object->get_arguments_description());
             if ($result_object->test_profile->get_identifier() != null) {
                 $result_tests[$result_counter]->set_attribute('href', 'http://openbenchmarking.org/test/' . $result_object->test_profile->get_identifier());
             }
         }
         if ($result_object->test_profile->get_identifier() == null) {
             if ($result_object->test_profile->get_display_format() == 'BAR_GRAPH') {
                 $result_tests[$result_counter]->set_attribute('alert', true);
                 foreach ($result_object->test_result_buffer->get_buffer_items() as $index => $buffer_item) {
                     $identifier = $buffer_item->get_result_identifier();
                     $value = $buffer_item->get_result_value();
                     $result_table[$identifier][$result_counter] = new pts_graph_ir_value($value, array('alert' => true));
                 }
                 $result_counter++;
             }
             continue;
         }
         switch ($result_object->test_profile->get_display_format()) {
             case 'BAR_GRAPH':
                 $best_value = 0;
                 $worst_value = 0;
                 if (!defined('PHOROMATIC_TRACKER') && count($result_object->test_result_buffer->get_values()) > 1) {
                     switch ($result_object->test_profile->get_result_proportion()) {
                         case 'HIB':
                             $best_value = max($result_object->test_result_buffer->get_values());
                             $worst_value = min($result_object->test_result_buffer->get_values());
                             break;
                         case 'LIB':
                             $best_value = min($result_object->test_result_buffer->get_values());
                             $worst_value = max($result_object->test_result_buffer->get_values());
                             break;
                     }
                 }
                 $prev_value = 0;
                 $prev_identifier = null;
                 $prev_identifier_0 = null;
                 $values_in_buffer = $result_object->test_result_buffer->get_values();
                 sort($values_in_buffer);
                 $min_value_in_buffer = $values_in_buffer[0];
                 if ($min_value_in_buffer == 0) {
                     // Go through the values until something not 0, otherwise down in the code will be a divide by zero
                     for ($i = 1; $i < count($values_in_buffer) && $min_value_in_buffer == 0; $i++) {
                         $min_value_in_buffer = $values_in_buffer[$i];
                     }
                 }
                 $max_value_in_buffer = $values_in_buffer[count($values_in_buffer) - 1];
                 foreach ($result_object->test_result_buffer->get_buffer_items() as $index => $buffer_item) {
                     $identifier = $buffer_item->get_result_identifier();
                     $value = $buffer_item->get_result_value();
                     $raw_values = pts_strings::colon_explode($buffer_item->get_result_raw());
                     $percent_std = pts_math::set_precision(pts_math::percent_standard_deviation($raw_values), 2);
                     $std_error = pts_math::set_precision(pts_math::standard_error($raw_values), 2);
                     $delta = 0;
                     if (defined('PHOROMATIC_TRACKER')) {
                         $identifier_r = pts_strings::colon_explode($identifier);
                         if ($identifier_r[0] == $prev_identifier_0 && $prev_value != 0) {
                             $delta = pts_math::set_precision(abs(1 - $value / $prev_value), 4);
                             if ($delta > 0.02 && $delta > pts_math::standard_deviation($raw_values)) {
                                 switch ($result_object->test_profile->get_result_proportion()) {
                                     case 'HIB':
                                         if ($value < $prev_value) {
                                             $delta = 0 - $delta;
                                         }
                                         break;
                                     case 'LIB':
                                         if ($value > $prev_value) {
                                             $delta = 0 - $delta;
//.........这里部分代码省略.........
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:101,代码来源:pts_ResultFileTable.php


注:本文中的pts_math::standard_deviation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。