翻译自:https://www.analyticsvidhya.com/blog/2015/06/tuning-random-forest-model/

There are primarily 3 features which can be tuned to improve the predictive power of the model :

说明:随机森林有3个比较重要的参数,对结果影响比较大,max_features,n_estimators,min_sample_leaf

1.a. max_features:

These are the maximum number of features Random Forest is allowed to try in individual tree. There are multiple options available in Python to assign maximum features. Here are a few of them :

  1. Auto/None : This will simply take all the features which make sense in every tree.Here we simply do not put any restrictions on the individual tree.
  2. sqrt : This option will take square root of the total number of features in individual run. For instance, if the total number of variables are 100, we can only take 10 of them in individual tree.”log2″ is another similar type of option for max_features.
  3. 0.2 : This option allows the random forest to take 20% of variables in individual run. We can assign and value in a format “0.x” where we want x% of features to be considered.

How does “max_features” impact performance and speed?

Increasing max_features generally improves the performance of the model as at each node now we have a higher number of options to be considered. However, this is not necessarily true as this decreases the diversity of individual tree which is the USP of random forest. But, for sure, you decrease the speed of algorithm by increasing the max_features. Hence, you need to strike the right balance and choose the optimal max_features.

1.b. n_estimators :

This is the number of trees you want to build before taking the maximum voting or averages of predictions. Higher number of trees give you better performance but makes your code slower. You should choose as high value as your processor can handle because this makes your predictions stronger and more stable.

1.c. min_sample_leaf :

If you have built a decision tree before, you can appreciate the importance of minimum sample leaf size. Leaf is the end node of a decision tree. A smaller leaf makes the model more prone to capturing noise in train data. Generally I prefer a minimum leaf size of more than 50. However, you should try multiple leaf sizes to find the most optimum for your use case.

说明:如果 min_sample_leaf过小,很容易过拟合,学习到噪声

随机森林的几个重要参数相关推荐

  1. python 随机森林分类 DecisionTreeClassifier 随机搜索优化参数 GridSearchCV

    @python 随机森林分类模型 随机优化参数 学习笔记 随机森林 1.随机森林模型 随机森林算法是基于决策树算法的Begging优化版本,通过集成学习的思想将多棵树集成的一种算法,它的基本单元是决策 ...

  2. Lesson 9.2 随机森林回归器的参数

    文章目录 一.弱分类器的结构 1. 分枝标准与特征重要性 2. 调节树结构来控制过拟合 二.弱分类器的数量 三.弱分类器训练的数据 1. 样本的随机抽样 2. 特征的随机抽样 3. 随机抽样的模式 四 ...

  3. 利用mysql建立随机森林_随机森林算法实例 - osc_4imme0wh的个人空间 - OSCHINA - 中文开源技术交流社区...

    根据成年人数据集来预测一个人的收入 1.准备数据集 我下载好了一个成年人数据集,从百度云下载 链接:https://pan.baidu.com/s/10gC8U0tyh1ERxLhtY8i0bQ 提取 ...

  4. 机器学习(10)随机森林(预测泰坦尼克号旅客存活率)

    目录 一.基础理论 1.集成学习方法 2.随机森林 API 二.过程 1.创建随机森林预估器 2.参数准备(网格搜索) 3.训练 模型评估结果: 总代码 一.基础理论 1.集成学习方法 集成学习通过建 ...

  5. 随机森林 java_机器学习weka,java api调用随机森林及保存模型

    工作需要,了解了一下weka的java api,主要是随机森林这一块,刚开始学习,记录下. 了解不多,直接上demo,里面有一些注释说明: package weka; import java.io.F ...

  6. Facebook工程师教你什么是随机森林,就算零基础也可以看懂 | 干货

    白交 发自 凹非寺  量子位 报道 | 公众号 QbitAI 今天的这篇入门贴,我们就来介绍一下决策树与随机森林. 这篇帖子适合机器学习基础为0的同学~ 当然,有基础的同学也可以来看一下,加深一下理解 ...

  7. 12_信息熵,信息熵公式,信息增益,决策树、常见决策树使用的算法、决策树的流程、决策树API、决策树案例、随机森林、随机森林的构建过程、随机森林API、随机森林的优缺点、随机森林案例

    1 信息熵 以下来自:https://www.zhihu.com/question/22178202/answer/161732605 1.2 信息熵的公式 先抛出信息熵公式如下: 1.2 信息熵 信 ...

  8. 机器学习-分类算法-决策树,随机森林10

    决策树: 决策树的思想来源非常朴素,程序设计中的条件分支机构就是if-then结构,最早的决策树就是利用这类结构分割数据的一种分类学习方法. 信息和消除不确定性是相联系的 信息增益:当得知一个特征后, ...

  9. 比赛结果预测_决策树_随机森林(通用 数据挖掘入门与实践-实验5)

    #数据导入 import pandas as pddata_filename="datasets.csv" dataset=pd.read_csv(data_filename) # ...

最新文章

  1. javascript中replace使用方法总结
  2. struts2 获取request、session的方法
  3. 2019-11-18 自动控制原理的几个基本概念
  4. T5: Text-to-Text Transfer Transformer 阅读笔记
  5. 英国如何推动分享经济的发展?
  6. Communications link failure,The last packet successfully received from the serve
  7. C# 延迟初始化 LazyT
  8. 即时语音提示软件php,即时语音提示校对专家
  9. JavaWeb如何判断账户密码
  10. Unity中的存档与读档
  11. 数学 余式定理 简介
  12. Not creating XLA devices, tf_xla_enable_xla_devices not set
  13. linux怎么模糊查找文件,linux模糊查找一个文件的方法
  14. PHP删除字符串中的空格和换行符终极方法
  15. 腾讯云—人脸识别应用实践
  16. 北斗校时系统(GPS授时设备)几种时间同步方法
  17. 如何与离职员工面谈沟通?
  18. SQL Server 查询分解
  19. Android Notification的完整例子--设置下班闹钟和护眼闹钟
  20. KYLIN立方体构建详解

热门文章

  1. 数据库trim函数_使用TRIM和SUBSTITUTE清除Excel数据
  2. 《鹰猎长空》剖析美育视野下国产儿童电影发展走向
  3. Extract sequences from FASTA file based on a pair of list
  4. 小程序私有化部署,米筷如何异军突起?
  5. 逐条反驳王冉“山寨手机注定不会长久”
  6. Silverlight.XNA(C#)跨平台3D游戏研发手记:(十一)3D SLG(策略战棋游戏)设计案例
  7. HEVC中什么是profile(档次)、level(水平)、tire(等级)
  8. 泰勒展开求π近似值(复杂循环)
  9. php设置backlog,php-fpm backlog参数优化
  10. Redis 性能优化 —— 关闭 THP