Add. Example

pull/2/head
benjas 4 years ago
parent 4acc814fda
commit e64e56a5fd

@ -159,4 +159,34 @@ Learning policy
3. 更新wb
![1618234028471](assets/1618234028471.png)
![1618234028471](assets/1618234028471.png)
### 例子
Example
训练数据中正例y=+1点位x1 = (3,3)Tx2 = (4,3)T负例y=-1为x3 = (1, 1)T求解感知机模型f(x) = sign(w*x + b)其中w = (w1, w2)Tx = (x1, x2)T
解:
1. 构造损失函数
![1618234528190](assets/1618234528190.png)
2. 梯度下降求解wb。设步长为1
1. 取初值w0 = 0b0 = 0
2. 对于x1y1(w0 * x1 + b0) = 0未被正确分类更新wb。w1 = w0 + x1y1 = (3,3)Tb1 = b0 + y1 = 1 => w1 * x + b1 = 3x + 3x + 1
3. 对x1x2显然yi(w1 * xi + b1) > 0被正确分类不做修改。对于x3y3(w1 * x3 + b1) 应该小于0结果是大于0被误分类更新wb。
![1618234885210](assets/1618234885210.png)
4. 以此往复,直到没有误分类点,损失函数达到极小。
![1618234973878](assets/1618234973878.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Loading…
Cancel
Save