original_string: protected function runTraining(array $samples, array $targets): void
      {
          // The cost function is the sum of squares
          $callback = function ($weights, $sample, $target) {
              $this->weights = $weights;
  
              $output = $this->output($sample);
              $gradient = $output - $target;
              $error = $gradient ** 2;
  
              return [$error, $gradient];
          };
  
          $isBatch = $this->trainingType == self::BATCH_TRAINING;
  
          parent::runGradientDescent($samples, $targets, $callback, $isBatch);
      }
code: protected function runTraining(array $samples, array $targets): void
      {
          // The cost function is the sum of squares
          $callback = function ($weights, $sample, $target) {
              $this->weights = $weights;
  
              $output = $this->output($sample);
              $gradient = $output - $target;
              $error = $gradient ** 2;
  
              return [$error, $gradient];
          };
  
          $isBatch = $this->trainingType == self::BATCH_TRAINING;
  
          parent::runGradientDescent($samples, $targets, $callback, $isBatch);
      }
code_tokens: protected function runTraining ( array $ samples , array $ targets ) : void { // The cost function is the sum of squares $ callback = function ( $ weights , $ sample , $ target ) { $ this -> weights = $ weights ; $ output = $ this -> output ( $ sample ) ; $ gradient = $ output - $ target ; $ error = $ gradient ** 2 ; return [ $ error , $ gradient ] ; } ; $ isBatch = $ this -> trainingType == self :: BATCH_TRAINING ; parent :: runGradientDescent ( $ samples , $ targets , $ callback , $ isBatch ) ; }
docstring: Adapts the weights with respect to given samples and targets
  by use of gradient descent learning rule
docstring_tokens: Adapts the weights with respect to given samples and targets by use of gradient descent learning rule