public function predict(Dataset $dataset) : array
    {
        if (!$this->centroids) {
            throw new RuntimeException('Estimator has not been trained.');
        }

        DatasetIsCompatibleWithEstimator::check($dataset, $this);

        return array_map([self::class, 'assign'], $dataset->samples());
    }
public function predict(Dataset $dataset) : array
    {
        if (!$this->centroids) {
            throw new RuntimeException('Estimator has not been trained.');
        }

        DatasetIsCompatibleWithEstimator::check($dataset, $this);

        return array_map([self::class, 'assign'], $dataset->samples());
    }
public function predict ( Dataset $ dataset ) : array { if ( ! $ this -> centroids ) { throw new RuntimeException ( 'Estimator has not been trained.' ) ; } DatasetIsCompatibleWithEstimator :: check ( $ dataset , $ this ) ; return array_map ( [ self :: class , 'assign' ] , $ dataset -> samples ( ) ) ; }
Cluster the dataset by assigning a label to each sample.

@param \Rubix\ML\Datasets\Dataset $dataset
@throws \InvalidArgumentException
@throws \RuntimeException
@return array
Cluster the dataset by assigning a label to each sample .