Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Building Decision Trees From Scratch In Python

License

NotificationsYou must be signed in to change notification settings

serengil/decision-trees-for-ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Disclaimer: This repository is a sketchbook learning the background of decision tree algorithms. It is neither clean nor readable. Please direct yourself toChefboost repository to have clean one.

This is the repository ofDecision Trees for Machine Learning online course published on Udemy. In this course, the following algorithms will be covered. All project is going to be developed on Python (3.6.4), and neither out-of-the-box library nor framework will be used to build decision trees.

1-ID3

2-C4.5

3-CART (Classification And Regression Trees)

4-Regression Trees (CART for regression)

5-Random Forest

6-Gradient Boosting Decision Trees for Regression

7-Gradient Boosting Decision Trees for Classification

8-Adaboost

Just call thedecision.py file to run the program. You might want to change the running algorithm. You just need to set algorithm variable.

algorithm = "ID3" #Please set this variable to ID3, C4.5, CART or Regression

Moreover, you might want to apply random forest. Please set this to True in this case.

enableRandomForest = False

Furthermore, you can apply gradient boosting regression trees.

enableGradientBoosting = True

Besides, adaptive boosting is allowed to run

enableAdaboost = True

Finally, you can change the data set to build different decision trees. Just pass the file name, and its column names if it does not exist.

df = pd.read_csv("car.data"  #column names can either be defined in the source file or names parameter in read_csv command  ,names=["buying","maint","doors","persons","lug_boot","safety","Decision"] )

Prerequisites

Pandas and numpy python libraries are used to load data sets in this repository. You might run the following commands to install these packages if you are going to use them first time.

pip install pandaspip install numpy

Updates

To keep yourself up-to-date you might check posts in my blog aboutdecision trees

License

This repository is licensed under the MIT License - seeLICENSE for more details.


[8]ページ先頭

©2009-2025 Movatter.jp