Code Monkey home page Code Monkey logo

decision_tree's Introduction

README

Decision Tree Program

File Structure:
readme.txt
main.py
DecisionTree.py
Node.py
Development Environment:
My Decision Tree Learning program was developed in the Eclipse IDE in Python. 

Usage:
My program is compatible with Python2.6 and 2.7, I have not checked compatibility with any other versions. To run my program, issue the command “python main.py” from within this folder. This will output program.py which can then be run with “python program.py” and that will output to the console the target value for each entry of test data. 
To change the training data, change string in the function “open()” in line 8 of main.py to the path of the new training data. To change the target attribute, change the string in line 12 of main.py to the new target attribute. And to change the test data, change the string in the function “open()” at line 31 or main.py to the path of the new test data. If you forget, you can also change it at line 4 of program.py after running main.py. (note, my program is case sensitive)

Output of Test Cases:
Weather.csv:
entry1 = yes
entry2 = yes
entry3 = yes
entry4 = no
can't process input 5
entry5 = ?

Vote.csv:
entry1 = democrat
entry2 = democrat
entry3 = democrat
entry4 = democrat
entry5 = democrat

Soybean.csv:
can't process input 1
entry1 = ?
entry2 = brown-spot
can't process input 3
entry3 = ?
can't process input 4
entry4 = ?
can't process input 5
entry5 = ?

Code Review:
main.py imports and creates the tree using DecisionTree.py. It uses the DecisionTree.py implements the ID3 algorithm and returns the resulting tree as a multi-dimensional dictionary. This dictionary is the fed to program.py which processes the dictionary as a tree. It does so by importing and using Node.py and generates appropriate output based on that tree. 

decision_tree's People

Contributors

adi-19 avatar shivamtawari avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.