Git Product home page Git Product logo

royleechina / gbdt_simple_tutorial Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freemanzxp/gbdt_simple_tutorial

0.0 0.0 0.0 2.19 MB

python实现GBDT的回归、二分类以及多分类,将算法流程详情进行展示解读并可视化,庖丁解牛地理解GBDT。Gradient Boosting Decision Trees regression, dichotomy and multi-classification are realized based on python, and the details of algorithm flow are displayed, interpreted and visualized to help readers better understand Gradient Boosting Decision Trees

License: Apache License 2.0

Python 100.00%

gbdt_simple_tutorial's Introduction

GBDT_Simple_Tutorial(梯度提升树简易教程)

简介

利用python实现GBDT算法的回归、二分类以及多分类,将算法流程详情进行展示解读并可视化,便于读者庖丁解牛地理解GBDT。

项目进度:

  • 回归
  • 二分类
  • 多分类
  • 可视化

算法原理以及公式推导请前往blog:GBDT算法原理以及实例理解


依赖环境

  • 操作系统:Windows/Linux
  • 编程语言:Python3
  • Python库:pandas、PIL、pydotplus, 其中pydotplus库会自动调用Graphviz,所以需要去Graphviz官网下载graphviz的-2.38.msi ,先安装,再将安装目录下的bin添加到系统环境变量,此时如果再报错可以重启计算机。详细过程不再描述,网上很多解答。

文件结构

  • | - GBDT 主模块文件夹
  • | --- gbdt.py 梯度提升算法主框架
  • | --- decision_tree.py 单颗树生成,包括节点划分和叶子结点生成
  • | --- loss_function.py 损失函数
  • | --- tree_plot.py 树的可视化
  • | - example.py 回归/二分类/多分类测试文件

运行指南

  • 回归测试:

    python example.py --model = regression

  • 二分类测试:

    python example.py --model = binary_cf

  • 多分类测试:

    python example.py --model = multi_cf

  • 其他可配置参数:lr -- 学习率, trees -- 构建的决策树数量即迭代次数,
    depth -- 决策树的深度, count -- 决策树节点分裂的最小数据数量, is_log -- 是否打印树的生成过程, is_plot -- 是否可视化树的结构.

  • 结果文件: 运行后会生成results文件夹,里面包含了每棵树的内部结构和生成日志

结果展示

仅展示最后所有树的集合,具体每棵树的详细信息望读者自行运行代码~

gbdt_simple_tutorial's People

Contributors

freemanzxp avatar foreverfc1994 avatar peishiyu avatar jackzhenguo 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.