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;
    }