• 逻辑回归
• 问题描述
• 模型建模
• 模型求解
• 多分类

## 逻辑回归

### 模型建模

z = β 0 + β 1 x 1 + β 2 x 2 + . . . + β m x m = β T x z = \beta_0 + \beta_1x_1 + \beta_2x_2 + ... + \beta_mx_m =\beta^Tx

z = β 0 + β 1 ϕ ( x 1 ) + β 2 ϕ ( x 2 ) + . . . + β m ϕ ( x m ) = β T ϕ ( x ) z = \beta_0 + \beta_1\phi(x_1) + \beta_2\phi(x_2) + ... + \beta_m\phi(x_m) =\beta^T\phi(x)

y n = p ( C 1 ∣ β ) = 1 1 + e − z y_n = p(C_1|\beta) = \frac{1}{1+e^{-z}}

### 模型求解

y n t n ( 1 − y n ) 1 − t n y_n^{t_n}(1-y_n)^{1-t_n}

p ( t ∣ β ) = ∏ n = 1 N y n t n ( 1 − y n ) 1 − t n p(t|\beta)=\prod\limits_{n=1}^N y_n^{t_n}(1-y_n)^{1-t_n}
ln p ( t ∣ β ) = ∑ n = 1 N t n ln y n + ( 1 − t n ) ln ( 1 − y n ) \text{ln}p(t|\beta)=\sum\limits_{n=1}^N t_n \text{ln} y_n + (1-t_n)\text{ln}(1-y_n)

∂ ln p ( t ∣ β ) ∂ β = ∑ n = 1 N { t n σ ( z ) − 1 − t n 1 − σ ( z ) } ∂ σ ( z ) ∂ z = ∑ n = 1 N { t n σ ( z ) − 1 − t n 1 − σ ( z ) } σ ( z ) ( 1 − σ ( z ) ) ∂ z ∂ β = ∑ n = 1 N { t n ( 1 − σ ( z ) ) − ( 1 − y n ) σ ( z ) } ϕ ( x n ) = ∑ n = 1 N { t n − y n } ϕ ( x n ) = 0 \begin{align*} \frac{\partial \text{ln}p(t|\beta)}{\partial \beta} &= \sum\limits_{n=1}^N\{\frac{t_n}{\sigma(z)}- \frac{1-t_n}{1-\sigma(z)} \}\frac{\partial \sigma(z)}{\partial z} \\ &= \sum\limits_{n=1}^N\{\frac{t_n}{\sigma(z)}- \frac{1-t_n}{1-\sigma(z)} \} \sigma(z)(1-\sigma(z)) \frac{\partial z}{\partial \beta} \\ &= \sum\limits_{n=1}^N \{t_n (1-\sigma(z)) - (1-y_n)\sigma(z) \}\phi(x_n) \\ &= \sum\limits_{n=1}^N \{t_n-y_n\}\phi(x_n) \\ &=0 \end{align*}

Φ = [ ϕ 0 ( x 1 ) ϕ 1 ( x 1 ) ⋯ ϕ D ( x 1 ) ϕ 0 ( x 2 ) ϕ 1 ( x 2 ) ⋯ ϕ D ( x 2 ) ⋮ ⋮ ⋱ ⋮ ϕ 0 ( x N ) ϕ 1 ( x N ) ⋯ ϕ D ( x N ) ] \Phi = \begin{bmatrix} \phi_0(x_1) & \phi_1(x_1) & \cdots & \phi_D(x_1) \\ \phi_0(x_2) & \phi_1(x_2) & \cdots & \phi_D(x_2) \\ \vdots & \vdots & \ddots & \vdots \\ \phi_0(x_N) & \phi_1(x_N) & \cdots & \phi_D(x_N) \end{bmatrix}
ϕ ( x n ) T = { ϕ 0 ( x n ) , ⋯ , ϕ D ( x n ) } \phi(x_n)^T=\{\phi_0(x_n),\cdots,\phi_D(x_n)\}
∂ ln p ( t ∣ β ) ∂ β = Φ T ( y − t ) \frac{\partial \text{ln}p(t|\beta)}{\partial \beta} = \Phi^T(y-t)

β t + 1 = β t − λ ∑ n = 1 N { t n − 1 1 + e β t T ϕ ( x ) } ϕ ( x n ) = β t − λ Φ T ( y − t ) \begin{align*} \beta_{t+1} &= \beta_{t} - \lambda \sum\limits_{n=1}^N \{t_n-\frac{1}{1+e^{\beta_{t}^T\phi(x)}}\}\phi(x_n) \\ &= \beta_t - \lambda \Phi^T(y-t) \end{align*}

