简体   繁体   English

用什么来分类R中的提升决策树?

[英]What to use for classification with boosted decision trees in R?

I'm rather new to R. I have found ways to run classification using trees with bagging (randomforest), and ways to run regression with boosting (gbm), but what I'm looking for is to do classification using boosting. 我是R的新手。我已经找到了使用带有套袋(随机森林)的树进行分类的方法,以及使用增强(gbm)运行回归的方法,但我正在寻找的是使用增强进行分类。

Supposedly, gbm is able to do this when the target variable consists of 0s and 1s and when you set Bernoulli as the function -- but no, the results that I get still point to regression being used. 据说,当目标变量由0和1组成时,当你将伯努利设置为函数时,gbm能够做到这一点 - 但是,我得到的结果仍然指向使用回归。

Any help will be very appreciated. 任何帮助将非常感激。

如果您在插入符包中使用xgboost,则可能还必须同时更改objective = binary:logisticeval_metric =以反映您的分类需求。

It becomes classification if you transform the predicted values to 0 and 1. For example with round(). 如果将预测值转换为0和1,它将成为分类。例如,使用round()。 That is, using a threshold of 0.5. 也就是说,使用0.5的阈值。 But there are more sophisticated approaches to finding the optimal threshold. 但是有更复杂的方法可以找到最佳阈值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM