original_string: protected function get_phi($testlabels, $predictedlabels) {
  
          // Binary here only as well.
          $matrix = \Phpml\Metric\ConfusionMatrix::compute($testlabels, $predictedlabels, array(0, 1));
  
          $tptn = $matrix[0][0] * $matrix[1][1];
          $fpfn = $matrix[1][0] * $matrix[0][1];
          $tpfp = $matrix[0][0] + $matrix[1][0];
          $tpfn = $matrix[0][0] + $matrix[0][1];
          $tnfp = $matrix[1][1] + $matrix[1][0];
          $tnfn = $matrix[1][1] + $matrix[0][1];
          if ($tpfp === 0 || $tpfn === 0 || $tnfp === 0 || $tnfn === 0) {
              $phi = 0;
          } else {
              $phi = ( $tptn - $fpfn ) / sqrt( $tpfp * $tpfn * $tnfp * $tnfn);
          }
  
          return $phi;
      }
code: protected function get_phi($testlabels, $predictedlabels) {
  
          // Binary here only as well.
          $matrix = \Phpml\Metric\ConfusionMatrix::compute($testlabels, $predictedlabels, array(0, 1));
  
          $tptn = $matrix[0][0] * $matrix[1][1];
          $fpfn = $matrix[1][0] * $matrix[0][1];
          $tpfp = $matrix[0][0] + $matrix[1][0];
          $tpfn = $matrix[0][0] + $matrix[0][1];
          $tnfp = $matrix[1][1] + $matrix[1][0];
          $tnfn = $matrix[1][1] + $matrix[0][1];
          if ($tpfp === 0 || $tpfn === 0 || $tnfp === 0 || $tnfn === 0) {
              $phi = 0;
          } else {
              $phi = ( $tptn - $fpfn ) / sqrt( $tpfp * $tpfn * $tnfp * $tnfn);
          }
  
          return $phi;
      }
code_tokens: protected function get_phi ( $ testlabels , $ predictedlabels ) { // Binary here only as well. $ matrix = \ Phpml \ Metric \ ConfusionMatrix :: compute ( $ testlabels , $ predictedlabels , array ( 0 , 1 ) ) ; $ tptn = $ matrix [ 0 ] [ 0 ] * $ matrix [ 1 ] [ 1 ] ; $ fpfn = $ matrix [ 1 ] [ 0 ] * $ matrix [ 0 ] [ 1 ] ; $ tpfp = $ matrix [ 0 ] [ 0 ] + $ matrix [ 1 ] [ 0 ] ; $ tpfn = $ matrix [ 0 ] [ 0 ] + $ matrix [ 0 ] [ 1 ] ; $ tnfp = $ matrix [ 1 ] [ 1 ] + $ matrix [ 1 ] [ 0 ] ; $ tnfn = $ matrix [ 1 ] [ 1 ] + $ matrix [ 0 ] [ 1 ] ; if ( $ tpfp === 0 || $ tpfn === 0 || $ tnfp === 0 || $ tnfn === 0 ) { $ phi = 0 ; } else { $ phi = ( $ tptn - $ fpfn ) / sqrt ( $ tpfp * $ tpfn * $ tnfp * $ tnfn ) ; } return $ phi ; }
docstring: Returns the Phi correlation coefficient.
  
  @param array $testlabels
  @param array $predictedlabels
  @return float
docstring_tokens: Returns the Phi correlation coefficient .