“ML”的版本间的差异
来自个人维基
小 |
小 |
||
第14行: | 第14行: | ||
<math>θ_j:=θ_j+α\frac{∂}{∂θ_j}J(θ)</math> | <math>θ_j:=θ_j+α\frac{∂}{∂θ_j}J(θ)</math> | ||
对于线性模型,其损失函数为均方误差,故有: | 对于线性模型,其损失函数为均方误差,故有: | ||
− | + | <math>\frac{∂}{∂θ_j}J(θ)= \frac{∂}{∂θ_j}(\frac{1}{2m}\sum_{i=1}^m(h_θ(x^{(i)})-y^{(i)})^2)</math> | |
− | <math>\frac{∂}{∂θ_j}J(θ)= \frac{∂}{∂θ_j}(\frac{1}{2m}\sum_{i=1}^m(h_θ( | + | :<math>= \frac{1}{2m}\frac{∂}{∂θ_j}(\sum_{i=1}^m(h_θ(x^{(i)})-y^{(i)})^2)</math> |
− | :<math>= \frac{1}{2m}\frac{∂}{∂θ_j}(\sum_{i=1}^m(h_θ( | + | :<math>= \frac{1}{2m}\sum_{i=1}^m( \frac{∂}{∂θ_j}(h_θ(x^{(i)})-y^{(i)})^2 )</math> |
− | :<math>= \frac{1}{2m}\sum_{i=1}^m( \frac{∂}{∂θ_j}(h_θ( | + | :<math>= \frac{1}{m}\sum_{i=1}^m( (h_θ(x^{(i)})-y^{(i)}) \frac{∂}{∂θ_j}h_θ(x^{(i)}) ) //链式求导法式</math> |
− | :<math>= \frac{1}{m}\sum_{i=1}^m( (h_θ( | + | :<math>= \frac{1}{m}\sum_{i=1}^m( (h_θ(x^{(i)})-y^{(i)}) \frac{∂}{∂θ_j}x^{(i)}θ ) </math> |
− | :<math>= \frac{1}{m}\sum_{i=1}^m( (h_θ( | + | :<math>= \frac{1}{m}\sum_{i=1}^m( (h_θ(x^{(i)})-y^{(i)}) \frac{∂}{∂θ_j}\sum_{k=0}^{n}x_k^{(i)}θ_k ) </math> |
− | :<math>= \frac{1}{m}\sum_{i=1}^m( (h_θ( | + | |
对于j>=1: | 对于j>=1: | ||
− | :<math>= \frac{1}{m}\sum_{i=1}^m( (h_θ( | + | :<math>= \frac{1}{m}\sum_{i=1}^m( (h_θ(x^{(i)})-y^{(i)}) x_j^{(i)} ) </math> |
:<math>= \frac{1}{m} (h_θ(x)-y) x_{j} </math> | :<math>= \frac{1}{m} (h_θ(x)-y) x_{j} </math> | ||
2018年12月21日 (五) 20:39的版本
目录[隐藏] |
定义
- 约定:
- x(i)j:训练数据中的第i列中的第j个特征值 value of feature j in the ith training example
- x(i):训练数据中第i列 the input (features) of the ith training example
- m:训练数据集条数 the number of training examples
- n:特征数量 the number of features
Week1
Cost Function损失函数
Squared error function/Mean squared function均方误差:
Cross entropy交叉熵:
Gradient Descent梯度下降
对于线性模型,其损失函数为均方误差,故有:
对于j>=1:
Week2
Multivariate Linear Regression
其中,
- m为训练数据组数,n为特征个数(通常,为了方便处理,会令。
Feature Scaling & Standard Normalization
其中,是第i个特征数据x_i的均值,而 则要视情况而定:
- Feature Scaling:为中最大值与最小值的差(max-min);
- Standard Normalization:为中数据标准差(standard deviation)。