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

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

        foreach ($this->dump() as $node) {
            if ($node instanceof Decision) {
                $index = $node->column();

                $importances[$index] += $node->purityIncrease();
            }
        }

        $total = array_sum($importances) ?: self::BETA;

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

        arsort($importances);

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

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

        foreach ($this->dump() as $node) {
            if ($node instanceof Decision) {
                $index = $node->column();

                $importances[$index] += $node->purityIncrease();
            }
        }

        $total = array_sum($importances) ?: self::BETA;

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

        arsort($importances);

        return $importances;
    }
public function featureImportances ( ) : array { if ( ! $ this -> root ) { return [ ] ; } $ importances = array_fill ( 0 , $ this -> featureCount , 0. ) ; foreach ( $ this -> dump ( ) as $ node ) { if ( $ node instanceof Decision ) { $ index = $ node -> column ( ) ; $ importances [ $ index ] += $ node -> purityIncrease ( ) ; } } $ total = array_sum ( $ importances ) ? : self :: BETA ; foreach ( $ importances as & $ importance ) { $ importance /= $ total ; } arsort ( $ importances ) ; return $ importances ; }
Return an array indexed by feature column that contains the normalized
importance score of that feature.

@return array
Return an array indexed by feature column that contains the normalized importance score of that feature .