“ML”的版本间的差异

来自个人维基
跳转至: 导航搜索
Week3 - Logistic Regression
Week2
第24行: 第24行:
 
:<math>= \frac{1}{m} (h_&theta;(x)-y) x_{j}  </math>
 
:<math>= \frac{1}{m} (h_&theta;(x)-y) x_{j}  </math>
  
=Week2=
+
=Week2 - Multivariate Linear Regression=
==Multivariate Linear Regression==
+
==Multivariate Linear Regression模型的计算==
 
<math>h_&theta;(x) = &theta;_0x_0 + &theta;_1x_1 + &theta;_2x_2 + ... + &theta;_nx_n</math>
 
<math>h_&theta;(x) = &theta;_0x_0 + &theta;_1x_1 + &theta;_2x_2 + ... + &theta;_nx_n</math>
 
::<math> = [&theta;_0x_0^{(1)}, &theta;_0x_0^{(2)}, ..., &theta;_0x_0^{(m)}] + [&theta;_1x_1^{(1)}, &theta;_1x_1^{(2)}, ..., &theta;_1x_1^{(m)}] + ... + [&theta;_nx_n^{(1)}, &theta;_nx_n^{(2)}, ..., &theta;_nx_n^{(m)}] </math>
 
::<math> = [&theta;_0x_0^{(1)}, &theta;_0x_0^{(2)}, ..., &theta;_0x_0^{(m)}] + [&theta;_1x_1^{(1)}, &theta;_1x_1^{(2)}, ..., &theta;_1x_1^{(m)}] + ... + [&theta;_nx_n^{(1)}, &theta;_nx_n^{(2)}, ..., &theta;_nx_n^{(m)}] </math>
第57行: 第57行:
 
:m为训练数据组数,n为特征个数(通常,为了方便处理,会令<math>x_0^{(i)}=1, i=1,2,...,m)</math>。
 
:m为训练数据组数,n为特征个数(通常,为了方便处理,会令<math>x_0^{(i)}=1, i=1,2,...,m)</math>。
  
==Feature Scaling & Standard Normalization==
+
==数据归一化:Feature Scaling & Standard Normalization==
 
<math>
 
<math>
 
x_i := \frac{x_i-&mu;_i}{s_i}
 
x_i := \frac{x_i-&mu;_i}{s_i}

2018年12月21日 (五) 22:44的版本

目录

 [隐藏

定义

约定:
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

Multivariate Linear Regression模型的计算

其中,

m为训练数据组数,n为特征个数(通常,为了方便处理,会令

数据归一化:Feature Scaling & Standard Normalization


其中,是第i个特征数据x_i的均值,而 则要视情况而定:

  • Feature Scaling:中最大值与最小值的差(max-min);
  • Standard Normalization:中数据标准差(standard deviation)。

特别注意,通过 Feature scaling训练出模型后,在进行预测时,同样需要对输入特征数据进行归一化。

Normal Equation标准工程

Week3 - Logistic Regression & Overfitting

Logistic Regression

Sigmoid Function - S函数



Cost Function


向量化形式:

Gradient Descent

向量化形式:

解决Overfitting

针对 hypothesis function,引入 Regularation parameter()到 Cost function中: