lib/Model/Variant.php
public function computeStats()
    {
        $this->rejects = [];
        $revs = $this->getRevolutions();

        if (0 === count($this->iterations)) {
            return;
        }

        $times = $this->getMetricValuesByRev(TimeResult::class, 'net');
        $retryThreshold = $this->getSubject()->getRetryThreshold();

        $this->stats = new Distribution($times, $this->computedStats);

        foreach ($this->iterations as $iteration) {
            $timeResult = $iteration->getResult(TimeResult::class);
            assert($timeResult instanceof TimeResult);
            // deviation is the percentage different of the value from the mean of the set.
            if ($this->stats->getMean() > 0) {
                $deviation = 100 / $this->stats->getMean() * (
                    (
                        $timeResult->getRevTime($iteration->getVariant()->getRevolutions())
                    ) - $this->stats->getMean()
                );
            } else {
                $deviation = 0;
            }

            // the Z-Value represents the number of standard deviations this
            // value is away from the mean.
            $revTime = $timeResult->getRevTime($revs);
            $zValue = $this->stats->getStdev() ? ($revTime - $this->stats->getMean()) / $this->stats->getStdev() : 0;

            if (null !== $retryThreshold) {
                if (abs($deviation) >= $retryThreshold) {
                    $this->rejects[] = $iteration;
                }
            }

            $iteration->setResult(new ComputedResult($zValue, $deviation));
        }

        $this->computed = true;
    }
public function computeStats()
    {
        $this->rejects = [];
        $revs = $this->getRevolutions();

        if (0 === count($this->iterations)) {
            return;
        }

        $times = $this->getMetricValuesByRev(TimeResult::class, 'net');
        $retryThreshold = $this->getSubject()->getRetryThreshold();

        $this->stats = new Distribution($times, $this->computedStats);

        foreach ($this->iterations as $iteration) {
            $timeResult = $iteration->getResult(TimeResult::class);
            assert($timeResult instanceof TimeResult);
            // deviation is the percentage different of the value from the mean of the set.
            if ($this->stats->getMean() > 0) {
                $deviation = 100 / $this->stats->getMean() * (
                    (
                        $timeResult->getRevTime($iteration->getVariant()->getRevolutions())
                    ) - $this->stats->getMean()
                );
            } else {
                $deviation = 0;
            }

            // the Z-Value represents the number of standard deviations this
            // value is away from the mean.
            $revTime = $timeResult->getRevTime($revs);
            $zValue = $this->stats->getStdev() ? ($revTime - $this->stats->getMean()) / $this->stats->getStdev() : 0;

            if (null !== $retryThreshold) {
                if (abs($deviation) >= $retryThreshold) {
                    $this->rejects[] = $iteration;
                }
            }

            $iteration->setResult(new ComputedResult($zValue, $deviation));
        }

        $this->computed = true;
    }
public function computeStats ( ) { $ this -> rejects = [ ] ; $ revs = $ this -> getRevolutions ( ) ; if ( 0 === count ( $ this -> iterations ) ) { return ; } $ times = $ this -> getMetricValuesByRev ( TimeResult :: class , 'net' ) ; $ retryThreshold = $ this -> getSubject ( ) -> getRetryThreshold ( ) ; $ this -> stats = new Distribution ( $ times , $ this -> computedStats ) ; foreach ( $ this -> iterations as $ iteration ) { $ timeResult = $ iteration -> getResult ( TimeResult :: class ) ; assert ( $ timeResult instanceof TimeResult ) ; // deviation is the percentage different of the value from the mean of the set. if ( $ this -> stats -> getMean ( ) > 0 ) { $ deviation = 100 / $ this -> stats -> getMean ( ) * ( ( $ timeResult -> getRevTime ( $ iteration -> getVariant ( ) -> getRevolutions ( ) ) ) - $ this -> stats -> getMean ( ) ) ; } else { $ deviation = 0 ; } // the Z-Value represents the number of standard deviations this // value is away from the mean. $ revTime = $ timeResult -> getRevTime ( $ revs ) ; $ zValue = $ this -> stats -> getStdev ( ) ? ( $ revTime - $ this -> stats -> getMean ( ) ) / $ this -> stats -> getStdev ( ) : 0 ; if ( null !== $ retryThreshold ) { if ( abs ( $ deviation ) >= $ retryThreshold ) { $ this -> rejects [ ] = $ iteration ; } } $ iteration -> setResult ( new ComputedResult ( $ zValue , $ deviation ) ) ; } $ this -> computed = true ; }
Calculate and set the deviation from the mean time for each iteration. If
the deviation is greater than the rejection threshold, then mark the iteration as
rejected.
Calculate and set the deviation from the mean time for each iteration . If the deviation is greater than the rejection threshold then mark the iteration as rejected .