DecisionTree-0.0: A very simple implementation of decision trees for discrete attributes.Source codeContentsIndex

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.

build :: (Ord a, Ord b) => [Attribute a] -> [PreLabeled a b] -> DecisionTree a b
decide :: Eq a => DecisionTree a b -> Datum a -> b
data Datum a = D {
dName :: String
attributes :: [(Attribute a, a)]
type PreLabeled a b = (b, Datum a)
data Attribute a = A {
aName :: String
possibleValues :: [a]
data DecisionTree a b
build :: (Ord a, Ord b) => [Attribute a] -> [PreLabeled a b] -> DecisionTree a bSource
Build a DecisionTree from the given Trainingset
decide :: Eq a => DecisionTree a b -> Datum a -> bSource
Decide which label belongs to this Datum
data Datum a Source
Things we want to find labels for
dName :: StringThey have names
attributes :: [(Attribute a, a)]and attributes
show/hide Instances
Show a => Show (Datum a)
type PreLabeled a b = (b, Datum a)Source
data Attribute a Source
A Datum has Attributes
aName :: StringAttributes have a name
possibleValues :: [a]and a set of possible values
show/hide Instances
data DecisionTree a b Source
The type for our DecisionTree
show/hide Instances
(Show a, Show b) => Show (DecisionTree a b)
Produced by Haddock version 2.6.0