protected function membership(array $sample) : array
    {
        $membership = $deltas = [];

        foreach ($this->centroids as $centroid) {
            $deltas[] = $this->kernel->compute($sample, $centroid);
        }

        foreach ($this->centroids as $cluster => $centroid) {
            $alpha = $this->kernel->compute($sample, $centroid);

            $sigma = 0.;

            foreach ($deltas as $delta) {
                $sigma += ($alpha / ($delta ?: EPSILON)) ** $this->lambda;
            }

            $membership[$cluster] = 1. / ($sigma ?: EPSILON);
        }

        return $membership;
    }
protected function membership(array $sample) : array
    {
        $membership = $deltas = [];

        foreach ($this->centroids as $centroid) {
            $deltas[] = $this->kernel->compute($sample, $centroid);
        }

        foreach ($this->centroids as $cluster => $centroid) {
            $alpha = $this->kernel->compute($sample, $centroid);

            $sigma = 0.;

            foreach ($deltas as $delta) {
                $sigma += ($alpha / ($delta ?: EPSILON)) ** $this->lambda;
            }

            $membership[$cluster] = 1. / ($sigma ?: EPSILON);
        }

        return $membership;
    }
protected function membership ( array $ sample ) : array { $ membership = $ deltas = [ ] ; foreach ( $ this -> centroids as $ centroid ) { $ deltas [ ] = $ this -> kernel -> compute ( $ sample , $ centroid ) ; } foreach ( $ this -> centroids as $ cluster => $ centroid ) { $ alpha = $ this -> kernel -> compute ( $ sample , $ centroid ) ; $ sigma = 0. ; foreach ( $ deltas as $ delta ) { $ sigma += ( $ alpha / ( $ delta ? : EPSILON ) ) ** $ this -> lambda ; } $ membership [ $ cluster ] = 1. / ( $ sigma ? : EPSILON ) ; } return $ membership ; }
Return the membership of a sample to each of the c centroids.

@param array $sample
@return array
Return the membership of a sample to each of the c centroids .