| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.DecisionTree.Cart
Description
sklearn-faithful CART initializer used to seed TAO. One-hot encodes
categoricals and splits on exact (unsmoothed) Gini over midpoint thresholds
(<= routes left), matching DecisionTreeClassifier(criterion=.gini)
Synopsis
- data CartFeature = CartFeature {}
- data CartNode
- sortIndicesByValue :: Vector Double -> Vector Int
- buildCartTree :: (Columnable a, Ord a) => TreeConfig -> Text -> DataFrame -> Tree a
- cartFeatures :: Text -> DataFrame -> [CartFeature]
- cartTargetLabels :: Text -> DataFrame -> Vector Text
Documentation
data CartFeature Source #
A one-hot feature column: per-row Double values plus the sklearn LEFT
predicate (x <= threshold) over the ORIGINAL DataFrame.
Pre-Tree CART node: a leaf class id, or a split on feature j.
sortIndicesByValue :: Vector Double -> Vector Int Source #
Indices 0..n-1 stably sorted by their value (ascending), ties keeping
ascending index. In-place unboxed merge sort — no boxed-list allocation.
buildCartTree :: (Columnable a, Ord a) => TreeConfig -> Text -> DataFrame -> Tree a Source #
cartFeatures :: Text -> DataFrame -> [CartFeature] Source #
One-hot features in pd.get_dummies(drop_first=False) column order.