This module holds functions that are responsible for creating a new
decision tree and for using the tree for data classificiation.
|
majority_value(data,
target_attr)
Creates a list of all values in the target attribute for each record
in the data list object, and returns the value that appears in this
list the most frequently. |
source code
|
|
|
|
|
get_values(data,
attr)
Creates a list of values in the chosen attribute for each record in
data, prunes out all of the redundant values, and return the list. |
source code
|
|
|
choose_attribute(data,
attributes,
target_attr,
fitness)
Cycles through all the attributes and returns the attribute with the
highest information gain (or lowest entropy). |
source code
|
|
|
get_examples(data,
attr,
value)
Returns a list of all the records in <data> with the value of
<attr> matching the given value. |
source code
|
|
|
get_classification(record,
tree)
This function recursively traverses the decision tree and returns a
classification for the given record. |
source code
|
|
|
classify(tree,
data)
Returns a list of classifications for each of the records in the data
list as determined by the given decision tree. |
source code
|
|
|
create_decision_tree(data,
attributes,
target_attr,
fitness_func)
Returns a new decision tree based on the examples given. |
source code
|
|