| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.DecisionTree
Synopsis
- data TreeConfig = TreeConfig {}
- data SynthConfig = SynthConfig {}
- defaultSynthConfig :: SynthConfig
- defaultTreeConfig :: TreeConfig
- data Tree a
- treeDepth :: Tree a -> Int
- treeToExpr :: Columnable a => Tree a -> Expr a
- fitDecisionTree :: Columnable a => TreeConfig -> Expr a -> DataFrame -> Expr a
- taoOptimize :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Tree a
- taoIteration :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Tree a
- optimizeDepthLevel :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Int -> Tree a
- optimizeAtDepth :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Int -> Int -> Tree a
- optimizeNode :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Tree a
- findBestSplitTAO :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Tree a -> Expr Bool -> Expr Bool
- data CarePoint = CarePoint {
- cpIndex :: !Int
- cpCorrectDir :: !Direction
- data Direction
- identifyCarePoints :: Columnable a => Text -> DataFrame -> Vector Int -> Tree a -> Tree a -> [CarePoint]
- predictWithTree :: Columnable a => Text -> DataFrame -> Int -> Tree a -> a
- countCarePointErrors :: Expr Bool -> DataFrame -> [CarePoint] -> Int
- partitionIndices :: Expr Bool -> DataFrame -> Vector Int -> (Vector Int, Vector Int)
- majorityValueFromIndices :: Columnable a => Text -> DataFrame -> Vector Int -> a
- computeTreeLoss :: Columnable a => Text -> DataFrame -> Vector Int -> Tree a -> Double
- pruneDead :: Tree a -> Tree a
- pruneExpr :: (Columnable a, Eq a) => Expr a -> Expr a
- buildGreedyTree :: Columnable a => TreeConfig -> Int -> Text -> [Expr Bool] -> DataFrame -> Tree a
- findBestGreedySplit :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Maybe (Expr Bool)
- numericConditions :: TreeConfig -> DataFrame -> [Expr Bool]
- generateNumericConds :: TreeConfig -> DataFrame -> [Expr Bool]
- numericExprsWithTerms :: SynthConfig -> DataFrame -> [Expr Double]
- numericCols :: DataFrame -> [Expr Double]
- numericExprs :: SynthConfig -> DataFrame -> [Expr Double] -> Int -> Int -> [Expr Double]
- boolExprs :: DataFrame -> [Expr Bool] -> [Expr Bool] -> Int -> Int -> [Expr Bool]
- generateConditionsOld :: TreeConfig -> DataFrame -> [Expr Bool]
- partitionDataFrame :: Expr Bool -> DataFrame -> (DataFrame, DataFrame)
- calculateGini :: Columnable a => Text -> DataFrame -> Double
- majorityValue :: Columnable a => Text -> DataFrame -> a
- getCounts :: Columnable a => Text -> DataFrame -> Map a Int
- percentile :: Int -> Expr Double -> DataFrame -> Double
- buildTree :: Columnable a => TreeConfig -> Int -> Text -> [Expr Bool] -> DataFrame -> Expr a
- findBestSplit :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Maybe (Expr Bool)
- pruneTree :: (Columnable a, Eq a) => Expr a -> Expr a
Documentation
data TreeConfig Source #
Constructors
| TreeConfig | |
Fields
| |
Instances
| Show TreeConfig Source # | |
Defined in DataFrame.DecisionTree Methods showsPrec :: Int -> TreeConfig -> ShowS # show :: TreeConfig -> String # showList :: [TreeConfig] -> ShowS # | |
| Eq TreeConfig Source # | |
Defined in DataFrame.DecisionTree | |
data SynthConfig Source #
Constructors
| SynthConfig | |
Fields
| |
Instances
| Show SynthConfig Source # | |
Defined in DataFrame.DecisionTree Methods showsPrec :: Int -> SynthConfig -> ShowS # show :: SynthConfig -> String # showList :: [SynthConfig] -> ShowS # | |
| Eq SynthConfig Source # | |
Defined in DataFrame.DecisionTree | |
treeToExpr :: Columnable a => Tree a -> Expr a Source #
fitDecisionTree :: Columnable a => TreeConfig -> Expr a -> DataFrame -> Expr a Source #
Fit a TAO decision tree
taoOptimize :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Tree a Source #
taoIteration :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Tree a Source #
optimizeDepthLevel :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Int -> Tree a Source #
optimizeAtDepth :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Int -> Int -> Tree a Source #
optimizeNode :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Tree a Source #
findBestSplitTAO :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Vector Int -> Tree a -> Tree a -> Expr Bool -> Expr Bool Source #
A care point with its index and which direction leads to correct classification
Constructors
| CarePoint | |
Fields
| |
identifyCarePoints :: Columnable a => Text -> DataFrame -> Vector Int -> Tree a -> Tree a -> [CarePoint] Source #
Identify care points: points where exactly one subtree classifies correctly
For each point reaching the node: 1. Compute what label the left subtree would predict 2. Compute what label the right subtree would predict 3. If exactly one matches the true label, it's a care point 4. Record which direction leads to correct classification
predictWithTree :: Columnable a => Text -> DataFrame -> Int -> Tree a -> a Source #
Predict the label for a single point using a fixed tree
majorityValueFromIndices :: Columnable a => Text -> DataFrame -> Vector Int -> a Source #
computeTreeLoss :: Columnable a => Text -> DataFrame -> Vector Int -> Tree a -> Double Source #
buildGreedyTree :: Columnable a => TreeConfig -> Int -> Text -> [Expr Bool] -> DataFrame -> Tree a Source #
findBestGreedySplit :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Maybe (Expr Bool) Source #
numericConditions :: TreeConfig -> DataFrame -> [Expr Bool] Source #
generateNumericConds :: TreeConfig -> DataFrame -> [Expr Bool] Source #
numericExprsWithTerms :: SynthConfig -> DataFrame -> [Expr Double] Source #
generateConditionsOld :: TreeConfig -> DataFrame -> [Expr Bool] Source #
calculateGini :: Columnable a => Text -> DataFrame -> Double Source #
majorityValue :: Columnable a => Text -> DataFrame -> a Source #
buildTree :: Columnable a => TreeConfig -> Int -> Text -> [Expr Bool] -> DataFrame -> Expr a Source #
findBestSplit :: Columnable a => TreeConfig -> Text -> [Expr Bool] -> DataFrame -> Maybe (Expr Bool) Source #