This project is about learning from decision tree, using a simple pruning technique.
Use all the files in the repository and run the main.py. Uncomment the code releated to the dataset you want to test.
The repository has 6 files:
- dataset.py: class to represent a given dataset
- decisiontree.py: class to represent the decision tree
- decisionleaf.py: class to define a leaf of the decision tree
- decisiontreelearner.py: this file include the function to create the decision tree and to use the pruning technique
- test.py: this file contains all the functions used to create the dataset from a file that contains dataset and to test the results
- main.py: file to make tests and generate plot
You can download the 3 datasets used from the following links:
- car-evaluation: https://archive.ics.uci.edu/ml/datasets/Car+Evaluation
- balance-scale: https://archive.ics.uci.edu/ml/datasets/Balance+Scale
- tic-tac-toe: https://archive.ics.uci.edu/ml/datasets/Tic-Tac-Toe+Endgame
All the code is written in python 3
- math
- copy
- deepcopy
- datetime
- random
- matplotlib
- pyplot
The organization of some class and part of the code is taken from : https://github.com/aimacode/aima-python