original_string: public function fit(array $data, array $classes): array
      {
          $this->labels = $this->getLabels($classes);
          $this->means = $this->calculateMeans($data, $classes);
  
          $sW = $this->calculateClassVar($data, $classes);
          $sB = $this->calculateClassCov();
  
          $S = $sW->inverse()->multiply($sB);
          $this->eigenDecomposition($S->toArray());
  
          $this->fit = true;
  
          return $this->reduce($data);
      }
code: public function fit(array $data, array $classes): array
      {
          $this->labels = $this->getLabels($classes);
          $this->means = $this->calculateMeans($data, $classes);
  
          $sW = $this->calculateClassVar($data, $classes);
          $sB = $this->calculateClassCov();
  
          $S = $sW->inverse()->multiply($sB);
          $this->eigenDecomposition($S->toArray());
  
          $this->fit = true;
  
          return $this->reduce($data);
      }
code_tokens: public function fit ( array $ data , array $ classes ) : array { $ this -> labels = $ this -> getLabels ( $ classes ) ; $ this -> means = $ this -> calculateMeans ( $ data , $ classes ) ; $ sW = $ this -> calculateClassVar ( $ data , $ classes ) ; $ sB = $ this -> calculateClassCov ( ) ; $ S = $ sW -> inverse ( ) -> multiply ( $ sB ) ; $ this -> eigenDecomposition ( $ S -> toArray ( ) ) ; $ this -> fit = true ; return $ this -> reduce ( $ data ) ; }
docstring: Trains the algorithm to transform the given data to a lower dimensional space.
docstring_tokens: Trains the algorithm to transform the given data to a lower dimensional space .