public function featureImportances() : array
    {
        if (!$this->forest or !$this->featureCount) {
            return [];
        }

        $importances = array_fill(0, $this->featureCount, 0.);

        foreach ($this->forest as $tree) {
            foreach ($tree->featureImportances() as $column => $value) {
                $importances[$column] += $value;
            }
        }

        $k = count($this->forest);

        foreach ($importances as &$importance) {
            $importance /= $k;
        }

        return $importances;
    }
public function featureImportances() : array
    {
        if (!$this->forest or !$this->featureCount) {
            return [];
        }

        $importances = array_fill(0, $this->featureCount, 0.);

        foreach ($this->forest as $tree) {
            foreach ($tree->featureImportances() as $column => $value) {
                $importances[$column] += $value;
            }
        }

        $k = count($this->forest);

        foreach ($importances as &$importance) {
            $importance /= $k;
        }

        return $importances;
    }
public function featureImportances ( ) : array { if ( ! $ this -> forest or ! $ this -> featureCount ) { return [ ] ; } $ importances = array_fill ( 0 , $ this -> featureCount , 0. ) ; foreach ( $ this -> forest as $ tree ) { foreach ( $ tree -> featureImportances ( ) as $ column => $ value ) { $ importances [ $ column ] += $ value ; } } $ k = count ( $ this -> forest ) ; foreach ( $ importances as & $ importance ) { $ importance /= $ k ; } return $ importances ; }
Return the feature importances calculated during training keyed by
feature column.

@throws \RuntimeException
@return array
Return the feature importances calculated during training keyed by feature column .