 | DecisionTree-0.0: A very simple implementation of decision trees for discrete attributes. (internal documentation) | Contents | Index |
|
|
|
| Description |
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.
|
|
| Synopsis |
|
|
|
| Documentation |
|
| type PreLabeled a b = (b, Datum a) |
|
| data DecisionTree a b |
| The type for our DecisionTree
| | Constructors | | Leaf b | Leafs have labels
| | Node | | | att :: Attribute a | a node asks for this attribute
| | child :: a -> DecisionTree a b | and has children which can be found with a value of the attribute
|
|
| Instances | |
|
|
| data Attribute a |
| A Datum has Attributes
| | Constructors | | A | | | aName :: String | Attributes have a name
| | possibleValues :: [a] | and a set of possible values
|
|
| Instances | |
|
|
| data Datum a |
| Things we want to find labels for
| | Constructors | | D | | | dName :: String | They have names
| | attributes :: [(Attribute a, a)] | and attributes
|
|
| Instances | |
|
|
| showTree :: (Show a, Show b) => DecisionTree a b -> ShowS |
|
| build :: (Ord a, Ord b) => [Attribute a] -> [PreLabeled a b] -> DecisionTree a b |
| Build a DecisionTree from the given Trainingset
|
|
| getValue :: Datum a -> Attribute a -> a |
|