R︱Yandex的梯度提升CatBoost 算法(官方述:超越XGBoost/lightGBM/h2o)

俄罗斯搜索巨头 Yandex 昨日宣布开源 CatBoost ,这是一种支持类别特征,基于梯度提升决策树的机器学习方法。 CatBoost 是由 Yandex 的研究人员和工程师开发的,是 MatrixNet 算法的继承者,在公司内部广泛使用,用于排列任务、预测和提出建议。Yandex 称其是通用的,可应用于广泛的领域和各种各样的问题。

笔者相关文章:

R+工业级GBDT︱微软开源 的LightGBM(R包已经开放) R语言︱XGBoost极端梯度上升以及forecastxgb(预测)+xgboost(回归)双案例解读 R语言︱H2o深度学习的一些R语言实践——H2o包

CatBoost 的主要优势:

  • 与其他库相比,质量上乘
  • 支持数字化和分类功能
  • 带有数据可视化工具

官网:https://tech.yandex.com/CatBoost/ github:https://github.com/catboost/catboost

有R/python两个版本,官方自述超越现有的最好的三个ML库:XGBoost/lightGBM/h2o

衡量标准为: Logloss 越小越好:

默认参数解析([github](https://github.com/catboost/benchmarks/blob/master/comparison_description.pdf)):

安装

在window笔者遇到了:

* installing *source* package 'catboost' ...
** libs
  running 'src/Makefile.win' ...
/cygdrive/c/Users/mzheng50/Desktop/R-package/src/../../../ya.bat make -r -o ../../..
make: /cygdrive/c/Users/mzheng50/Desktop/R-package/src/../../../ya.bat: Command not found
make: *** [all] Error 127
警告: 运行命令'make --no-print-directory -f "Makefile.win"'的状态是2
ERROR: compilation failed for package 'catboost'
* removing 'C:/Users/mzheng50/Documents/R/win-library/3.1/catboost'
Error: Command failed (1)

在Linux用下面code可以一气呵成:

devtools::install_github('catboost/catboost', subdir = 'catboost/R-package')

一个官方案例

library(caret)
library(titanic)
library(catboost)

set.seed(12345)

data <- as.data.frame(as.matrix(titanic_train), stringsAsFactors = TRUE)

drop_columns = c("PassengerId", "Survived", "Name", "Ticket", "Cabin")
x <- data[,!(names(data) %in% drop_columns)]
y <- data[,c("Survived")]

fit_control <- trainControl(method = "cv",
                            number = 4,
                            classProbs = TRUE)

grid <- expand.grid(depth = c(4, 6, 8),
                    learning_rate = 0.1,
                    iterations = 100,
                    l2_leaf_reg = 1e-3,
                    rsm = 0.95,
                    border_count = 64)
report <- train(x, as.factor(make.names(y)),
                method = catboost.caret,
                verbose = TRUE, preProc = NULL,
                tuneGrid = grid, trControl = fit_control)

print(report)
--------------------------
> Catboost
> 
> 891 samples   7 predictors   2 classes: 'X0', 'X1'
> 
> No pre-processing Resampling: Cross-Validated (4 fold) Summary of
> sample sizes: 669, 668, 668, 668 Resampling results across tuning
> parameters:
> 
>   depth  Accuracy   Kappa   4      0.8091544  0.5861049   6     
> 0.8035642  0.5728401   8      0.7026674  0.2672683
> 
> Tuning parameter 'learning_rate' was held constant at a value of 0.1
> 
> Tuning parameter 'rsm' was held constant at a value of 0.95 Tuning 
> parameter 'border_count' was held constant at a value of 64 Accuracy
> was used to select the optimal model using  the largest value. The
> final values used for the model were depth = 4, learning_rate =
>  0.1, iterations = 100, l2_leaf_reg = 0.001, rsm = 0.95 and border_count = 64.
importance <- varImp(report, scale = FALSE)
print(importance)
--------------------------
custom variable importance
         Overall
Fare      25.918
Parch     19.419
Sex       17.999
Pclass    17.410
Age       10.372
Embarked   5.879
SibSp      3.004

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏hbbliyong

WPF Trigger for IsSelected in a DataTemplate for ListBox items

<DataTemplate DataType="{x:Type vm:HeaderSlugViewModel}"> <vw:HeaderSlug...

4224
来自专栏魂祭心

原 canvas绘制clock

5184
来自专栏芋道源码1024

熔断器 Hystrix 源码解析 —— 断路器 HystrixCircuitBreaker

本文主要基于 Hystrix 1.5.X 版本 1. 概述 2. HystrixCircuitBreaker 3. HystrixCircuitBreaker....

5847
来自专栏一个会写诗的程序员的博客

Spring Reactor 项目核心库Reactor Core

Non-Blocking Reactive Streams Foundation for the JVM both implementing a Reactiv...

2872
来自专栏菩提树下的杨过

Flash/Flex学习笔记(23):运动学原理

先写一个公用的小球类Ball: package{ import flash.display.Sprite; //小球 类 public class B...

27510
来自专栏张善友的专栏

LINQ via C# 系列文章

LINQ via C# Recently I am giving a series of talk on LINQ. the name “LINQ via C...

3025
来自专栏Ceph对象存储方案

Luminous版本PG 分布调优

Luminous版本开始新增的balancer模块在PG分布优化方面效果非常明显,操作也非常简便,强烈推荐各位在集群上线之前进行这一操作,能够极大的提升整个集群...

3705
来自专栏张善友的专栏

Mix 10 上的asp.net mvc 2的相关Session

Beyond File | New Company: From Cheesy Sample to Social Platform Scott Hansel...

2787
来自专栏飞扬的花生

jsencrypt参数前端加密c#解密

      写程序时一般是通过form表单或者ajax方式将参数提交到服务器进行验证,如何防止提交的请求不被抓包后串改,虽然无法说绝对安全却给非法提交提高了难度...

4269
来自专栏大内老A

The .NET of Tomorrow

Ed Charbeneau(http://developer.telerik.com/featured/the-net-of-tomorrow/) Exciti...

39510

扫码关注云+社区