Linear/Logistic/Softmax Regression对比

本文对比了Linear Regression、Logistic Regression和Softmax Regression三种常见的机器学习模型,它们都属于广义线性模型。Linear Regression用于回归,Logistic Regression用于二分类,Softmax Regression则用于多分类。三者在模型输出、损失函数和梯度上有相似之处,其中Softmax Regression可视为Logistic Regression的多类别扩展。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Linear/Logistic/Softmax Regression是常见的机器学习模型,且都是广义线性模型的一种,有诸多相似点,详细对比之。原文见Linear/Logistic/Softmax Regression对比

概述

Linear Regression是回归模型,Logistic Regression是二分类模型,Softmax Regression是多分类模型,但三者都属于广义线性「输入的线性组合」模型「GLM」。

其中Softmax Regression可以看做Logistic Regression在多类别上的拓展。

Softmax Regression (synonyms: Multinomial Logistic, Maximum Entropy Classifier, or just Multi-class Logistic Regression) is a generalization of logistic regression that we can use for multi-class classification (under the assumption that the classes are mutually exclusive).

符号约定

  • 样本 ( x ( i ) , y ( i ) ) (x^{(i)}, y^{(i)}) (x(i),y(i))
  • 样本数 m m m
  • 特征维度 n n n
  • Linear Regression输出 y ( i ) y^{(i)} y(i)
  • Logistic Regression类别 y ( i ) ∈ { 0 , 1 } y^{(i)}\in\{0,1\} y(i){ 0,1}
  • Softmax Regression类别 y ( i ) ∈ { 1 , … , K } y^{(i)}\in\{1,\ldots,K\} y(i){ 1,,K}
  • Softmax Regression类别数 K K K
  • 损失函数 J ( θ ) J(\theta) J(θ)
  • Indicator函数 I { b o o l e a n } I\{boolean\} I{ boolean}

模型参数对比

Linear Regression,维度为 ( n ⋅ 1 ) (n \cdot 1) (n1)的向量

θ = [ ∣ θ ∣ ] \theta = \begin{bmatrix} \vert \\ \theta \\ \vert \end{bmatrix} θ=θ

Logistic Regression,维度为 ( n ⋅ 1 ) (n \cdot 1) (n1)的向量

θ = [ ∣ θ ∣ ] \theta = \begin{bmatrix} \vert \\ \theta \\ \vert \end{bmatrix} θ=θ

Softmax Regression,维度为 ( n ⋅ K ) (n \cdot K) (nK)的矩阵

θ = [ ∣ ∣ ∣ ∣ θ ( 1 ) θ ( 2 ) … θ ( K ) ∣ ∣ ∣ ∣ ] \theta = \begin{bmatrix} \vert & \vert & \vert & \vert \\ \theta^{(1)} & \theta^{(2)} & \dots & \theta^{(K)} \\ \vert & \vert & \vert & \vert \\ \end{bmatrix}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值