| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
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
- treeToExpr :: Columnable a => Tree a -> Expr a
- fitDecisionTree :: (Columnable a, Ord a) => TreeConfig -> Expr a -> DataFrame -> Expr a
- buildTree :: (Columnable a, Ord a) => TreeConfig -> Int -> Text -> [Expr Bool] -> DataFrame -> Expr a
- pruneTree :: Columnable a => Expr a -> Expr a
- partitionDataFrame :: Expr Bool -> DataFrame -> (DataFrame, DataFrame)
- calculateGini :: (Columnable a, Ord a) => Text -> DataFrame -> Double
- majorityValue :: (Columnable a, Ord a) => Text -> DataFrame -> a
- getCounts :: (Columnable a, Ord a) => Text -> DataFrame -> Map a Int
- percentile :: Int -> Expr Double -> DataFrame -> Double
- type ProbTree a = Tree (Map a Double)
- probsFromIndices :: (Columnable a, Ord a) => Text -> DataFrame -> Vector Int -> Map a Double
- buildProbTree :: (Columnable a, Ord a) => Tree a -> Text -> DataFrame -> Vector Int -> ProbTree a
- fitProbTree :: (Columnable a, Ord a) => TreeConfig -> Expr a -> DataFrame -> Map a (Expr Double)
- probExprs :: (Columnable a, Ord a) => ProbTree a -> Map a (Expr Double)
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.
majorityValue :: (Columnable a, Ord a) => Text -> DataFrame -> a Source #
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.