original_string: protected function updateWeights(Classifier $classifier, float $alpha)
      {
          $sumOfWeights = array_sum($this->weights);
          $weightsT1 = [];
          foreach ($this->weights as $index => $weight) {
              $desired = $this->targets[$index];
              $output = $classifier->predict($this->samples[$index]);
  
              $weight *= exp(-$alpha * $desired * $output) / $sumOfWeights;
  
              $weightsT1[] = $weight;
          }
  
          $this->weights = $weightsT1;
      }
code: protected function updateWeights(Classifier $classifier, float $alpha)
      {
          $sumOfWeights = array_sum($this->weights);
          $weightsT1 = [];
          foreach ($this->weights as $index => $weight) {
              $desired = $this->targets[$index];
              $output = $classifier->predict($this->samples[$index]);
  
              $weight *= exp(-$alpha * $desired * $output) / $sumOfWeights;
  
              $weightsT1[] = $weight;
          }
  
          $this->weights = $weightsT1;
      }
code_tokens: protected function updateWeights ( Classifier $ classifier , float $ alpha ) { $ sumOfWeights = array_sum ( $ this -> weights ) ; $ weightsT1 = [ ] ; foreach ( $ this -> weights as $ index => $ weight ) { $ desired = $ this -> targets [ $ index ] ; $ output = $ classifier -> predict ( $ this -> samples [ $ index ] ) ; $ weight *= exp ( - $ alpha * $ desired * $ output ) / $ sumOfWeights ; $ weightsT1 [ ] = $ weight ; } $ this -> weights = $ weightsT1 ; }
docstring: Updates the sample weights
  
  @param Classifier $classifier
  @param float $alpha
docstring_tokens: Updates the sample weights