码迷,mamicode.com
首页 > 系统相关 > 详细

Kaggle Machine Learning 教程学习(五)

时间:2018-04-22 20:00:18      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:random   machine   ssi   表达   auto   因子   ace   任务   square   

 四、算法选择

  这一步骤让我很兴奋,终于谈到算法了,虽然没代码、没公式。因为教程君表示并不想过深的去探讨算法细节,于是着重于从算法的应用场景、算法的缺点、如何选择算法来纵向展开。

  我们的训练模型一般分为监督学习、无监督学习以及强化学习三种。教程中只提到了前两种,而训练算法又分为回归、分类以及聚类。其中回归与分类属于监督学习分,聚类属于无监督学习。

  教程中提到的适用于监督学习下的拟合算法:

    线性回归(Linear regression)、

    套索回归(Lasso regression)、

    岭回归(Ridge regression)、

    弹性网络正则化(Elastic net regularization)、

    p.s.逻辑回归(Logistic regression)。

  以及集成学习(Ensemble Learning)算法:

    集成算法是将多个分类器集成起来而形成的新的分类算法。又称元算法(meta-algorithm)。

    回归树(Regression Tree)、分类树(Classification Tree),统称CART。回归树是回归模型下的算法,分类树分类模型下的算法,它们都是一种决策树(Decision trees)。

    当集成模型是决策树时,一般有两种集成学习算法:随机森林(Random Forest)、梯度增强树(Gradient Boosted Tree)。

  1.回归

    线性回归使用最普遍的方法就是最小二乘法(Least Squares),最小二乘法的目标函数:

$$ min_{\omega}\space\space\space\Vert X_{\omega} - y \Vert_{2}^{2} $$

    虽然最小二乘是最常用的分析方法,然而,它有两个缺点:过拟合(overfitting)与不容易表达非线性(即离散)关系。

      (1)如何防止过拟合?比较好的方法就是对其加入正则化(regularization),其中常见的优化算法:索套回归(最小二乘法 + L1范数正则项(1阶范数))、岭回归(最小二乘法 + L2范数正则项(2阶范数))、弹性网正则化(L1 + L2范数正则项)。其中L1,L2范数正则项的系数叫做惩罚因子(penalty term)。

        Lasso的目标函数:

$$ min_{\omega}\space\space\space\frac{1}{2n}\Vert X_{\omega} - y \Vert_{2}^{2} + \alpha\Vert\omega\Vert_{1} $$

$$ 其中 \alpha 是常数(即惩罚系数),\Vert\omega\Vert_{1} 是L_{1}范数 $$。

        Ridge适用于训练模型发生过拟合、虚拟变量陷阱(第四篇提到过)等情况,Ridge的最小化目标函数:

$$ min_{\omega}\space\space\space\Vert X_{\omega} - y \Vert_{2}^{2} + \alpha\Vert\omega\Vert_{2}^{2} $$

$$ 这里 \alpha \geq 0 。 $$

         Elastic-net的目标函数:

$$ min_{\omega}\space\space\space\frac{1}{2n}\Vert X_{\omega} - y \Vert_{2}^{2} + \alpha\rho\Vert\omega\Vert_{1} + \frac{\alpha(1 - \rho)}{2}\Vert\omega\Vert_{2}^{2} $$

  2.分类

    逻辑回归(Logistic regression),逻辑回归是线性回归的分类任务下对应的算法。

      L2范数-Logistic regression模型:

$$ min_{\omega,c}\space\space\space\frac{1}{2}\omega^{T}\omega + C\sum_{i=1}^{n}log(e^{-y_{i}(X_{i}^{T}\omega + c)} + 1) $$

      L1范数-Logistic regression模型:

$$ min_{\omega,c}\space\space\space\Vert\omega\Vert_{1} + C\sum_{i=1}^{n}log(e^{-y_{i}(X_{i}^{T}\omega + c)} + 1) $$

  3.集成学习

    1.随机森林是基于Bagging思想的集成学习算法;

    2.梯度增强树是基于Boosting思想的集成学习算法。

  参考资料

    一些名词概念参考资料:

https://www.zhihu.com/question/23194489

https://www.zhihu.com/question/269063159

https://www.zhihu.com/question/28221429

https://www.zhihu.com/question/20473040

https://elitedatascience.com/algorithm-selection

    拟合算法及公式参考:

http://scikit-learn.org/stable/modules/linear_model.html

https://en.wikipedia.org/wiki/Lasso_(statistics)

https://en.wikipedia.org/wiki/Tikhonov_regularization

     关于两种集成学习思想的一些解释参考:

https://www.zhihu.com/question/29036379

https://www.bbsmax.com/A/lk5axwNJ1O/

https://blog.csdn.net/autoliuweijie/article/details/50285817

https://blog.csdn.net/google19890102/article/details/46507387

http://scikit-learn.org/stable/modules/ensemble.html#classification

 

Kaggle Machine Learning 教程学习(五)

标签:random   machine   ssi   表达   auto   因子   ace   任务   square   

原文地址:https://www.cnblogs.com/darkchii/p/8902405.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!