dataframe-learn-2.4.1.0: Interpretable, expression-returning machine learning for the dataframe ecosystem.
Safe HaskellNone
LanguageHaskell2010

DataFrame.DecisionTree.Fit

Description

Top-level fitting: assemble the candidate pool, seed from CART, run TAO, and convert the result to an expression. Also the probability-tree variant (fitProbTree) that annotates leaves with class distributions.

Synopsis

Documentation

treeToExpr :: Columnable a => Tree a -> Expr a Source #

Convert a fitted tree to a nested-conditional expression.

fitDecisionTree :: (Columnable a, Ord a) => TreeConfig -> Expr a -> DataFrame -> Expr a Source #

Fit a TAO decision tree (CART-seeded) and return it as an expression.

buildTree :: (Columnable a, Ord a) => TreeConfig -> Int -> Text -> [Expr Bool] -> DataFrame -> Expr a Source #

Fit a tree at a given depth from a raw condition list (CART + TAO + prune).

calculateGini :: (Columnable a, Ord a) => Text -> DataFrame -> Double Source #

Laplace-smoothed Gini impurity of the target distribution.

percentile :: Int -> Expr Double -> DataFrame -> Double Source #

The p-th percentile of an expression's values (0 on failure/empty).

type ProbTree a = Tree (Map a Double) Source #

A tree whose leaves hold class-probability distributions.

probsFromIndices :: (Columnable a, Ord a) => Text -> DataFrame -> Vector Int -> Map a Double Source #

Normalised class probabilities over a subset of training rows.

buildProbTree :: (Columnable a, Ord a) => Tree a -> Text -> DataFrame -> Vector Int -> ProbTree a Source #

Re-label a fitted tree's leaves with class distributions, routing the training data through the (unchanged) split conditions.

fitProbTree :: (Columnable a, Ord a) => TreeConfig -> Expr a -> DataFrame -> Map a (Expr Double) Source #

Fit a TAO tree and return one probability expression per class.

probExprs :: (Columnable a, Ord a) => ProbTree a -> Map a (Expr Double) Source #

Convert a ProbTree into one Expr Double per class.