Giter Club home page Giter Club logo

classification-and-regression-tree's Introduction

  1. Files:

sport_articles.csv: dataset to build classification tree

small_train.csv: small training dataset to implement unit tests

small_test.csv: small test dataset to implement unit tests

Node.py: a class to store all elements of a node

Tree.py: a class to do operations about a tree, like building, pruning

test_CART.py: units test to test tree model

split.py: functions of splitting region

credentials.py: store username and password

sql.py: store dataset into database

test_sql_and_data_frame.py: implement unit tests to compare the results of classifier on SQL version and the data frame version

sk_learn.py: build decision tree classifier using sk-learn

benchmark.txt: general summary comments

complexity.txt: theoretical complexity of the main parts of my implementation

error.png: plot of error rate

running_time.png: plot of running time

performance.png: plot of performance

  1. Datasets:

The dataset is loaded from UCI Machine Learning Repository(https://archive.ics.uci.edu/ml/datasets/Sports+articles+for+objectivity+analysis). It contains 1000 samples with 53 attributes.1000 sports articles were labeled using Amazon Mechanical Turk as objective or subjective. However, this dataset is too large to build SQL Tree. Therefore, after consulting professor, I decide to build the classification tree using a smaller subset of this dataset with 700 samples and 31 attributes.

  1. Command Line Arguments:

python test_CART.py [args....]

Where above [args...] is a placeholder for five command-line arguments: <file_name><number_alpha><low_alpha><high_alpha><max_depth>. These arguments are described in detail below:

1.<file_name>: the file name of dataset

2.<number_alpha>: the number of alpha which will be generated. 

3.<low_alpha>: the lowest alpha. 

4.<high_alpha>: the highest alpha. 

5.<kFold>: the number of fold used for cross-validation. 

6.<criterion>: different methods to calculate impurity, where 1 is bayes error, 2 is cross-entropy, 3 is gini index

7.<max_depth>: the maximum depth of tree

An example of arguments: sports_articles.csv 3 0 1 5 3 4

classification-and-regression-tree's People

Contributors

1717kk avatar

Watchers

James Cloos 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.