∂ 2 ln p ( t ∣ β ) ∂ β ∂ β T = ∑ n = 1 N y n ( 1 − y n ) ϕ ( x n ) ϕ ( x n ) T = Φ T R Φ \begin{align*} \frac{\partial^2 \text{ln}p(t|\beta)}{\partial \beta \partial \beta^T} &= \sum_{n=1}^{N} y_n(1-y_n)\phi(x_n)\phi(x_n)^T \\ &= \Phi^TR\Phi \end{align*}

w t + 1 = w t − ( Φ T R Φ ) − 1 Φ T ( y − t ) \begin{align*} w_{t+1} = w_t - (\Phi^TR\Phi)^{-1}\Phi^T(y-t) \end{align*}

### 多分类

p ( C k ∣ β k ) = y k = e x p ( a k ) ∑ j e x p ( a j ) p(C_k|\beta^k)=y_k=\frac{exp(a_k)}{\sum_j exp(a_j)}

y n = ∏ k = 1 K y n k t n k y_{n} =\prod^K_{k=1} {y_{nk}}^{t_{nk}}

p ( T ∣ β 1 , β 2 , ⋯ , β K ) = ∏ n = 1 N ∏ k = 1 K y n k t n k p(T|\beta^1,\beta^2,\cdots,\beta^K)=\prod^N_{n=1}\prod^K_{k=1} {y_{nk}}^{t_{nk}}

ln p ( T ∣ β 1 , β 2 , ⋯ , β K ) = ∑ n = 1 N ∑ k = 1 K t n k ln y n k \text{ln}p(T|\beta^1,\beta^2,\cdots,\beta^K)=\sum^N_{n=1}\sum^K_{k=1} t_{nk} \text{ln} {y_{nk}}

∂ ln p ( T ∣ β 1 , β 2 , ⋯ , β K ) ∂ β k = ∑ n = 1 N ( y n k − t n k ) ϕ ( x n ) \frac{\partial \text{ln}p(T|\beta^1,\beta^2,\cdots,\beta^K)}{\partial \beta^k} = \sum^N_{n=1}({y_{nk}-t_{nk}})\phi(x_n)

∂ 2 ln p ( T ∣ β 1 , β 2 , ⋯ , β K ) ∂ β j ∂ β k T = ∑ n = 1 N y n j ( I j k − y n k ) ϕ ( x n ) ϕ ( x n ) T \frac{\partial^2 \text{ln}p(T|\beta^1,\beta^2,\cdots,\beta^K)}{\partial \beta^j \partial {\beta^k}^T} = \sum^N_{n=1} y_{nj}(I_{jk} - y_{nk})\phi(x_n)\phi(x_n)^T

### 【Unity入门】认识Unity编辑器

Unity 是一个广泛应用于游戏开发的强大引擎&#xff0c;从 1.0 版本开始到现在&#xff0c;其编辑器的基本框架一直保持稳定。其基于组件架构的设计&#xff0c;使得界面使用起来直观且高效。为了更好地理解 Unity 的界面&#xff0c;我们可以将其比喻为搭建一个舞台。以下是对…

### Day06-Mybatis

1. Mybatis介绍 2. Mybatis连接数据库并返回数据事例 连接oracle数据的设置方式 spring.application.namespringboot-mybatis spring.datasource.driver-class-nameoracle.jdbc.OracleDriver spring.datasource.urljdbc:oracle:thin:192.168.100.66:1521:orcl spring.datasour…

### 性能测试（一）—— 性能测试理论+jmeter的使用

1.性能测试介绍 定义&#xff1a;软件的性能是软件的一种非功能特性&#xff0c;它关注的不是软件是否能够完成特定的功能&#xff0c;而是在完成该功能时展示出来的及时性。 由定义可知性能关注的是软件的非功能特性&#xff0c;所以一般来说性能测试介入的时机是在功能测试完…

### Jetson Orin Nano v6.0 + tensorflow2.15.0+nv24.05 GPU版本安装

Jetson Orin Nano v6.0 tensorflow2.15.0nv24.05 GPU版本安装 1. 源由2. 步骤2.1 Step1&#xff1a;系统安装2.2 Step2: nvidia-jetpack安装2.3 Step3&#xff1a;jtop安装2.4 Step4&#xff1a;h5py安装2.5 Step5&#xff1a;tensorflow安装2.6 Step6&#xff1a;jupyterlab安…

### HTML静态网页成品作业(HTML+CSS)——动漫熊出没介绍网页(3个页面)

&#x1f389;不定期分享源码&#xff0c;关注不丢失哦 文章目录 一、作品介绍二、作品演示三、代码目录四、网站代码HTML部分代码 五、源码获取 一、作品介绍 &#x1f3f7;️本套采用HTMLCSS&#xff0c;未使用Javacsript代码&#xff0c;共有3个页面。 二、作品演示 三、代…