逻辑回归:实际解决分类问题
回归怎么解决分类问题?将样本的特征和样本发生的概率联系起来,概率是一个数,由于概率是一个数,所以可以管它叫做回归问题。对于机器学习算法来说,本质就是 求出一个函数小f,如果此时有一个样本x,经过f的运算之后就会得到一个预测值,通常称之为y。y的值实际上就是本身我们关心的那个指标。但是在逻辑回归中,我们得到的y的值本质是一个概率值。如果我们不进行最后一步根据p的值进行分类的操作的话,那么他此时就是一个回归算法(我们计算出的是:我们通过一个样本的特征来拟合计算一个事件发生的概率);那么我们通过这个概率就可以进一步给他分类
![](https://img-blog.csdnimg.cn/img_convert/4448ea1baea7b6c2b2182c8c541df4f5.png)
多分类问题逻辑回归本身是不支持的(当然可以使用一些其他的技巧进行改进),KNN算法天生可以支持多分类问题
![](https://img-blog.csdnimg.cn/img_convert/812b95880020811e360968f0f0df67b3.png)
![](https://img-blog.csdnimg.cn/img_convert/037a0f718f416510d0dce68960e0eff0.png)
![](https://img-blog.csdnimg.cn/img_convert/a4e3647368170ec588753b3ead5ab146.png)
![](https://img-blog.csdnimg.cn/img_convert/04d3c5655d1f25b91659f6e342a2cdb1.png)
![](https://img-blog.csdnimg.cn/img_convert/4efaebbf717c54d6e5f04d5cf6717311.png)
![](https://img-blog.csdnimg.cn/img_convert/83657baaec89c912e46269a0e99d8818.png)
![](https://img-blog.csdnimg.cn/img_convert/d06653bc544a08e4a1127fb28708471a.png)
![](https://img-blog.csdnimg.cn/img_convert/c846671bc2c6e95390f48a23bf504ff3.png)
![](https://img-blog.csdnimg.cn/img_convert/67b3f0ff34efcc4885244ded6b82e313.png)
![](https://img-blog.csdnimg.cn/img_convert/b6026d847932c8c676ef9c4a4818ca12.png)
![](https://img-blog.csdnimg.cn/img_convert/5636464df70e32f3cdd997bbbfd98f56.png)
![](https://img-blog.csdnimg.cn/img_convert/0cc9165795c3fe22e0637af5bab36b82.png)
逻辑回归损失函数的梯度求解(梯度下降法)
![](https://img-blog.csdnimg.cn/img_convert/e1b42e06b0c4bb081bc2defa4f535ec4.png)
![](https://img-blog.csdnimg.cn/img_convert/da510b92fcd23f87595c3a7387dbfc61.png)
![](https://img-blog.csdnimg.cn/img_convert/f0b663c1e13956b27ee9a2ed18a127b9.png)
![](https://img-blog.csdnimg.cn/img_convert/102c5fde3a1f170a93b5c945aeb48e1a.png)
![](https://img-blog.csdnimg.cn/img_convert/6093ab4474daab210d4c18d587d9e092.png)
![](https://img-blog.csdnimg.cn/img_convert/9b7152e378855c0f8e46161c70503b5e.png)
![](https://img-blog.csdnimg.cn/img_convert/d66b45672f2c470cc933ec7a5b68ef2a.png)
![](https://img-blog.csdnimg.cn/img_convert/1b1a11b0fe58dd0ba837ac94b886f983.png)
![](https://img-blog.csdnimg.cn/img_convert/8189ab646a6428dcafa7a8996abc1f03.png)
![](https://img-blog.csdnimg.cn/img_convert/35b110bd3f5f8229c35b59af09314f20.png)
![](https://img-blog.csdnimg.cn/img_convert/10844fd5baa5bb068725d6c754820369.png)
![](https://img-blog.csdnimg.cn/img_convert/9b2cd217efb82b72f28d6593effa0993.png)
![](https://img-blog.csdnimg.cn/img_convert/a0014e7625187172836c22c2af614db5.png)
![](https://img-blog.csdnimg.cn/img_convert/273071a87ee18ab407506582284737c2.png)
![](https://img-blog.csdnimg.cn/img_convert/03bd8382e2572706b785d33c89b00a48.png)
![](https://img-blog.csdnimg.cn/img_convert/5a674ea277eda168b7a5ad9e36f0be32.png)
![](https://img-blog.csdnimg.cn/img_convert/5d13240b5f10aa39fe5ce6e27f6f306a.png)
在逻辑回归中使用多项式特征
防止过拟合:使用正则化方法
![](https://img-blog.csdnimg.cn/img_convert/ff3f63bb452d925ed974dbccef1718f1.png)
![](https://img-blog.csdnimg.cn/img_convert/205b0378322c830f2a32cc9c747b16da.png)
![](https://img-blog.csdnimg.cn/img_convert/535ceeaa97e6feabe5cccf12d29882cc.png)
![](https://img-blog.csdnimg.cn/img_convert/2b38e2cf0774f188e18e0356a6c35fca.png)
![](https://img-blog.csdnimg.cn/img_convert/80d5ec580a7c66b9a5cbaf86ce6b6252.png)
![](https://img-blog.csdnimg.cn/img_convert/ba1e5a584bcf84cb5adc6675707fef7f.png)
![](https://img-blog.csdnimg.cn/img_convert/31713ee5daf49cd2dcaf0b08e94b9f29.png)
![](https://img-blog.csdnimg.cn/img_convert/0e3706192e61828d6b4fb1335e206a9d.png)
![](https://img-blog.csdnimg.cn/img_convert/80b10698118f11f845dacda1c750d4aa.png)
![](https://img-blog.csdnimg.cn/img_convert/e27cfeaa8598d838391c12e1a0dd1cae.png)