MCordingley\Regression\Algorithm\GradientDescent\StoppingCriteria\MaxTime::converged PHP 메소드

converged() 공개 메소드

public converged ( array $gradient, array $coefficients ) : boolean
$gradient array
$coefficients array
리턴 boolean
    public function converged(array $gradient, array $coefficients) : bool
    {
        $time = time();
        if (!$this->startTime) {
            $this->startTime = $time;
        }
        $elapsed = $time - $this->startTime;
        return $elapsed >= $this->seconds;
    }

Usage Example

예제 #1
0
 public function testConverged()
 {
     $criteria = new MaxTime(1);
     static::assertFalse($criteria->converged([], []));
     sleep(2);
     static::assertTrue($criteria->converged([], []));
 }