scikit-learn的梯度提升算法(Gradient Boosting)使用
前言:本文的目的是记录sklearn包中GBRT的使用,主要是官网各参数的意义;对于理论部分和实际的使用希望在只是给出出处,希望之后有时间能补充完整
摘要:
1.示例
2.模型主要参数
3.模型主要属性变量
内容:
1.示例
>>> import numpy as np
>>> from sklearn.metrics import mean_squared_error
>>> from sklearn.datasets import make_friedman1
>>> from sklearn.ensemble import GradientBoostingRegressor
>>> X, y = make_friedman1(n_samples=1200, random_state=0, noise=1.0)
>>> X_train, X_test = X[:200], X[200:]
>>> y_train, y_test = y[:200], y[200:]
>>> est = GradientBoostingRegressor(n_estimators=100, learning_rate=0.1,
... max_depth=1, random_state=0, loss='ls').fit(X_train, y_train)
>>> mean_squared_error(y_test, est.predict(X_test))
5.00...
2.模型主要参数
2.1 n_estimators : int (default=100)
梯度提升的迭代次数,也是弱分类器的个数
2.2 loss : {‘ls’, ‘lad’, ‘huber’, ‘quantile’}, optional (default=’ls’)
损失函数
2.3 learning_rate : float, optional (default=0.1)
SGB(随机梯度提升)的步长,也叫学习速度,一般情况下learning_rate越低,n_estimators越大;
经验表明learning_rate越小,测试误差越小;具体的值参看http://scikit-learn.org/stable/modules/ensemble.html#Regularization
2.4 max_depth : integer, optional (default=3)
决策树桩(Decision Stump)的最大深度,预剪枝操作(这里的树深度不包括树根)
2.5 warm_start : bool, default: False
如果True,会存储之前的拟合结果,以供增加迭代次数
3.模型主要属性变量
3.1 train_score_ : array, shape = [n_estimators]
存储每次迭代的训练误差
3.2 feature_importances_ : array, shape = [n_features]
特征重要性,具体参照:http://scikit-learn.org/stable/modules/ensemble.html#random-forest-feature-importance
scikit-learn的梯度提升算法(Gradient Boosting)使用的更多相关文章
- 梯度提升树 Gradient Boosting Decision Tree
Adaboost + CART 用 CART 决策树来作为 Adaboost 的基础学习器 但是问题在于,需要把决策树改成能接收带权样本输入的版本.(need: weighted DTree(D, u ...
- Facebook Gradient boosting 梯度提升 separate the positive and negative labeled points using a single line 梯度提升决策树 Gradient Boosted Decision Trees (GBDT)
https://www.quora.com/Why-do-people-use-gradient-boosted-decision-trees-to-do-feature-transform Why ...
- 梯度提升树GBDT算法
转自https://zhuanlan.zhihu.com/p/29802325 本文对Boosting家族中一个重要的算法梯度提升树(Gradient Boosting Decison Tree, 简 ...
- 梯度提升树(GBDT)原理小结
在集成学习之Adaboost算法原理小结中,我们对Boosting家族的Adaboost算法做了总结,本文就对Boosting家族中另一个重要的算法梯度提升树(Gradient Boosting De ...
- [机器学习]梯度提升决策树--GBDT
概述 GBDT(Gradient Boosting Decision Tree) 又叫 MART(Multiple Additive Regression Tree),是一种迭代的决策树算法,该算法由 ...
- 梯度提升树(GBDT)原理小结(转载)
在集成学习值Adaboost算法原理和代码小结(转载)中,我们对Boosting家族的Adaboost算法做了总结,本文就对Boosting家族中另一个重要的算法梯度提升树(Gradient Boos ...
- 集成学习之Boosting —— Gradient Boosting原理
集成学习之Boosting -- AdaBoost原理 集成学习之Boosting -- AdaBoost实现 集成学习之Boosting -- Gradient Boosting原理 集成学习之Bo ...
- 论文笔记:LightGBM: A Highly Efficient Gradient Boosting Decision Tree
引言 GBDT已经有了比较成熟的应用,例如XGBoost和pGBRT,但是在特征维度很高数据量很大的时候依然不够快.一个主要的原因是,对于每个特征,他们都需要遍历每一条数据,对每一个可能的分割点去计算 ...
- GBDT(梯度提升树) 原理小结
在之前博客中,我们对Boosting家族的Adaboost算法做了总结,本文就对Boosting家族中另一个重要的算法梯度提升树(Gradient Boosting Decison Tree, 以下简 ...
随机推荐
- using 语句中使用的类型必须可隐式转换为“System.IDisposable
在使用 EF 出现 using 语句中使用的类型必须可隐式转换为“System.IDisposable 今天写在这里分享给大家 出现这样的问题,是因为没有引用 EntityFramework 这个程 ...
- 【jquery】flexiGrid新增功能的方式
到目前为止,我用过的jquery表格插件只有jqGrid和flexiGrid.今天,只说后者. 关于参数配置,使用方法,博客园文章很多. 原生的flexiGrid架包不大,内容可以扩展,比如在每行数据 ...
- 浅析 IDE跟编译器
之前听别人总说你用啥IDE,直接用编译器. 总的来说IDE包含编译器,而编译器仅仅是IDE的一部分, IDE包括编辑器与编译器. IDE: 可以在IDE上面编写代码,然后编译运行,有错误还能调试.比如 ...
- 17.iOS App设置icon,启动图,App名称的方法
icon:选择Assets-->AppIcon-->将各种尺寸的icon拖拽到相应的框中. APP名称:选择info-->Bundle name,修改APP名字. 启动图: 首先点击 ...
- UVa 11292 Dragon of Loowater
简单贪心 龙头的直径和人的佣金排序,价值小的人和直径小的配 #include<iostream> #include<cstdio> #include<cmath> ...
- nginx简易安装
yum -y install perl-ExtUtils-Embed ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx ...
- About MTU,TCP-MSS (转)
MSS是Maxitum Segment Size 最大分段大小的缩写,意为TCP数据包每次能够传输的最大数据分段,是TCP协议里面的一个概念.MSS值所表示的是TCP报文的净载荷数据大小.通过设置其大 ...
- ubuntu 14.04 下evolution邮箱客户端设置(腾讯企业邮箱)
安装 evolution 有PPA可用,支持 Ubuntu 14.04 及衍生系统.打开终端,输入以下命令: sudo add-apt-repository ppa:fta/gnome3 sudo a ...
- (转)为什么用ls和du显示出来的文件大小有差别?
曾经有几次,我用ls和du查看一个文件的大小,发现二者显示出来的大小并不一致,例如: bl@d3:~/test/sparse_file$ ls -l fs.img-rw-r--r-- 1 bl bl ...
- JS动态级联菜单
JS动态级联菜单是前端常用的一个功能,特此抽时间研究了下,附上代码 <html> <head> <meta charset="utf-8" /> ...