{"id":1239,"date":"2023-04-16T15:31:24","date_gmt":"2023-04-16T07:31:24","guid":{"rendered":"http:\/\/www.wayln.com\/?p=1239"},"modified":"2023-04-16T16:00:42","modified_gmt":"2023-04-16T08:00:42","slug":"%e9%80%bb%e8%be%91%e5%9b%9e%e5%bd%92","status":"publish","type":"post","link":"https:\/\/www.wayln.com\/?p=1239","title":{"rendered":"\u903b\u8f91\u56de\u5f52"},"content":{"rendered":"<div id=\"toc_container\" class=\"toc_transparent no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#i\"><span class=\"toc_number toc_depth_1\">1<\/span> \u903b\u8f91\u56de\u5f52<\/a><ul><li><a href=\"#Softmax\"><span class=\"toc_number toc_depth_2\">1.1<\/span> Softmax<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_2\">1.2<\/span> \u4ea4\u53c9\u71b5<\/a><\/li><\/ul><\/li><\/ul><\/div>\n\n<h1><span id=\"i\">\u903b\u8f91\u56de\u5f52<\/span><\/h1>\n<p>\u673a\u5668\u5b66\u4e60\u4e2d\u7684\u9884\u6d4b\u4e00\u822c\u6709\u4e24\u79cd\u7c7b\u578b\uff1a\u6570\u503c\u9884\u6d4b\u548c\u5206\u7c7b\u9884\u6d4b\uff0c\u6570\u503c\u9884\u6d4b\u4e00\u822c\u662f\u9884\u6d4b\u8fde\u7eed\u6570\u503c\u7684\uff0c\u91c7\u7528\u56de\u5f52\u6a21\u578b\uff1b\u5206\u7c7b\u9884\u6d4b\u4e00\u822c\u662f\u9884\u6d4b\u79bb\u6563\u7684\u5206\u7c7b\u6807\u7b7e\u7684\uff0c\u65b9\u6cd5\u5f88\u591a\uff0c\u5982\u51b3\u7b56\u6811\u3001KNN\u3001\u652f\u6301\u5411\u91cf\u673a\u3001\u6734\u7d20\u8d1d\u53f6\u65af\u7b49\u3002\u4f46\u4e24\u79cd\u9884\u6d4b\u7684\u6574\u4f53\u6d41\u7a0b\u662f\u4e00\u6837\u7684\uff0c\u90fd\u662f\u5148\u642d\u5efa\u6a21\u578b\uff0c\u8bad\u7ec3\u5df2\u77e5\u6570\u636e\uff0c\u518d\u9884\u6d4b\u672a\u77e5\u6570\u636e<br \/>\n\u903b\u8f91\u56de\u5f52\uff08Logistic Regression\uff09\u662f\u4e00\u79cd\u6bd4\u8f83\u7279\u6b8a\u7684\u7b97\u6cd5\u3002\u903b\u8f91\u56de\u5f52\u6a21\u578b\u662f\u4e00\u79cd\u91c7\u7528\u56de\u5f52\u7684\u601d\u8def\u89e3\u51b3\u6807\u51c6\u5206\u7c7b\u95ee\u9898\u7684\u6a21\u578b\u3002<br \/>\n\u5bf9\u4e8e\u903b\u8f91\u56de\u5f52\u6a21\u578b\uff0c\u4e00\u822c\u4f1a\u5c06\u79bb\u6563\u7684\u6570\u636e\u8f6c\u6362\u4e3a\u8fde\u7eed\u7684\u6982\u7387\u5206\u5e03\u3002\u4e8c\u5206\u7c7b\u4e00\u822c\u91c7\u7528Sigmoid\uff08\u4e5f\u53ef\u4ee5\u91c7\u7528Softmax\uff09\u56de\u5f52\u65b9\u5f0f\uff0c\u591a\u5206\u7c7b\u4e00\u822c\u91c7\u7528Softmax\u56de\u5f52\u65b9\u5f0f\uff0c\u91c7\u7528Softmax\u56de\u5f52\u65b9\u5f0f\u5c06\u6570\u636e\u5904\u7406\u4e3a\u6982\u7387\u5206\u5e03\u6570\u636e\uff0c\u7136\u540e\u91c7\u7528\u4ea4\u53c9\u71b5\u4f5c\u4e3a\u635f\u5931\u51fd\u6570\uff0c\u6700\u540e\u4f7f\u7528\u68af\u5ea6\u4e0b\u964d\u7684\u65b9\u5f0f\u8fdb\u884c\u6a21\u578b\u53c2\u6570\u7684\u4f18\u5316\uff0c\u6700\u7ec8\u4f18\u5316\u7684\u7ed3\u679c\u901a\u8fc7Argmax\u51fd\u6570\u8fdb\u884c\u8f93\u51fa\u7cbe\u5ea6\u7684\u8bc4\u4ef7\u3002<\/p>\n<h2><span id=\"Softmax\">Softmax<\/span><\/h2>\n<p>softmax\u51fd\u6570\u7684\u4f5c\u7528\u662f\u5c06\u4e00\u7ec4\u6570\u636e\u8f6c\u6362\u4e3a\u6982\u7387\u7684\u5f62\u5f0f\uff0c\u51fd\u6570\u8868\u8fbe\u5f0f\u5982\u4e0b\uff1a<\/p>\n<div class=\"katex math multi-line no-emojify\">Softmax(x_j)=\\frac{exp(x_j)}{\\sum_jexp(x_j)}\n<\/div>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/www.wayln.com\/wp-content\/uploads\/2023\/04\/wp_editor_md_896a03a3c533cd2b542d255b697888b5.jpg\"><img decoding=\"async\" src=\"http:\/\/www.wayln.com\/wp-content\/uploads\/2023\/04\/wp_editor_md_896a03a3c533cd2b542d255b697888b5.jpg\" alt=\"\" \/><\/a><\/p>\n<p>\u6784\u5efaSoftmax\u51fd\u6570\u9700\u8981\u6ee1\u8db3\u4e0b\u8ff0\u6761\u4ef6<br \/>\n&#8211; Soft\u7279\u6027\uff0c\u6240\u6709\u6807\u7b7e\u90fd\u6709\u6982\u7387\u503c\uff0c\u5373\u6240\u6709\u5206\u7c7b\u90fd\u5b58\u5728\u88ab\u8003\u8651\u7684\u201c\u53ef\u80fd\u6027\u201d<br \/>\n&#8211; \u51fd\u6570\u5fc5\u987b\u662f\u8fde\u7eed\u53ef\u5bfc\u7684\uff0c\u4e0d\u5b58\u5728\u62d0\u70b9<br \/>\n&#8211; Max\u7279\u6027\uff0c\u901a\u8fc7\u6307\u6570\u7684\u4f7f\u7528\uff0c\u62c9\u5927\u4e0d\u540c\u7c7b\u578b\u7684\u5dee\u5f02\uff0c\u4f7f\u5927\u7684\u66f4\u5927\uff0c\u5c0f\u7684\u66f4\u5c0f<br \/>\n&#8211; \u6240\u6709\u8f93\u51fa\u7684\u6982\u7387\u7efc\u5408\u59cb\u7ec8\u786e\u4fdd\u4e3a1<br \/>\n&#8211; \u5c3d\u53ef\u80fd\u5730\u65b9\u4fbf\u540e\u7eed\u7684\u4ea4\u53c9\u71b5\u635f\u5931\u51fd\u6570\u7684\u6c42\u5bfc\u8ba1\u7b97\uff08Softmax\u51fd\u6570\u5927\u5927\u7b80\u5316\u4e86\u5bfc\u6570\u7684\u8ba1\u7b97\u548c\u68af\u5ea6\u66f4\u65b0\u8fc7\u7a0b\uff09\u3002<\/p>\n<h2><span id=\"i-2\">\u4ea4\u53c9\u71b5<\/span><\/h2>\n<p>\u4ea4\u53c9\u71b5\uff08Cross Entropy\uff09\u662f\u4fe1\u606f\u8bba\u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u6982\u5ff5\uff0c\u4e3b\u8981\u7528\u6765\u5ea6\u91cf\u4e24\u4e2a\u6982\u7387\u5206\u5e03\u95f4\u7684\u5dee\u5f02\u3002\u53ef\u4ee5\u4f7f\u7528\u4ea4\u53c9\u71b5\u6765\u201c\u91cf\u5316\u201d\u771f\u5b9e\u6570\u636e\u5206\u5e03\u6982\u7387\u548c\u9884\u6d4b\u6570\u636e\u5206\u5e03\u6982\u7387\u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u8fdb\u800c\u53ef\u4ee5\u786e\u5b9a\u540e\u7eed\u7684\u68af\u5ea6\u66f4\u65b0\u7684\u6570\u503c\u548c\u65b9\u5411\u3002<\/p>\n<p>\u4fe1\u606f\u91cf<span class=\"katex math inline\">I(x)=-ln(P(x)),P(x)<\/span>\u4e3a\u4e8b\u4ef6\u53d1\u751f\u7684\u6982\u7387<\/p>\n<p>\u4fe1\u606f\u71b5\u4e3b\u8981\u7528\u6765\u8868\u793a\u6240\u6709\u4fe1\u606f\u91cf\u7684\u671f\u671b\uff0c\u671f\u671b\u662f\u5b9e\u9a8c\u4e2d\u6bcf\u6b21\u53ef\u80fd\u7ed3\u679c\u7684\u6982\u7387\u4e58\u4ee5\u5176\u7ed3\u679c\u7684\u603b\u548c<\/p>\n<div class=\"katex math multi-line no-emojify\">H(X)=-\\sum_{i=1}^nP(x_i)ln(p(x_i))),X=x_1,x_2,x_3,&#8230;,x_n\n<\/div>\n<p>\u6df1\u5ea6\u5b66\u4e60\u4e3b\u8981\u5173\u6ce8\u5206\u5e03\u6982\u7387\u4e4b\u95f4\uff08\u9884\u6d4b\u5206\u5e03\u6982\u7387\u548c\u5b9e\u9645\u5206\u5e03\u6982\u7387\uff09\u7684\u5dee\u5f02\uff0c\u8fd9\u91cc\u6709\u4e2a\u6982\u5ff5\u4e3a\u76f8\u5bf9\u71b5\uff08KL\u6563\u5ea6\uff09\uff0c\u76f8\u5bf9\u71b5\u4e3b\u8981\u7528\u6765\u8861\u91cf\u4e24\u4e2a\u5206\u5e03\u6982\u7387\u4e4b\u95f4\u7684\u5dee\u5f02<\/p>\n<div class=\"katex math multi-line no-emojify\">D_{KL}(p||q)=\\sum_{i=1}^np(x_i)ln\\left({\\frac{p(x_i)}{q(x_i)}}\\right)\n<\/div>\n<p>\u5c06\u76f8\u5bf9\u71b5\u516c\u5f0f\u62c6\u5f00\u4e3a\uff1a<\/p>\n<div class=\"katex math multi-line no-emojify\">D_{KL}(p||q)=\\sum_{i=1}^np(x_i)ln\\left({\\frac{p(x_i)}{q(x_i)}}\\right)\\\\\\<br \/>\n=\\sum_{i=1}^np(x_i)ln\\left(p(x_i)\\right)-\\sum_{i=1}^np(x_i)ln\\left(q(x_i)\\right)\\\\\\<br \/>\n=-H\\left(p(x)\\right)+\\left[-\\sum_{i=1}^np(x_i)ln\\left(q(x_i)\\right)\\right]\n<\/div>\n<p>\u800c\u4ea4\u53c9\u71b5\u516c\u5f0f\u4e3a<\/p>\n<div class=\"katex math multi-line no-emojify\">H(p,q)=-\\sum_{i=1}^np(x_i)ln\\left(q(x_i)\\right)\n<\/div>\n<p><span class=\"katex math inline\">H(p(x))<\/span>\u8868\u793a\u4fe1\u606f\u71b5\uff0c\u4ece\u4e0a\u6570\u516c\u5f0f\u53ef\u4ee5\u770b\u51fa\uff0c\u76f8\u5bf9\u71b5=\u4ea4\u53c9\u71b5-\u4fe1\u606f\u71b5<\/p>\n<p>\u5f53\u91c7\u7528\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u8bad\u7ec3\u7f51\u7edc\u65f6\uff0c\u8f93\u5165\u6570\u636e\u4e0e\u6807\u7b7e\u4e00\u822c\u5df2\u7ecf\u786e\u5b9a\uff0c\u90a3\u4e48\u771f\u5b9e\u5206\u5e03\u6982\u7387<span class=\"katex math inline\">p(x)<\/span>\u4e5f\u786e\u5b9a\u4e86\uff0c\u6240\u4ee5\u4fe1\u606f\u71b5\u5728\u8fd9\u91cc\u5c31\u662f\u4e00\u4e2a\u5e38\u91cf\u3002\u7531\u4e8e\u76f8\u5bf9\u71b5\u8868\u793a\u771f\u5b9e\u5206\u5e03\u6982\u7387<span class=\"katex math inline\">p(x)<\/span>\u4e0e\u9884\u6d4b\u5206\u5e03\u6982\u7387<span class=\"katex math inline\">q(x)<\/span>\u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u503c\u8d8a\u5c0f\u8868\u793a\u9884\u6d4b\u7684\u7ed3\u679c\u8d8a\u597d\uff0c\u6240\u4ee5\u9700\u8981\u6700\u5c0f\u5316\u76f8\u5bf9\u71b5\u3002\u800c\u4ea4\u53c9\u71b5\u7b49\u4e8e\u76f8\u5bf9\u71b5\u52a0\u4e0a\u4e00\u4e2a\u5e38\u91cf\uff08\u4fe1\u606f\u71b5\uff09\uff0c\u4e14\u516c\u5f0f\u76f8\u6bd4\u76f8\u5bf9\u71b5\u66f4\u52a0\u5bb9\u6613\u8ba1\u7b97\uff0c\u6240\u4ee5\u5728\u673a\u5668\u5b66\u4e60\u56db\u4e2d\u5e38\u5e38\u98df\u7528\u4ea4\u53c9\u71b5\u6765\u8ba1\u7b97\u635f\u5931<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Contents1 \u903b\u8f91\u56de\u5f521.1 Softmax1.2 \u4ea4\u53c9\u71b5 \u903b\u8f91\u56de\u5f52 \u673a\u5668\u5b66\u4e60\u4e2d\u7684\u9884\u6d4b\u4e00\u822c\u6709\u4e24\u79cd\u7c7b\u578b\uff1a\u6570 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50,49,2],"tags":[],"class_list":["post-1239","post","type-post","status-publish","format-standard","hentry","category-tensorflow","category-49","category-2"],"_links":{"self":[{"href":"https:\/\/www.wayln.com\/index.php?rest_route=\/wp\/v2\/posts\/1239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wayln.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wayln.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wayln.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wayln.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1239"}],"version-history":[{"count":7,"href":"https:\/\/www.wayln.com\/index.php?rest_route=\/wp\/v2\/posts\/1239\/revisions"}],"predecessor-version":[{"id":1246,"href":"https:\/\/www.wayln.com\/index.php?rest_route=\/wp\/v2\/posts\/1239\/revisions\/1246"}],"wp:attachment":[{"href":"https:\/\/www.wayln.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wayln.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wayln.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}