Skip to content

2hanson/DecisionTree

Repository files navigation

C4.5-based implementation of the Decision Tree algorithm 
Written by hanson(hangzhong.yu@gmail.com) at date 11/19/2011.
Linkedin profile: http://cn.linkedin.com/in/hangzhongyu

compile command : gcc decisiontree.c -lm -o decisiontree
then: ./decisiontree -r trainning.txt -t testing.txt -d 3 -c 2 -s 499 -m 200 -p 0
     -r <Training data file>
     -t <Testing data file >
     -d <Number of attributes constructing a record>
     -c <Number of classes>
     -s <Number of training records in the training data file>
     -m <Number of testing records in the testing data file>
     -p <printing the prediction results or not, 1 or 0>

Input Module:
convert attribute to number,
for instance:
    input data:
    ID12101 1   48  0   Red

    ID12102 0   40  1   Black

    ID12103 0   51  0   Red

    ID12104 0   23  0   Yellow
    first: read to rawdata;
    then: construct a Map as fellows
        attributes0( is the Class Lab): 1, 0 (index from 0, so index is 0, 1)
        attributes1: 48, 40, 51, 23(index from 0, so this value index is 0, 1,2,3)
        attributes2:0, 1(index start from 0)
        attributes:Red, Black, Yellow(index start from 0)

    then the attribute matrix is :
    0 0 0
    1 1 1
    2 0 0
    3 0 2


GenerageDecisionTree: have done

then output modele have done.
output the tree view, rule, confusiong matrix and execute time

have cope with both discrete data and consecutive data

the result is output in the output.txt file

## Contact
Hanson Yu

- https://twitter.com/2hanson
- https://github.com/2hanson
- http://www.linkedin.com/in/hangzhongyu
- hangzhong.yu@gmail.com

## License
DecisionTree is available under the MIT license. See the LICENSE file for more info.


Releases

No releases published

Packages

No packages published

Languages