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);
    }
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);
    }
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 ) ; }
Trains the algorithm to transform the given data to a lower dimensional space.
Trains the algorithm to transform the given data to a lower dimensional space .