original_string: protected function resample(): array
      {
          $weights = $this->weights;
          $std = StandardDeviation::population($weights);
          $mean = Mean::arithmetic($weights);
          $min = min($weights);
          $minZ = (int) round(($min - $mean) / $std);
  
          $samples = [];
          $targets = [];
          foreach ($weights as $index => $weight) {
              $z = (int) round(($weight - $mean) / $std) - $minZ + 1;
              for ($i = 0; $i < $z; ++$i) {
                  if (random_int(0, 1) == 0) {
                      continue;
                  }
  
                  $samples[] = $this->samples[$index];
                  $targets[] = $this->targets[$index];
              }
          }
  
          return [$samples, $targets];
      }
code: protected function resample(): array
      {
          $weights = $this->weights;
          $std = StandardDeviation::population($weights);
          $mean = Mean::arithmetic($weights);
          $min = min($weights);
          $minZ = (int) round(($min - $mean) / $std);
  
          $samples = [];
          $targets = [];
          foreach ($weights as $index => $weight) {
              $z = (int) round(($weight - $mean) / $std) - $minZ + 1;
              for ($i = 0; $i < $z; ++$i) {
                  if (random_int(0, 1) == 0) {
                      continue;
                  }
  
                  $samples[] = $this->samples[$index];
                  $targets[] = $this->targets[$index];
              }
          }
  
          return [$samples, $targets];
      }
code_tokens: protected function resample ( ) : array { $ weights = $ this -> weights ; $ std = StandardDeviation :: population ( $ weights ) ; $ mean = Mean :: arithmetic ( $ weights ) ; $ min = min ( $ weights ) ; $ minZ = ( int ) round ( ( $ min - $ mean ) / $ std ) ; $ samples = [ ] ; $ targets = [ ] ; foreach ( $ weights as $ index => $ weight ) { $ z = ( int ) round ( ( $ weight - $ mean ) / $ std ) - $ minZ + 1 ; for ( $ i = 0 ; $ i < $ z ; ++ $ i ) { if ( random_int ( 0 , 1 ) == 0 ) { continue ; } $ samples [ ] = $ this -> samples [ $ index ] ; $ targets [ ] = $ this -> targets [ $ index ] ; } } return [ $ samples , $ targets ] ; }
docstring: Resamples the dataset in accordance with the weights and
  returns the new dataset
docstring_tokens: Resamples the dataset in accordance with the weights and returns the new dataset