zl程序教程

您现在的位置是:首页 >  后端

当前栏目

集成剪枝分类算法的Adaboost集成学习算法示例

集成算法学习 示例 分类 剪枝 AdaBoost
2023-09-11 14:17:32 时间
Boosting algorithms try to aggregate a couple of poor classifiers by order to make a powerful one. They assign weights to every labeled sample. When

Boosting algorithms try to aggregate a couple of poor classifiers by order to make a powerful one. They assign weights to every labeled sample. When one of the poor classifier fails to correctly classify a sample, the weight of that sample is boosted. Then it tries another poor classifier.
Let’s take Adaboost and Pruning algorithms for example:


For the training set {(xi,yi)}ni=1, initialize their weights {wi}ni=1 as 1/n. And let f←0. For j=1,…,b:
Based on current sample weights {wi}ni=1, pick up the classifier with the smallest weighted error rate R: φj=argminφR(φ),R(φ)=∑j=1nwi2(1−φ(xi)yi) Calculate the weight of classifier φj:θj=12log1−R(φj)R(φj) Update the aggregated classifier f:f←f+θjφj Update the weights of samples {wi}ni=1:wi←exp(−f(xi)yi)∑nk=1exp(−f(xk)yk),∀i=1,2,…,n
wy=w.*y; d=ceil(2*rand); [xs,xi]=sort(x(:,d)); el=cumsum(wy(xi)); eu=cumsum(wy(xi(end:-1:1))); e=eu(end-1:-1:1)-el(1:end-1); [em,ei]=max(abs(e)); c=mean(xs(ei:ei+1));s=sign(e(ei)); yh=sign(s*(x(:,d)-c)); R=w*(1-yh.*y)/2; t=log((1-R)/R)/2; yy=yy+yh*t; w=exp(-yy.*y); w=w/sum(w); Y=Y+sign(s*(X(:,:,d)-c))*t; figure(1); clf; hold on; axis([-3,3,-3,3]); colormap([1 0.7 1; 0.7 1 1]); contourf(X0,X0,sign(Y)); plot(x(y==1,1),x(y==1,2),bo); plot(x(y==-1,1),x(y==-1,2),rx);

这里写图片描述


秒懂算法 | 回归算法中的贝叶斯 在本文中,我们会用概率的观点来看待机器学习模型,用简单的例子帮助大家理解判别式模型和生成式模型的区别。通过思考曲线拟合的问题,发现习以为常的损失函数和正则化项背后有着深刻的意义
集成学习方法之随机森林 集成学习通过建立几个模型组合的来解决单一预测问题。它的工作原理是生成多个分类器模型,各自独立地学习和作出预测。这些预测最后结合成组合预测,因此优于任何一个单分类的做出预测。
集成学习之GBDT GBDT、Treelink、 GBRT(Gradient Boost Regression Tree)、Tree Net、MART(Multiple Additive Regression Tree)算法都是以决策树为基分类器的集成算法,通常由多棵决策树构成,通常是上百棵树且每棵树规模都较小(即树的深度都比较浅)。进行模型预测的时候,对于输入的一个样本实例X,遍历每一棵决策树,每棵树都会对预测值进行调整修正,最后得到预测的结果。假设$F_0$是设置的初值,$T_i$是一颗一颗的决策树。预测结果如下所示:
决策树之 GBDT 算法 - 回归部分 GBDT(Gradient Boosting Decision Tree)是被工业界广泛使用的机器学习算法之一,它既可以解决回归问题,又可以应用在分类场景中,该算法由斯坦福统计学教授 Jerome H. Friedman 在 1999 年发表。本文中,我们主要学习 GBDT 的回归部分。 在学习 GBDT 之前,你需要对 [CART](https://www.atatech.org/ar
决策树算法之 AdaBoost AdaBoost 是一种更高级的「森林」类型的决策树,和随机森林比起来,它有以下三个特点 1. AdaBoost 的每棵树都只有一个根节点和两个叶子节点,实际上叫树桩(stump)可能会更合适 2. AdaBoost 的每个树桩的权重是不同的,而随机森林中的每棵树的权重是相同的 3. 前一个树桩的错误数据会影响后一个树桩的生成,意味着后面的树桩是前面树桩的补足。这种思想也被称为 Boos