original_string: protected function getBestClassifier(): Classifier
      {
          $ref = new ReflectionClass($this->baseClassifier);
          /** @var Classifier $classifier */
          $classifier = count($this->classifierOptions) === 0 ? $ref->newInstance() : $ref->newInstanceArgs($this->classifierOptions);
  
          if ($classifier instanceof WeightedClassifier) {
              $classifier->setSampleWeights($this->weights);
              $classifier->train($this->samples, $this->targets);
          } else {
              [$samples, $targets] = $this->resample();
              $classifier->train($samples, $targets);
          }
  
          return $classifier;
      }
code: protected function getBestClassifier(): Classifier
      {
          $ref = new ReflectionClass($this->baseClassifier);
          /** @var Classifier $classifier */
          $classifier = count($this->classifierOptions) === 0 ? $ref->newInstance() : $ref->newInstanceArgs($this->classifierOptions);
  
          if ($classifier instanceof WeightedClassifier) {
              $classifier->setSampleWeights($this->weights);
              $classifier->train($this->samples, $this->targets);
          } else {
              [$samples, $targets] = $this->resample();
              $classifier->train($samples, $targets);
          }
  
          return $classifier;
      }
code_tokens: protected function getBestClassifier ( ) : Classifier { $ ref = new ReflectionClass ( $ this -> baseClassifier ) ; /** @var Classifier $classifier */ $ classifier = count ( $ this -> classifierOptions ) === 0 ? $ ref -> newInstance ( ) : $ ref -> newInstanceArgs ( $ this -> classifierOptions ) ; if ( $ classifier instanceof WeightedClassifier ) { $ classifier -> setSampleWeights ( $ this -> weights ) ; $ classifier -> train ( $ this -> samples , $ this -> targets ) ; } else { [ $ samples , $ targets ] = $ this -> resample ( ) ; $ classifier -> train ( $ samples , $ targets ) ; } return $ classifier ; }
docstring: Returns the classifier with the lowest error rate with the
  consideration of current sample weights
docstring_tokens: Returns the classifier with the lowest error rate with the consideration of current sample weights