【Machine Learning】Supervised Learning

这篇具有很好参考价值的文章主要介绍了【Machine Learning】Supervised Learning。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

本笔记基于清华大学《机器学习》的课程讲义监督学习相关部分,基本为笔者在考试前一两天所作的Cheat Sheet。内容较多,并不详细,主要作为复习和记忆的资料。

Linear Regression

Perceptron

  • f ( x ) = s i g n ( w ⊤ x + b ) f(x)=sign(w^\top x+b) f(x)=sign(wx+b)
  • convergence

Logistic Regression

  • output probability instead of labels.
  • Loss: Cross entropy X E ( y , p ) = − ∑ i y i log ⁡ p i XE(y,p)=-\sum_iy_i\log p_i XE(y,p)=iyilogpi. y i y_i yi is the actual probability

Ridge Regression

  • l 2 l_2 l2 regularization λ 2 ∥ w ∥ 2 2 \frac{\lambda}{2}\|w\|^2_2 2λw22
  • Shrink every coordinate: w ′ = w ⋅ ( 1 − η λ ) w'=w\cdot (1-\eta \lambda) w=w(1ηλ)
    • weight decay

LASSO Regression

  • Find sparse features: Want ∥ w ∥ 0 ≤ c \|w\|_0\le c w0c
  • l 1 l_1 l1 regularization λ ∥ w ∥ 1 \lambda\|w\|_1 λw1
  • Gradient: add or minus η λ \eta \lambda ηλ to pull w w w into 0 0 0.

Compressed Sensing*

  • Compare with LASSO: pick X t r a i n X_{train} Xtrain, observe Y t r a i n Y_{train} Ytrain, and learn w w w. Instead of given X t r a i n , Y t r a i n X_{train},Y_{train} Xtrain,Ytrain.
  • RIP condition: A matrix A A A is ( ϵ , s ) (\epsilon,s) (ϵ,s)-RIP if ∥ A x ∥ ≈ ∥ x ∥ \|Ax\|\approx \|x\| Axx for s s s-sparse x x x.
  • Application: reconstruct x x x on a RIP matrix is easy.
    • For sparse x x x
    • For spase x x x + some noise
    • Lemma: RIP implies almost orthogonality
    • Proof*
  • How to find RIP matrix: Random
  • Non-linear sparse: X = G ( Z ) X=G(Z) X=G(Z), Z Z Z is sparse, G G G is non-linear.

SVM

  • Minimize ∥ w ∥ 2 + λ ∑ i ξ i \|w\|_2+\lambda \sum_{i}\xi_i w2+λiξi.
    • Soft version: y i w ⊤ x i ≥ 1 − ξ i , ξ i ≥ 0 y_iw^\top x_i\ge 1-\xi_i,\xi_i\ge 0 yiwxi1ξi,ξi0.
    • maximize margin 1 / ∥ w ∥ 2 1/\|w\|_2 1/∥w2.

Dual derivation

  • Primal problem
    min ⁡ x x 2 x ≥ b \min_x x^2\\ x\ge b xminx2xb

  • Lagrangian L ( x , α ) = x 2 − α ( x − b )  s.t.  α ≥ 0 L(x,\alpha)=x^2-\alpha(x-b)\text{ s.t. }\alpha\ge 0 L(x,α)=x2α(xb) s.t. α0

    • Solution in primal problem correponds to a L ( x , α ) ≤ x 2 L(x,\alpha)\le x^2 L(x,α)x2. Thus min ⁡ x L ( x , α ) \min_x L(x,\alpha) minxL(x,α) is lower bound of the primal solution.
    • Dual: We want to find the maximum lowerbound max ⁡ α d ( α ) = max ⁡ α min ⁡ x L ( x , a ) \max_\alpha d(\alpha)=\max_\alpha \min_xL(x,a) maxαd(α)=maxαminxL(x,a).
    • Strong duality p ∗ = d ∗ p^*=d^* p=d
  • For SVM(hard version)

    • Primal: min ⁡ ∥ w ∥ 2 2 \min\frac{\|w\|_2}{2} min2w2, y i w ⊤ x i ≥ 1 y_iw^\top x_i\ge 1 yiwxi1.

    • Dual: maximize(solved by taking derivative)
      L ( w , α ) = ∥ w ∥ 2 2 − ∑ i α ( y i w ⊤ x i − 1 ) = ∑ i α i − 1 2 ∑ i ∑ j y i y j α i α j ⟨ x i , x j ⟩ α ≥ 0 w = ∑ i α i y i x i L(w,\alpha)=\frac{\|w\|_2}{2}-\sum_i\alpha (y_iw^\top x_i-1)\\ =\sum_{i}\alpha _i-\frac{1}{2}\sum_i\sum_jy_iy_j\alpha_i\alpha_j\langle x_i,x_j\rangle\\ \alpha\ge 0\\ w=\sum_{i}\alpha_iy_ix_i L(w,α)=2w2iα(yiwxi1)=iαi21ijyiyjαiαjxi,xjα0w=iαiyixi

