mirror of
https://github.com/apachecn/ailearning.git
synced 2026-06-30 02:06:14 +08:00
修改5.LR文档
This commit is contained in:
@@ -245,6 +245,10 @@ def gradAscent(dataMatIn, classLabels):
|
||||
return array(weights)
|
||||
```
|
||||
|
||||
大家看到这儿可能会有一些疑惑,就是,我们在迭代中更新我们的回归系数,后边的部分是怎么计算出来的?为什么会是 alpha * dataMatrix.transpose() * error ?因为这就是我们所求的梯度,也就是对 f(w) 对 w 求一阶导数。具体推导如下:
|
||||
|
||||

|
||||
|
||||
> 测试算法: 使用 Logistic 回归进行分类
|
||||
|
||||
```python
|
||||
|
||||
BIN
images/5.Logistic/LR_21.png
Normal file
BIN
images/5.Logistic/LR_21.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 726 KiB |
Reference in New Issue
Block a user