0%

机器学习基本算法1-逻辑回归

逻辑回归Logistic Regression

与线性回归不同,逻辑回归不拟合样本分布,而是确定决策边界。决策边界可以是线性,也可以是非线性。

由线性回归引出逻辑回归

在用线性模型处理回归任务时,例如二分类问题,我们通过引入“单位阶跃函数”(红色部分)来产生0/1的判断值。当然,我们希望它是连续的,故采用近似的替代函数——“对数几率函数“(Sigmoid函数)。

z  01  01-

实质上,是用线性回归模型的预测结果去逼近真实标记的对数几率,这是一种分类学习方法。

  • 它无需事先假设数据分布,避免了假设分布不准确;

  • 它不仅仅得到了一个分类标签,更可以得到近似概率预测,对许多需利用概率辅助决策的任务很有用;

  • 对率函数是任意阶可导的凸函数,有很好的数学性质。

逻辑回归背后的数学原理 — 极大似然估计Maximun likelihood

ΓΙ Ι(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANkAAABBCAIAAADT6ZYPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEk4AABJOAV4u5coAAA+CSURBVHhe7Zx/TBtnmsffPVaOWDlCmigRI6p4UzEkwkm0ZqPajTrE1IRVnEQhRXVyFCKyTrdHwh2pN+FoQ0gLZMvClQspDdtcuabFbYNzFOfEmivBB8W9FO9xuAIGNQwqa2ujsYI8ahRLqCNFvfcdDz9sbBMMtCZ5P3945n09jM37fN/3eZ73fcc/++GHHwAGEwf8nXTEYH5qsBYx8QLWIiZewFrExAs4d1kFphnz261DLo/iZKni61tu+Tq2m8usrjWky6QLMOHA4+LKw/W1jj9buH8nZ70+sOGlitJXjId3uprtLkF6HxMerMWVR0jM2K8QxvuAMkdPJ8MKn+9vgNpI4FExOliLK49Ca1AD1gUoZSqJynfZgQkqc6dCfBMTEazFVYH7dpQF1Pan5ejc1eNKVSk3uu3dLHbTUcBaXA38njEHUCtTk+A5a//ARdGZycOttwQZdtNRwFpcDTj3IKHeoxQ9tEL1gsrnbDWPaIw67Kajged0MPECHhcx8QLWIiZewFrExAs4XowZ3v5mXk2fVFg2dIWlS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ut/OTiHyHjt6yGimbjEyPySIiBDTL5kcyS/xpcQ0iuMfRIl2A4XF3VEfJfTsqnUHGgiYGn3AS3njjDekUs0TQk7d+jun7tOGyZXJWf9PM/45Nr9+0acP6nz8EMtnc6qV/mnc7OxsvvnN7zo/evX3b/YtNTxEbZD+bd+0TCv5tp5hZ/HfG6Ir2Kl0gkWLMWSUt4lkE8O+MYS1i4gYcL2LiBaxFTLyAtYiJF7AWVxPBz9obS8RNWZhFwVpcJXjnFVPllda269a5qUdMVLAWVwlCfbKh6vSRZ5+SyphFwVrExAtYi5h4AWsREy9gLWLiBaxFTLyAtYiJF/DeiNWC/czU/JXgHWQ4QChUCmJHYe3xBT+lgJkH1iImXsA+GhMvYC1i4gWsRUx8AMD/A/QbQtLcGjQNAAAAAElFTkSuQmCC)  lik(w) =

似然函数的本质,即选择最佳的参数值w,来最大化样本数据的可能性。同时,为了防止连乘带来的数字下溢,两边同时取对数,得到log可能性函数:

log — 1u.'))

所以,逻辑回归的损失函数

img

S:Sigmoid函数

n:训练样本集总数

加上对数之后

l(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAp4AAABPCAIAAADN6VJnAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEk4AABJOAV4u5coAACoqSURBVHhe7Z0PVBNn2ujnu+xNr/vF63eGTy+5ds3aj9Eeop6Ny26ou6G4oe41tWvULSiCovHPRbDYtFBakbUYtha+srKiVG1WK9ECrhK/2vipyWpJjyV7WbLHEk5lctRwyg6nHuash5zLcc569847M5BJMgkh/8Ds+ztImCGS5J3nz/s+z/M+809///vfEQgEAoFAIMnCf+EeIRAIBAKBJAXQtUMgEAgEklRA1w6BQCAQSFIBXTsEAoFAIEkFdO0QCAQCgSQV0LVDIBAIBJJUQNcOgUAgEEhSAV07BAKBQCBJBXTtEAgEAoEkFdC1QyAQCASSVEDXDoFAIBBIUgFdOwQCgUAgSQW8PQxkmhhzGj9o7XUMSveUS/98wy1+Br9OZB86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5CYII=) = log(L(w)) = + (1 — (1 —

由于我们的目标是使似然函数最大,为了计算方便,在等式前加上负号,以求得凸函数的最小值,从而引出了交叉熵(Cross entropy)损失函数。

img

只有一个样本的情况下,函数可以拆解为

-log (data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWwAAABsCAIAAADBih9aAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEk4AABJOAV4u5coAAB9iSURBVHhe7Z0PUBPnvvf3Xt83Hc4bxzPr6JDxvOTYIdoh2jnxMCde74SGE+oZo+9bhClSBItGPQfJudpYlBZMW8TWEkvlHJX6J6dWUoV41ThKvCo5cEiPJfdSc6eyvJXNlYa5uJk67JRxpw474/R9nt0FkmxCgYWA+nwmk81uwsNms8/3eX6/53l+v3/48ccfMQQCgZgs/yhsEQgEYlIgEUEgEJJAIoJAICSBRASBQEgCiQgCgZAEEhEEAiEJJCIIBEISSEQQCIQkkIggEAhJIBFBIBCSQCKCQCAkgUQEgUBIAokIAoGQBBIRBAIhCSQiCARCEkhEEAiEJJCIIBAISSARQSAQkkAiEhMm6HU5PSQr7D5RDBKetiAj7EyWCRZC+z3evlhXC1xIDyH1ZBCzGyQi0TC9nnrL68VWZxcrkwnHpEN5aiyWMou5MDMzs9pLC0ennpDXVlpPLVTIhf1wQIV22EoLwBlkZuYWV9R7+li222Euc1PCB4aJLoT1/Zn7I0i5u184Gg6uwP72drmjW6QjcgXeX7+9xhv9L54ZmF6vo8Zi3lJQsKW8/tZTehl+RIRx/++HS/V6fc7+5uCQcGiKGHo48K27BpStf7P5vnBsqhnqadih33slVvE/fNv8fo5+x+EW8iG3//DbFvBNc3Jy9DmfdXFHholXCNW8F579qchPjzL0H8dycva3UMJuGPfBX5Z+1jXFF3SWMRRsv3TuUnvkbTNENIDbCXx3cF/Bi5fT0CO8M2t4eL/rmwGJPw3qiYxCtdl2V7gITF3yYaUxZep6IRwyOS57DBsifLlSwR+aYljyfJ2dLTGtExfPEo0HbJ2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aYUJCIIBEISyLGKQCAkgUQEgUBIAokIAoGQBBIRBAIhCSQiCARCEkhEEAiEJJCIIBAISSARQSAQkkAigkAgJIFEBIFASAKJCAKBkAQSEQQCIQkkIggEQhJIRBAIhCSQiCAQCEkgEUEgEJJAIoJAICSBRASBQEgCiQgCgZAAhv1/JCvWFCrqMz4AAAAASUVORK5CYII=) ,  -log (1 - S(h)) ,  ify—l

0.2  0.6  0.8  1.0

由此可得,当y=1时,样本概率越接近1损失函数越小;当y=0时,样本概率越接近0损失函数越小。

部分参考:https://blog.csdn.net/xlinsist/article/details/51289825