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

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

        $predictions = [];

        foreach ($dataset as $sample) {
            $node = $this->search($sample);

            $predictions[] = $node instanceof Average
                ? $node->outcome()
                : null;
        }

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

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

        $predictions = [];

        foreach ($dataset as $sample) {
            $node = $this->search($sample);

            $predictions[] = $node instanceof Average
                ? $node->outcome()
                : null;
        }

        return $predictions;
    }
public function predict ( Dataset $ dataset ) : array { if ( $ this -> bare ( ) ) { throw new RuntimeException ( 'Estimator has not been trained.' ) ; } DatasetIsCompatibleWithEstimator :: check ( $ dataset , $ this ) ; $ predictions = [ ] ; foreach ( $ dataset as $ sample ) { $ node = $ this -> search ( $ sample ) ; $ predictions [ ] = $ node instanceof Average ? $ node -> outcome ( ) : null ; } return $ predictions ; }
Make a prediction based on the value of a terminal node in the tree.

@param \Rubix\ML\Datasets\Dataset $dataset
@throws \RuntimeException
@return array
Make a prediction based on the value of a terminal node in the tree .