“Scikit-learn”的版本间差异
		
		
		
		
		
		跳到导航
		跳到搜索
		
				
		
		
	
|  (→随机森林) |  (→随机森林) | ||
| 第11行: | 第11行: | ||
| ===随机森林=== | ===随机森林=== | ||
| * 参考 [https://zhuanlan.zhihu.com/p/51165358] [https://towardsdatascience.com/an-implementation-and-explanation-of-the-random-forest-in-python-77bf308a9b76] | * 参考 [https://zhuanlan.zhihu.com/p/51165358] [https://towardsdatascience.com/an-implementation-and-explanation-of-the-random-forest-in-python-77bf308a9b76] | ||
| ====分类==== | |||
| *sklearn.ensemble import RandomForestClassifier | |||
| *n_estimators:随机森林中「树」的数量。 | *n_estimators:随机森林中「树」的数量。 | ||
| *max_features:每个分割处的特征数。 | *max_features:每个分割处的特征数。 | ||
| 第19行: | 第21行: | ||
| *bootstrap:是否使用 bootstrapping 来为随机林中的每棵树提供数据。(bootstrapping 是从数据集中进行替换的随机抽样。) | *bootstrap:是否使用 bootstrapping 来为随机林中的每棵树提供数据。(bootstrapping 是从数据集中进行替换的随机抽样。) | ||
| *n_jobs: 可以决定要使用多少处理器内核来运行模型。设置「n_jobs = -1」将使模型运行最快,因为它使用了所有计算机核心。 | *n_jobs: 可以决定要使用多少处理器内核来运行模型。设置「n_jobs = -1」将使模型运行最快,因为它使用了所有计算机核心。 | ||
| ====回归==== | |||
| *sklearn.ensemble.RandomForestRegressor | |||
| *所有的参数,属性与接口,全部和随机森林分类器一致。仅有的不同就是回归树与分类树的不同,不纯度的指标, 参数Criterion不一致。 | |||
2022年1月16日 (日) 14:08的版本
- python中的机器学习软件库:[1]
- Installed package of scikit-learn can be accelerated using scikit-learn-intelex. More details are available here: https://intel.github.io/scikit-learn-intelex. For example:
       $ conda install scikit-learn-intelex
       $ python -m sklearnex my_application.py
包
- MLPRegressor回归,参考 http://www.weixueyuan.net/a/914.html
随机森林
分类
- sklearn.ensemble import RandomForestClassifier
- n_estimators:随机森林中「树」的数量。
- max_features:每个分割处的特征数。
- max_features = 'sqrt' 这意味着如果有16个特征,则在每个树中的每个节点处,只考虑4个随机特征来拆分节点。
- max_depth:每棵树可以拥有的最大「分裂」数。
- min_samples_split:在树的节点分裂前所需的最少观察数。
- min_samples_leaf:每棵树末端的叶节点所需的最少观察数。
- bootstrap:是否使用 bootstrapping 来为随机林中的每棵树提供数据。(bootstrapping 是从数据集中进行替换的随机抽样。)
- n_jobs: 可以决定要使用多少处理器内核来运行模型。设置「n_jobs = -1」将使模型运行最快,因为它使用了所有计算机核心。
回归
- sklearn.ensemble.RandomForestRegressor
- 所有的参数,属性与接口,全部和随机森林分类器一致。仅有的不同就是回归树与分类树的不同,不纯度的指标, 参数Criterion不一致。