黑马程序员技术交流社区

标题: 【上海校区】softmax 回归 [打印本页]

作者: 梦缠绕的时候    时间: 2018-8-28 09:21
标题: 【上海校区】softmax 回归

Softmax回归是解决多分类问题,<span class="MathJax" id="MathJax-Element-711-Frame" tabindex="0" data-mathml="y" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; font-size: 16px; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">yy有多个类别,如在mnist数字识别中,<span class="MathJax" id="MathJax-Element-712-Frame" tabindex="0" data-mathml="k" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; font-size: 16px; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">kk=10. 在实际问题中,给定输入<span class="MathJax" id="MathJax-Element-713-Frame" tabindex="0" data-mathml="x" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; font-size: 16px; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">xx,我们的假设函数针对每一个类别<span class="MathJax" id="MathJax-Element-714-Frame" tabindex="0" data-mathml="i" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; font-size: 16px; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">ii估算出概率值,<span class="MathJax" id="MathJax-Element-715-Frame" tabindex="0" data-mathml="P(y=i|x)" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; font-size: 16px; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">P(y=i|x)P(y=i|x).

首先,给定输入<span class="MathJax" id="MathJax-Element-716-Frame" tabindex="0" data-mathml="x" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; font-size: 16px; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">xx,它代表类别<span class="MathJax" id="MathJax-Element-717-Frame" tabindex="0" data-mathml="i" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; font-size: 16px; text-align: left; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; word-break: break-all; position: relative;">ii的证据为


evidence(i)=∑iwix+bievidence(i)=∑iwix+bi


其中wixwix代表权重,代表偏置,然后用softmax函数转为概率yy.

y=softmax(evidence)y=softmax(evidence)


其中


softmax(x)=normalize(exp(x))=exp(x)/∑iexp(xi)softmax(x)=normalize(exp(x))=exp(x)/∑iexp(xi)


这个幂运算表示,更大的证据对应更大的假设模型里面的乘数权重值,更进一步,整个计算过程可以写成:


y=softmax(wx+b)



作者: 不二晨    时间: 2018-8-30 17:10
奈斯,加油加油




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2