original_string: protected function evaluateClassifier(Classifier $classifier)
      {
          $total = (float) array_sum($this->weights);
          $wrong = 0;
          foreach ($this->samples as $index => $sample) {
              $predicted = $classifier->predict($sample);
              if ($predicted != $this->targets[$index]) {
                  $wrong += $this->weights[$index];
              }
          }
  
          return $wrong / $total;
      }
code: protected function evaluateClassifier(Classifier $classifier)
      {
          $total = (float) array_sum($this->weights);
          $wrong = 0;
          foreach ($this->samples as $index => $sample) {
              $predicted = $classifier->predict($sample);
              if ($predicted != $this->targets[$index]) {
                  $wrong += $this->weights[$index];
              }
          }
  
          return $wrong / $total;
      }
code_tokens: protected function evaluateClassifier ( Classifier $ classifier ) { $ total = ( float ) array_sum ( $ this -> weights ) ; $ wrong = 0 ; foreach ( $ this -> samples as $ index => $ sample ) { $ predicted = $ classifier -> predict ( $ sample ) ; if ( $ predicted != $ this -> targets [ $ index ] ) { $ wrong += $ this -> weights [ $ index ] ; } } return $ wrong / $ total ; }
docstring: Evaluates the classifier and returns the classification error rate
  
  @param Classifier $classifier
  
  @return float
docstring_tokens: Evaluates the classifier and returns the classification error rate