original_string: protected function calculateClassVar($data, $classes)
      {
          // s is an n (number of classes) by m (number of column) matrix
          $s = array_fill(0, count($data[0]), array_fill(0, count($data[0]), 0));
          $sW = new Matrix($s, false);
  
          foreach ($data as $index => $row) {
              $label = array_search($classes[$index], $this->labels);
              $means = $this->means[$label];
  
              $row = $this->calculateVar($row, $means);
  
              $sW = $sW->add($row);
          }
  
          return $sW;
      }
code: protected function calculateClassVar($data, $classes)
      {
          // s is an n (number of classes) by m (number of column) matrix
          $s = array_fill(0, count($data[0]), array_fill(0, count($data[0]), 0));
          $sW = new Matrix($s, false);
  
          foreach ($data as $index => $row) {
              $label = array_search($classes[$index], $this->labels);
              $means = $this->means[$label];
  
              $row = $this->calculateVar($row, $means);
  
              $sW = $sW->add($row);
          }
  
          return $sW;
      }
code_tokens: protected function calculateClassVar ( $ data , $ classes ) { // s is an n (number of classes) by m (number of column) matrix $ s = array_fill ( 0 , count ( $ data [ 0 ] ) , array_fill ( 0 , count ( $ data [ 0 ] ) , 0 ) ) ; $ sW = new Matrix ( $ s , false ) ; foreach ( $ data as $ index => $ row ) { $ label = array_search ( $ classes [ $ index ] , $ this -> labels ) ; $ means = $ this -> means [ $ label ] ; $ row = $ this -> calculateVar ( $ row , $ means ) ; $ sW = $ sW -> add ( $ row ) ; } return $ sW ; }
docstring: Returns in-class scatter matrix for each class, which
  is a n by m matrix where n is number of classes and
  m is number of columns
  
  @param array $data
  @param array $classes
  
  @return Matrix
docstring_tokens: Returns in - class scatter matrix for each class which is a n by m matrix where n is number of classes and m is number of columns