Kernel Method

  • Replace ⟨ x i , x j ⟩ \langle x_i,x_j\rangle xi,xj with ⟨ ϕ ( x i ) , ϕ ( x j ) ⟩ \langle \phi(x_i),\phi(x_j)\rangle ϕ(xi),ϕ(xj)⟩ to embed x x x into a high dimension space.
  • Use k ( x i , x j ) k(x_i,x_j) k(xi,xj) to compute $\langle \phi(x_i),\phi(x_j)\rangle $. Usually gaussian kernel e − ∣ x i − x j ∣ 2 σ 2 e^{-\frac{|x_i-x_j|}{2\sigma^2}} e2σ2xixj
  • Mercer’s theorem: positive semidefinite kernel matrix has a corresponding embedding ϕ \phi ϕ.

Decision Tree

Boolean funcional analysis

  • X S ( x ) = ∏ i ∈ S x i \mathcal{X}_S(x)=\prod_{i\in S}x_i XS(x)=iSxi

  • f ( x ) = ∑ S f S ^ X S ( x ) f(x)=\sum_{S}\hat{f_S}\mathcal{X}_S(x) f(x)=SfS^XS(x)

  • f S ^ = ⟨ f , X S ⟩ = E x ∼ D [ f ( x ) X S ( x ) ] \hat{f_S}=\langle f,\mathcal{X}_S\rangle=\mathbb{E}_{x\sim D}[f(x)\mathcal{X}_S(x)] fS^=f,XS=ExD[f(x)XS(x)]

  • E x ∼ D [ f ( x ) 2 ] = ∑ S f S 2 ^ \mathbb{E}_{x\sim D}[f(x)^2]=\sum_{S}\hat{f_S^2} ExD[f(x)2]=SfS2^

  • Decision tree with s s s leaf nodes can be converted into log ⁡ ( s ϵ ) \log(\frac{s}{\epsilon}) log(ϵs)-degree, sparsity- s 2 ϵ \frac{s^2}{\epsilon} ϵs2 function that 2 ϵ 2\epsilon 2ϵ-appoximates T T T.

    • log depth
    • Combination of AND term
    • Take the bases S S S with big f S ^ \hat{f_S} fS^
  • Estimation

    • LMN: f S ^ = E x ∼ D [ f ( x ) X S ( x ) ] = 1 m ∑ i = 1 m f ( x i ) X S ( x i ) \hat{f_S}=\mathbb{E}_{x\sim D}[f(x)\mathcal{X}_S(x)]=\frac{1}{m}\sum_{i=1}^m f(x_i)\mathcal{X}_{S}(x_i) fS^=ExD[f(x)XS(x)]=m1i=1mf(xi)XS(xi)
      • Not work well in practice. Have not guarantees in noisy setting
    • Compressed Sensing
      • y = A x + e y=Ax+e y=Ax+e: x x x contains f S ^ \hat{f_S} fS^, A A A and y y y are from samples.
      • Lasso find x ∗ x^* x with bounded error.

Splitting variables

  • Greedy: Gini index*

Random forest

  • overfitting problem
  • Construct B B B trees, every tree is trained by n n n samples, which is from { ( x i , y i ) } i = 1 n \{(x_i,y_i)\}_{i=1}^n {(xi,yi)}i=1n with replacement(可重复), each element will miss with probability ( 1 − 1 n ) n = 1 e (1-\frac{1}{n})^n=\frac{1}{e} (1n1)n=e1
  • Output the average of B B B trees
  • Can also bag the features

