{"id":634,"date":"2023-08-12T01:09:56","date_gmt":"2023-08-11T17:09:56","guid":{"rendered":"https:\/\/blog.cirno.fun\/?p=634"},"modified":"2025-03-19T00:30:10","modified_gmt":"2025-03-18T16:30:10","slug":"chap13-%e9%99%8d%e7%bb%b4","status":"publish","type":"post","link":"https:\/\/blog.sssn.tech\/?p=634","title":{"rendered":"[Chap13]-\u964d\u7ef4"},"content":{"rendered":"<p>\u8fd9\u8282\u8c08\u4e00\u4e0b<strong>\u964d\u7ef4<\/strong>\u95ee\u9898<strong>\uff08Dimensionality Reduction\uff09<\/strong><\/p>\n<h2>\u52a8\u673a1: \u6570\u636e\u538b\u7f29<\/h2>\n<p>\u901a\u5e38\u6765\u8bf4, \u6211\u4eec\u6536\u96c6\u5230\u7684\u6570\u636e\u96c6\u6709\u5f88\u591a\u7279\u5f81, \u8fd9\u91cc\u6311\u9009\u5176\u4e2d\u4e24\u4e2a\u753b\u5728\u8fd9\u91cc<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691772908840.png\" alt=\"file\" \/><\/p>\n<p>\u4e24\u4e2a\u7279\u5f81\u5206\u522b\u662f\u957f\u5ea6(cm)\u548c\u957f\u5ea6(inch), \u5f53\u7136\u56e0\u4e3a\u6d4b\u91cf\u8bef\u5dee, \u56db\u820d\u4e94\u5165\u7b49\u539f\u56e0, \u70b9\u4e0d\u4e00\u5b9a\u5728\u7cbe\u786e\u7684\u4e00\u6761\u76f4\u7ebf\u4e0a<\/p>\n<p>\u4e8b\u5b9e\u4e0a\u6211\u4eec\u77e5\u9053\u8fd9\u4e24\u4e2a\u7279\u5f81\u76f8\u5173\u5ea6\u975e\u5e38\u5927, \u4ee5\u81f3\u4e8e\u53ef\u4ee5\u820d\u5f03\u5176\u4e2d\u4e00\u4e2a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691773038923.png\" alt=\"file\" \/><\/p>\n<p>\u4ee5\u4e0a\u662f\u4e8c\u7ef4\u5230\u4e00\u7ef4\u7684\u964d\u7ef4, \u4e5f\u53ef\u4ee5\u4ece\u4e09\u7ef4\u5230\u4e8c\u7ef4<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691773097053.png\" alt=\"file\" \/><\/p>\n<p>\u538b\u7f29\u6570\u636e\u53ef\u4ee5\u8282\u7701\u5185\u5b58\u7a7a\u95f4, \u52a0\u5feb\u6a21\u578b\u8fd0\u7b97\u6548\u7387\u7b49<\/p>\n<h2>\u52a8\u673a2: \u6570\u636e\u53ef\u89c6<\/h2>\n<p>\u5728\u5f88\u591a\u95ee\u9898\u4e2d, \u5982\u679c\u6211\u4eec\u53ef\u4ee5\u5c06\u6570\u636e\u53ef\u89c6\u5316, \u5c31\u65b9\u4fbf\u627e\u5230\u4e00\u4e2a\u8f83\u597d\u7684\u89e3\u51b3\u65b9\u6848<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691773294031.png\" alt=\"file\" \/><\/p>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u8bb8\u591a\u4e0d\u540c\u56fd\u5bb6\u6570\u636e, \u6bcf\u4e00\u4e2a\u7279\u5f81\u5411\u91cf\u90fd\u662f50\u7ef4\u7684, \u5982\u603bGDP, \u4eba\u5747GDP, \u5e73\u5747\u5bff\u547d\u7b49. \u8981\u5c06\u5176\u5168\u90e8\u53ef\u89c6\u5316\u662f\u4e0d\u53ef\u80fd\u7684, \u5982\u679c\u53ef\u4ee5\u964d\u81f3\u4e8c\u7ef4, \u4fbf\u53ef\u4ee5\u770b\u5230<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691773375137.png\" alt=\"file\" \/><\/p>\n<p>\u7136\u800c\u95ee\u9898\u5728\u4e8e, \u964d\u7ef4\u53ea\u8d1f\u8d23\u51cf\u5c11\u7ef4\u6570, \u65b0\u4ea7\u751f\u7279\u5f81\u7684\u610f\u4e49\u5fc5\u987b\u7531\u6211\u4eec\u81ea\u5df1\u53d1\u73b0<\/p>\n<h2>\u4e3b\u6210\u5206\u5206\u6790\u7b97\u6cd5(PCA)<\/h2>\n<p>PCA\u662f\u6700\u5e38\u89c1\u7684\u964d\u7ef4\u7b97\u6cd5\u4e4b\u4e00<\/p>\n<p>\u5728PCA\u4e2d, \u6211\u4eec\u5e0c\u671b\u627e\u5230\u4e00\u4e2a\u65b9\u5411\u5411\u91cf, \u4f7f\u5f97\u5f53\u6211\u4eec\u628a\u6240\u6709\u6570\u636e\u6295\u5f71\u5230\u5176\u4e0a\u65f6, \u6295\u5f71\u5e73\u5747\u5747\u65b9\u5dee\u6700\u5c0f<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691773559592.png\" alt=\"file\" \/><\/p>\n<p>\u4e0a\u56fe\u753b\u51fa\u4e86\u6295\u5f71\u8bef\u5dee\u7684\u5b9a\u4e49, \u5b9e\u9645\u4e0a\u5c31\u662f\u5230\u8fd9\u4e2a\u76f4\u7ebf\u7684\u8ddd\u79bb<\/p>\n<p>\u8fd9\u91cc\u5f88\u591a\u4eba\u4f1a\u89c9\u5f97\u548c\u7ebf\u6027\u56de\u5f52\u5f88\u50cf, \u5b9e\u5219\u4e0d\u7136<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691773627724.png\" alt=\"file\" \/><\/p>\n<p>\u7ebf\u6027\u56de\u5f52\u6700\u5c0f\u5316\u7684\u662f\u62df\u5408\u8bef\u5dee(\u5de6\u56fe), PCA\u6700\u5c0f\u5316\u7684\u662f<strong>\u6295\u5f71\u8bef\u5dee(Projected error)<\/strong>(\u53f3\u56fe)<\/p>\n<p>PCA\u7684\u4f18\u70b9\u5728\u4e8e\u65e0\u53c2\u6570\u9650\u5236, \u5373, \u5728\u8ba1\u7b97\u8fc7\u7a0b\u4e2d\u4e0d\u9700\u8981\u4eba\u4e3a\u7684\u8bbe\u5b9a\u53c2\u6570\u6216\u8005\u5e72\u9884, \u6700\u540e\u7684\u7ed3\u679c\u53ea\u548c\u6570\u636e\u6709\u5173<\/p>\n<p>\u8fd9\u70b9\u4e5f\u53ef\u4ee5\u770b\u4f5c\u7f3a\u70b9, \u5982\u679c\u4f7f\u7528\u8005\u5bf9PCA\u5bf9\u8c61\u6709\u4e00\u5b9a\u7684\u5148\u9a8c\u77e5\u8bc6, \u4f46\u5374\u65e0\u6cd5\u5e72\u9884\u7b97\u6cd5\u8fdb\u7a0b, \u53ef\u80fd\u4f1a\u5f97\u4e0d\u5230\u9884\u671f\u7684\u6548\u679c<\/p>\n<h2>PCA\u7684\u8fc7\u7a0b<\/h2>\n<p>\u7b2c\u4e00\u6b65: \u5747\u503c\u5f52\u4e00\u5316, \u8ba1\u7b97\u51fa\u6240\u6709\u7279\u5f81\u7684\u5747\u503c, \u7136\u540e\u5411\u7279\u5f81\u505a\u5dee, \u5982\u679c\u7279\u5f81\u5728\u4e0d\u540c\u91cf\u7ea7\u4e0a, \u8fd8\u9700\u8981\u9664\u4ee5\u6807\u51c6\u5dee\u7684\u5e73\u65b9<\/p>\n<p>\u7b2c\u4e8c\u6b65: \u8ba1\u7b97<strong>\u534f\u65b9\u5dee\u77e9\u9635(Covariance matrix)<\/strong><\/p>\n<p>\u534f\u65b9\u5dee\u77e9\u9635\u5199\u4f5c\u5927\u5199\u7684sigma, \u770b\u8d77\u6765\u548c\u6c42\u548c\u7b26\u5408\u5b8c\u5168\u4e00\u81f4, \u8ba1\u7b97\u65b9\u6cd5\u5982\u4e0b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691774260079.png\" alt=\"file\" \/><\/p>\n<p>\u4e0b\u9762\u7528\u7ea2\u7b14\u5199\u51fa\u4e86\u77e9\u9635\u5f62\u72b6, \u6240\u4ee5\u534f\u65b9\u5dee\u77e9\u9635\u662fn\u00d7n\u7684<\/p>\n<p>\u7b2c\u4e09\u6b65: \u6c42\u89e3\u534f\u65b9\u5dee\u77e9\u9635\u7684<strong>\u7279\u5f81\u5411\u91cf(eigenvectors)<\/strong><\/p>\n<p>\u5728octave\u91cc\u53ef\u4ee5\u7528<strong>\u5947\u5f02\u503c\u5206\u89e3(singular value decomposition, SVD)<\/strong>\u6765\u6c42\u89e3<\/p>\n<pre><code>[U, S, D] = svd(sigma)<\/code><\/pre>\n<p>\u5bf9\u4e8e\u4e00\u4e2asize\u4e3a[n, n]\u7684\u77e9\u9635, \u4e0a\u9762\u7684U\u662f\u4e00\u4e2a\u5177\u6709\u4e0e\u6570\u636e\u4e4b\u95f4\u6700\u5c0f\u6295\u5c04\u8bef\u5dee\u7684\u65b9\u5411\u5411\u91cf\u6784\u6210\u7684\u77e9\u9635, \u5f53\u6211\u4eec\u5e0c\u671b\u5c06\u6570\u636e\u538b\u7f29\u81f3k\u7ef4\u65f6, \u5c31\u53d6U\u4e2d\u7684\u524dk\u4e2a\u5411\u91cf, \u83b7\u5f97\u4e00\u4e2asize\u4e3a[n, k]\u7684\u77e9\u9635, \u8bb0\u4e3aU_reduce<\/p>\n<p>\u65b0\u7684\u7279\u5f81\u5411\u91cf\u4e3a<\/p>\n<pre><code class=\"language-katex\">z^{(i)}=U^T_{reduce} *x^{(i)}\n<\/code><\/pre>\n<p>x\u7684size\u662f[n, 1], \u6240\u4ee5\u7ed3\u679csize\u662f[k, 1]<\/p>\n<h2>\u9009\u62e9k\u7684\u503c<\/h2>\n<p>PCA\u7684\u4e3b\u8981\u4f18\u5316\u5bf9\u8c61\u662f\u5747\u65b9\u5dee<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691832296788.png\" alt=\"file\" \/><\/p>\n<p>\u6211\u4eec\u5e0c\u671b\u5747\u65b9\u5dee\u4e0e\u8bad\u7ec3\u96c6\u65b9\u5dee\u7684\u6bd4\u4f8b\u5c3d\u53ef\u80fd\u5c0f\u7684\u524d\u63d0\u4e0b, \u8ba9k\u5c3d\u53ef\u80fd\u5c0f<\/p>\n<p>\u5982\u679c\u8fd9\u4e2a\u6bd4\u4f8b\u5c0f\u4e8e1%, \u5219\u610f\u5473\u7740\u539f\u6709\u6570\u636e\u88ab\u4fdd\u7559\u4e8699%<\/p>\n<p>\u4e00\u79cd\u65b9\u6cd5\u662f\u5206\u522b\u4ee4k=1, 2, 3, &#8230;\u4ee5\u6b64\u7c7b\u63a8, \u76f4\u5230\u6211\u4eec\u627e\u5230\u4e00\u4e2a\u6ee1\u8db3\u4fdd\u7559\u7387\u7684k\u503c<\/p>\n<p>\u4f46\u662f\u66f4\u597d\u7684\u65b9\u6cd5\u662f\u5206\u6790\u8c03\u7528svd\u51fd\u6570\u5f97\u5230\u76843\u4e2a\u53c2\u6570U, S, V<\/p>\n<p>S\u662f\u4e00\u4e2a[n, n]\u5bf9\u89d2\u77e9\u9635, \u53ef\u4ee5\u7528\u5b83\u8ba1\u7b97\u5747\u65b9\u5dee\u548c\u8bad\u7ec3\u96c6\u7684\u6bd4\u4f8b:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691833074855.png\" alt=\"file\" \/><\/p>\n<h2>\u6570\u636e\u89e3\u538b<\/h2>\n<p>PCA\u5c06\u9ad8\u7ef4\u6570\u636e\u538b\u7f29\u5230\u4f4e\u7ef4, \u5982\u679c\u8981\u5c06\u4f4e\u7ef4\u6570\u636e\u8fd8\u539f, \u603b\u662f\u6709\u635f\u5931\u7684<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691835208355.png\" alt=\"file\" \/><\/p>\n<p>\u5982\u56fe, \u89e3\u538b\u540e\u7684\u6570\u636e\u53ea\u80fd\u662f\u539f\u6570\u636e\u5728\u4f4e\u7ef4\u7684\u6295\u5f71<\/p>\n<p>\u538b\u7f29\u7684\u516c\u5f0f\u662f<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691835867276.png\" alt=\"file\" \/><\/p>\n<p>\u89e3\u538b\u516c\u5f0f\u5c31\u662f<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.sssn.tech\/wp-content\/uploads\/2023\/08\/image-1691835889715.png\" alt=\"file\" \/><\/p>\n<h2>PCA\u7684\u5e94\u7528\u5efa\u8bae<\/h2>\n<p>\u5728\u964d\u7ef4\u8fc7\u7a0b\u4e2d, \u4e0d\u53ef\u907f\u514d\u7684\u4f1a\u9020\u6210\u4fe1\u606f\u4e22\u5931, PCA\u5e76\u4e0d\u662f\u767e\u5229\u800c\u65e0\u4e00\u5bb3\u7684<\/p>\n<p>\u7b2c\u4e00\u6761: \u4e0d\u8981\u4e00\u5f00\u59cb\u5c31\u8003\u8651\u7528PCA, \u5148\u8bd5\u8bd5\u4e0d\u7528PCA\u5b9e\u73b0\u76ee\u7684, \u5982\u679c\u9047\u5230\u5185\u5b58\u74f6\u9888\u6216\u8005\u6548\u7387\u4e0d\u9ad8\u65f6\u518d\u8003\u8651<\/p>\n<p>\u7b2c\u4e8c\u6761: \u4e0d\u8981\u5c1d\u8bd5\u7528PCA\u89e3\u51b3\u8fc7\u62df\u5408\u95ee\u9898, \u5373\u4f7fPCA\u53ef\u4ee5\u5e26\u6765\u7ef4\u5ea6\u4e0b\u964d, \u5bf9\u9632\u6b62\u8fc7\u62df\u5408\u6709\u597d\u5904, \u751a\u81f3\u53ef\u80fd\u4f1a\u6548\u679c\u4e0d\u9519, \u4f46\u662f\u9632\u6b62\u8fc7\u62df\u5408\u4e0d\u662f\u4e00\u4e2a\u5e94\u7528PCA\u7684\u52a8\u673a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u8282\u8c08\u4e00\u4e0b\u964d\u7ef4\u95ee\u9898\uff08Dimensionality Reduction\uff09 \u52a8\u673a1: [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,18],"tags":[],"class_list":["post-634","post","type-post","status-publish","format-standard","hentry","category-11","category-18"],"_links":{"self":[{"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=\/wp\/v2\/posts\/634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=634"}],"version-history":[{"count":2,"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=\/wp\/v2\/posts\/634\/revisions"}],"predecessor-version":[{"id":826,"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=\/wp\/v2\/posts\/634\/revisions\/826"}],"wp:attachment":[{"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sssn.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}