{"id":3371,"date":"2022-02-27T15:29:14","date_gmt":"2022-02-27T07:29:14","guid":{"rendered":"https:\/\/egonlin.com\/?p=3371"},"modified":"2022-02-27T15:29:53","modified_gmt":"2022-02-27T07:29:53","slug":"%e7%ac%ac%e5%9b%9b%e7%af%87%ef%bc%9a%e6%a6%82%e7%8e%87%e8%ae%ba-%e7%86%b5%e5%92%8c%e4%bf%a1%e6%81%af%e5%a2%9e%e7%9b%8a","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=3371","title":{"rendered":"\u7b2c\u56db\u7bc7\uff1a\u6982\u7387\u8bba-\u71b5\u548c\u4fe1\u606f\u589e\u76ca"},"content":{"rendered":"<h1>\u71b5\u548c\u4fe1\u606f\u589e\u76ca<\/h1>\n<h1>\u71b5\uff08Entropy\uff09<\/h1>\n<p>&emsp;&emsp;\u71b5\u8868\u793a<code>\u968f\u673a\u53d8\u91cf\u4e0d\u786e\u5b9a\u6027\u7684\u5ea6\u91cf<\/code>\u3002\u5047\u8bbe\u79bb\u6563\u968f\u673a\u53d8\u91cf$X$\u53ef\u4ee5\u53d6\u5230$n$\u4e2a\u503c\uff0c\u5176\u6982\u7387\u5206\u5e03\u4e3a<br \/>\n$$<br \/>\nP(X=x_i)=p<em>i, \\quad i = 1,2,\\ldots,n<br \/>\n$$<br \/>\n\u5219$X$\u7684\u71b5\u5b9a\u4e49\u4e3a<br \/>\n$$<br \/>\nH(X) = -\\sum<\/em>{i=1}^n p_i log{p<em>i}<br \/>\n$$<br \/>\n\u7531\u4e8e\u71b5\u53ea\u4f9d\u8d56$X$\u7684\u5206\u5e03\uff0c\u4e0e$X$\u672c\u8eab\u7684\u503c\u6ca1\u6709\u5173\u7cfb\uff0c\u6240\u4ee5\u71b5\u4e5f\u53ef\u4ee5\u5b9a\u4e49\u4e3a<br \/>\n$$<br \/>\nH(p) = -\\sum<\/em>{i=1}^n p_i log{p_i}<br \/>\n$$<br \/>\n&emsp;&emsp;\u71b5\u8d8a\u5927\uff0c\u5219\u968f\u673a\u53d8\u91cf\u7684\u4e0d\u786e\u5b9a\u6027\u8d8a\u5927\uff0c\u5e76\u4e14$0\\geq{H(p)}\\leq\\log{n}$\u3002<\/p>\n<p>&emsp;&emsp;\u5f53\u968f\u673a\u53d8\u91cf\u53ea\u53d6\u4e24\u4e2a\u503c$0$\u548c$1$\u7684\u65f6\u5019\uff0c$X$\u7684\u5206\u5e03\u4e3a<br \/>\n$$<br \/>\nP(X=1)=p, \\quad P(x=0)=1-p, \\quad 0\\geq{p}\\leq{1}<br \/>\n$$<br \/>\n\u71b5\u5219\u662f<br \/>\n$$<br \/>\nH(p) = -p\\log_2 p-(1-p) \\log_2(1-p)<br \/>\n$$<br \/>\n\u6b64\u65f6\u968f\u673a\u53d8\u91cf\u4e3a\u4f2f\u52aa\u5229\u5206\u5e03\uff0c\u71b5\u968f\u6982\u7387\u53d8\u5316\u7684\u66f2\u7ebf\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n<pre><code class=\"language-python\">import numpy as np\nfrom math import log\nimport matplotlib.pyplot as plt\nfrom matplotlib.font_manager import FontProperties\n%matplotlib inline\nfont = FontProperties(fname=&#039;\/Library\/Fonts\/Heiti.ttc&#039;)\n\np = np.arange(0.01, 1, 0.01)\nentro = -p*np.log2(p) - (1-p)*np.log2(1-p)\n\nplt.plot(p, entro)\nplt.title(&#039;\u4f2f\u52aa\u5229\u5206\u5e03\u65f6\u71b5\u548c\u6982\u7387\u7684\u5173\u7cfb&#039;, fontproperties=font)\nplt.xlabel(&#039;p&#039;)\nplt.ylabel(&#039;H(p)&#039;)\nplt.show()<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/02\/\u6982\u7387\u8bba-\u71b5\u548c\u4fe1\u606f\u589e\u76ca_3_0.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/02\/\u6982\u7387\u8bba-\u71b5\u548c\u4fe1\u606f\u589e\u76ca_3_0.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>&emsp;&emsp;\u5f53$p=0$\u548c$p=1$\u65f6\u71b5\u503c\u4e3a$0$\uff0c\u6b64\u65f6\u968f\u673a\u53d8\u91cf\u5b8c\u5168\u6ca1\u6709\u4e0d\u786e\u5b9a\u6027\uff1b\u5f53$p=0.5$\u65f6\u7684\u71b5\u503c\u6700\u5927\uff0c\u968f\u673a\u53d8\u91cf\u7684\u4e0d\u786e\u5b9a\u6027\u6700\u5927\u3002<\/p>\n<h1>\u6761\u4ef6\u71b5\uff08Conditional Entropy\uff09<\/h1>\n<p>&emsp;&emsp;\u5047\u8bbe\u6709\u968f\u673a\u53d8\u91cf$(X,Y)$\uff0c\u5176\u8054\u5408\u6982\u7387\u4e3a<br \/>\n$$<br \/>\np(X=x_i,Y=y<em>i), \\quad i=1,2,\\ldots,n; \\quad j=1,2,\\ldots,m<br \/>\n$$<br \/>\n&emsp;&emsp;\u6761\u4ef6\u71b5$H(Y|X)$\u8868\u793a\u5728\u5df2\u77e5\u968f\u673a\u53d8\u91cf$X$\u7684\u6761\u4ef6\u4e0b\u968f\u673a\u53d8\u91cf$Y$\u7684\u4e0d\u786e\u5b9a\u6027\uff0c\u5b9a\u4e49\u4e3a<br \/>\n$$<br \/>\nH(Y|X) = \\sum<\/em>{i=1}^n P(X=x_i) H(Y|X=x_i)<br \/>\n$$<br \/>\n\u901a\u8fc7\u516c\u5f0f\u53ef\u4ee5\u628a\u6761\u4ef6\u71b5\u7406\u89e3\u4e3a<code>\u5728\u5f97\u77e5\u67d0\u4e00\u786e\u5b9a\u4fe1\u606f\u7684\u57fa\u7840\u4e0a\u83b7\u53d6\u53e6\u5916\u4e00\u4e2a\u4fe1\u606f\u65f6\u6240\u83b7\u5f97\u7684\u4fe1\u606f\u91cf<\/code>\u3002<\/p>\n<p>&emsp;&emsp;\u5f53\u71b5\u548c\u6761\u4ef6\u71b5\u4e2d\u7684\u6982\u7387\u7531\u6570\u636e\u4f30\u8ba1\u83b7\u5f97\u65f6\uff0c\u6240\u5bf9\u5e94\u7684\u71b5\u4e0e\u6761\u4ef6\u71b5\u5206\u522b\u79f0\u4e3a\u7ecf\u9a8c\u71b5\uff08empirical entropy\uff09\u548c\u7ecf\u9a8c\u6761\u4ef6\u71b5\uff08empirical conditional entropy\uff09\u3002<\/p>\n<h1>\u8054\u5408\u71b5\uff08Joint Entropy\uff09<\/h1>\n<p><\/p><div id=\"rml_readmorelogin_placeholder\" style=\"position:relative;\"><div id=\"rml_fade_content\" style=\"position: absolute;\r\ntop:-10em;\r\nwidth:100%;\r\nheight:10em;\r\nbackground: -webkit-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -o-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -ms-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\"><\/div><div class=\"wpf-controller aru_rml_from_in_post\" style=\"background-color:#eeeeee;border:5px solid #cce6ff;\" id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><h2 id=\"Header\">\u67e5\u770b\u66f4\u591a<\/h2><div id=\"Message\"><p>\u8054\u7cfb\u7ba1\u7406\u5458\u5fae\u4fe1tutu19192010\uff0c\u6ce8\u518c\u8d26\u53f7<\/p>\n<\/div><div id=\"StatusBarHeader\"><\/div><form id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><input name=\"post_id\" value=\"3371\" type=\"hidden\"\/><input name=\"_init_callback\" value=\"InitLogin\" type=\"hidden\"\/><input name=\"post_id\" value=\"3371\" type=\"hidden\"\/><input name=\"rt_ype\" value=\"1\" type=\"hidden\"\/><input name=\"nonce\" value=\"c2634a6041\" type=\"hidden\"\/><input name=\"_wpnonce\" value=\"f48666364f\" type=\"hidden\"\/><input name=\"_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_proxy_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_view\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginView\" type=\"hidden\"\/><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\" width=\"400px\"><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Username:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"username\" value=\"\" type=\"text\"\/><\/td><\/tr><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Password:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"password\" value=\"\" type=\"password\"\/><\/td><\/tr><\/tbody><\/table><p class=\"wpf-table-placeholder submit\"><button class=\"wp_plugin_framework_ajax_button\" type=\"button\" style=\"background-color:#4D90FE;;color:#ffffff;;border:1px solid #3079ed;\" name=\"_event\" value=\"ButtonLogin\">Log in<\/button><\/p><\/td><td class=\"wpf-table-placeholder-input\"><\/td><\/tr><\/tbody><\/table><\/form><div id=\"ButtonStartRegister\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=register\">Register<\/a><\/div><div id=\"Link1\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=lostpassword\">Forgotten username or password?<\/a><\/div><div id=\"StatusBarFooter\"><\/div><\/div><\/div><div id=aru_remaining_content><\/div>","protected":false},"excerpt":{"rendered":"<p>\u71b5\u548c\u4fe1\u606f\u589e\u76ca \u71b5\uff08Entropy\uff09 &emsp;&emsp;\u71b5\u8868\u793a\u968f\u673a\u53d8\u91cf\u4e0d\u786e\u5b9a\u6027\u7684\u5ea6\u91cf\u3002\u5047\u8bbe\u79bb\u6563\u968f\u673a\u53d8\u91cf$X [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":3360,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[276,303,305],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/3371"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3371"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/3371\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/3360"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}