Adaboost*

  • Combine weak learners. Make hard cases more likely.

  • Sample distribution D t ( i ) D_t(i) Dt(i) in t t t round. ϵ t = Pr ⁡ i ∼ D t [ h t ( x i ) ≠ y i ] \epsilon_t=\Pr_{i\sim D_t}[h_t(x_i)\neq y_i] ϵt=PriDt[ht(xi)=yi].

  • D 1 ( i ) = 1 m D_1(i)=\frac{1}{m} D1(i)=m1Learn h t h_t ht from D t ( i ) D_t(i) Dt(i)
    D t + 1 ( i ) = { 1 Z t D t ( i ) e − α t y i = h t ( x i ) 1 Z t D t ( i ) e α t y i ≠ h t ( x i ) α = 1 2 ln ⁡ ( 1 − ϵ t ϵ t ) D_{t+1}(i)=\begin{cases} \frac{1}{Z_t}D_t(i)e^{-\alpha_t} && y_i=h_t(x_i)\\ \frac{1}{Z_t}D_t(i)e^{\alpha_t} && y_i\neq h_t(x_i) \end{cases}\\ \alpha=\frac{1}{2}\ln\left(\frac{1-\epsilon_t}{\epsilon_t}\right) Dt+1(i)={Zt1Dt(i)eαtZt1Dt(i)eαtyi=ht(xi)yi=ht(xi)α=21ln(ϵt1ϵt)

  • H f i n a l = s i g n ( ∑ α t h t ) H_{final}=sign(\sum \alpha_t h_t) Hfinal=sign(αtht)

  • ϵ t = 1 2 − γ t \epsilon_t=\frac{1}{2}-\gamma_t ϵt=21γt.

    • γ t \gamma_t γt means how better this weak learner is than random classifier.

    e r r o r ( H f i n a l ) ≤ ∏ t 2 ϵ t ( 1 − ϵ t ) ≤ ∏ t 1 − 4 γ t 2 ≤ exp ⁡ ( − 2 ∑ t γ t 2 ) error(H_{final})\le \prod _{t}2\sqrt{\epsilon_t(1-\epsilon_t)}\le \prod_t\sqrt{1-4\gamma_t^2}\le \exp\left(-2\sum_t\gamma_t^2\right) error(Hfinal)t2ϵt(1ϵt) t14γt2 exp(2tγt2)

  • Proof:

    • D T ( i ) = 1 m exp ⁡ ( − y i ∑ t α t h t ( x i ) ∏ t Z t D_T(i)=\frac{1}{m}\frac{\exp(-y_i\sum_{t}\alpha _th_t(x_i)}{\prod_tZ_t} DT(i)=m1tZtexp(yitαtht(xi)

    • e r r o r ( H f i n a l ) = 1 m ∑ i = 1 m 1 y i f ( x i ) ≤ 0 = 1 m ∑ i = 1 m exp ⁡ ( − y i f ( x i ) ) = ∑ i = 1 m D T ( i ) ∏ t Z t = ∏ t Z t \begin{align*} error(H_{final})&=\frac{1}{m}\sum_{i=1}^m 1_{y_if(x_i)\le 0}\\ &=\frac{1}{m}\sum_{i=1}^m \exp(-y_if(x_i))\\ &=\sum_{i=1}^m D_T(i)\prod_t Z_t\\ &=\prod_t Z_t \end{align*} error(Hfinal)=m1i=1m1yif(xi)0=m1i=1mexp(yif(xi))=i=1mDT(i)tZt=tZt

    • Z t = ∑ i D t ( i ) exp ⁡ ( − α t y i h ( x i ) ) = ( 1 − ϵ t ) e − α t + ϵ t e α t Z_t=\sum_{i}D_t(i)\exp(-\alpha_ty_ih(x_i))=(1-\epsilon_t)e^{-\alpha_t}+\epsilon_te^{\alpha_t} Zt=iDt(i)exp(αtyih(xi))=(1ϵt)eαt+ϵteαt

      To minimize Z t Z_t Zt, α t = 1 2 ln ⁡ ( 1 − ϵ t ϵ t ) \alpha_t=\frac{1}{2}\ln(\frac{1-\epsilon_t}{\epsilon_t}) αt=21ln(ϵt1ϵt), then Z t = 2 ϵ t ( 1 − ϵ t ) Z_t=2\sqrt{\epsilon_t(1-\epsilon_t)} Zt=2ϵt(1ϵt)

  • Generalization

  • Drawback: Only binary classification

  • Extension: Gradient boosting: Regression, minimize 1 2 ∑ i ( F ( x i ) − y i ) 2 \frac{1}{2}\sum_i(F(x_i)-y_i)^2 21i(F(xi)yi)2文章来源地址https://www.toymoban.com/news/detail-808365.html

    • Adaboost use Coordinate descent: change α t \alpha_t αt from 0 0 0 to α t \alpha_t αt in round t t t. Only change one coordinate since the dimension is too large.
    • learn a new regression tree h ( x ) h(x) h(x) to fit ∂ L / ∂ F ( x i ) = F ( x i ) − y \partial L/\partial F(x_i)=F(x_i)-y L/F(xi)=F(xi)y for square loss. Then update F ′ ( x ) = F ( x ) + η h ( x ) F'(x)=F(x)+\eta h(x) F(x)=F(x)+ηh(x)

到了这里,关于【Machine Learning】Supervised Learning的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 应用机器学习的建议 (Advice for Applying Machine Learning)

    问题: 假如,在你得到你的学习参数以后,如果你要将你的假设函数放到一组 新的房屋样本上进行测试,假如说你发现在预测房价时产生了巨大的误差,现在你的问题是要想改进这个算法,接下来应该怎么办? 解决思路: 一种办法是使用更多的训练样本。具体来讲,也许你

    2024年01月25日
    浏览(40)
  • 现实生活中机器学习的具体示例(Machine Learning 研习之二)

    机器学习在现实中的示例 通过上一篇的讲解,我们多多少少对 机器学习 (Machine Learning)有了些许了解,同时也对 机器学习 (Machine Learning)一词不再那么抗拒了。 那么, 机器学习 到底在现实生活为我们解决哪些难题呢?亦或是传统方案目前无法实现的。 1、可以分析生产

    2024年02月16日
    浏览(38)
  • 机器学习中的 Transformation Pipelines(Machine Learning 研习之十)

    Transformation Pipelines 有许多数据转换步骤需要以正确的顺序执行。幸运的是, Scikit-Learn 提供了 Pipeline 类来帮助处理这样的转换序列。下面是一个用于数值属性的小管道,它首先对输入特性进行归并,然后对输入特性进行缩放: Pipeline 构造函数采用名称/估算器对(2元组)的列表,

    2024年02月04日
    浏览(36)
  • 机器学习在网络安全领域的应用 Demystifying Cybersecurity with Machine Learning

    作者:禅与计算机程序设计艺术 什么是机器学习(Machine Learning)?又是如何应用在网络安全领域呢?本文将详细阐述其定义、分类及历史沿革,同时介绍一些机器学习的基本概念和技术,帮助企业界更好地理解和掌握机器学习在网络安全领域的应用。通过相关案例实践,全

    2024年02月06日
    浏览(37)
  • Azure Machine Learning - 聊天机器人构建

    本文介绍如何部署和运行适用于 Python 的企业聊天应用示例。 此示例使用 Python、Azure OpenAI 服务和 Azure AI 搜索中的检索扩充生成(RAG)实现聊天应用,以获取虚构公司员工福利的解答。 关注TechLead,分享AI全维度知识。作者拥有10+年互联网服务架构、AI产品研发经验、团队管理

    2024年01月19日
    浏览(46)
  • 【概念记录】什么是 行最简形 矩阵?| 人工智能 面试题:解释一下集成学习(Ensemble Learning)的概念和优势。| 集成学习 概念,优势,方法

      “生活不是电影,生活比电影苦。”     🎯作者主页: 追光者♂🔥          🌸个人简介:   💖[1] 计算机专业硕士研究生💖   🌿[2] 2023年城市之星领跑者TOP1(哈尔滨)🌿   🌟[3] 2022年度博客之星人工智能领域TOP4🌟   🏅[4] 阿里云社区特邀专家博主🏅   🏆[5] CSD

    2024年02月06日
    浏览(53)
  • 机器学习入门教学——人工智能、机器学习、深度学习

    1、人工智能 人工智能相当于人类的代理人,我们现在所接触到的人工智能基本上都是弱AI,主要作用是正确解释从外部获得的数据,并对这些数据加以学习和利用,以便灵活的实现特定目标和任务。 例如: 阿尔法狗、智能汽车 简单来说: 人工智能使机器像人类一样进行感

    2024年02月09日
    浏览(74)
  • 人工智能|机器学习——基于机器学习的舌苔检测

    基于深度学习的舌苔检测毕设留档.zip资源-CSDN文库 目前随着人们生活水平的不断提高,对于中医主张的理念越来越认可,对中医的需求也越来越多。在诊断中,中医通过观察人的舌头的舌质、苔质等舌象特征,了解人体内的体质信息从而对症下药。 传统中医的舌诊主要依赖

    2024年02月22日
    浏览(55)
  • 人工智能与机器人|机器学习

    原文链接: https://mp.weixin.qq.com/s/PB_n8woxdsWPtrmL8BbehA 机器学习下包含神经网络、深度学习等,他们之间的关系表示如图2-7所示。 图2-7 关系图 那么什么是机器学习、深度学习、他们的区别又是什么呢? 2.7.1 什么是机器学习? 机器学习是 人工智能 (AI) 和计算机科学的一个分支,

    2024年02月06日
    浏览(73)
  • 人工智能与机器学习

    欢迎关注博主 Mindtechnist 或加入【Linux C/C++/Python社区】一起探讨和分享Linux C/C++/Python/Shell编程、机器人技术、机器学习、机器视觉、嵌入式AI相关领域的知识和技术。 专栏:《机器学习》 ​ ​ ☞什么是人工智能、机器学习、深度学习 人工智能这个概念诞生于1956年的达特茅斯

    2024年02月02日
    浏览(50)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包