-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A very simple implementation of decision trees for discrete attributes. -- -- A very simple implementation of decision trees, built with ID3. You -- can use it to classify data with a set of discrete attributes. @package DecisionTree @version 0.0 -- | This module provides a very simple implementation of a decisiontree. -- It is "optimized" for readability, not so much for performance. I -- doubt it can be used for real (=huge) datasets, but it should be ok -- for a couple of hundred (thousand?) items. -- -- You are encouraged to have a look at the source -- -- It is build (for now) using the ID3 algorithm (or at least something -- closely resembling that). That means the attributes you choose must -- have a finite set of possible values. module Data.DecisionTree -- | Build a DecisionTree from the given Trainingset build :: (Ord a, Ord b) => [Attribute a] -> [PreLabeled a b] -> DecisionTree a b -- | Decide which label belongs to this Datum decide :: (Eq a) => DecisionTree a b -> Datum a -> b -- | Things we want to find labels for data Datum a D :: String -> [(Attribute a, a)] -> Datum a -- | They have names dName :: Datum a -> String -- | and attributes attributes :: Datum a -> [(Attribute a, a)] type PreLabeled a b = (b, Datum a) -- | A Datum has Attributes data Attribute a A :: String -> [a] -> Attribute a -- | Attributes have a name aName :: Attribute a -> String -- | and a set of possible values possibleValues :: Attribute a -> [a] -- | The type for our DecisionTree data DecisionTree a b instance (Show a) => Show (Datum a) instance Show (Attribute a) instance Eq (Attribute a) instance (Show a, Show b) => Show (DecisionTree a b)