{"id":2100,"date":"2023-04-01T22:15:01","date_gmt":"2023-04-01T14:15:01","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=2100"},"modified":"2023-04-06T13:56:36","modified_gmt":"2023-04-06T05:56:36","slug":"fundamentals-of-deep-learning-linear-algebra-singular-value-decomposition-and-implementation-of-numpy-and-scipy","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/04\/01\/fundamentals-of-deep-learning-linear-algebra-singular-value-decomposition-and-implementation-of-numpy-and-scipy\/","title":{"rendered":"\u6df1\u5ea6\u5b66\u4e60\u57fa\u7840\uff1a\u7ebf\u6027\u4ee3\u6570(2)_\u5947\u5f02\u503c\u5206\u89e3\u53canumpy\u3001scipy\u5b9e\u73b0"},"content":{"rendered":"<h2>\u5947\u5f02\u503c\u5206\u89e3\u7684\u610f\u4e49<\/h2>\n<p>\u9664\u4e86\u7279\u5f81\u5206\u89e3\u5916\uff0c\u8fd8\u6709\u53e6\u4e00\u79cd\u5206\u89e3\u7684\u65b9\u6cd5\uff0c\u79f0\u4e3a<strong>\u5947\u5f02\u503c\u5206\u89e3(SVD)<\/strong>\uff0c\u5b83\u53ef\u4ee5\u5c06\u77e9\u9635\u5206\u89e3\u6210<strong>\u5947\u5f02\u503c<\/strong>\u548c<strong>\u5947\u5f02\u5411\u91cf<\/strong>\u3002\u76f8\u5bf9\u7279\u5f81\u5206\u89e3\u6765\u8bf4\uff0c\u5947\u5f02\u503c\u5206\u89e3\u7684\u5e94\u7528\u66f4\u52a0\u5e7f\u6cdb\uff0c\u6bcf\u4e2a\u5b9e\u6570\u77e9\u9635\u90fd\u6709\u4e00\u4e2a\u5947\u5f02\u503c\u5206\u89e3\uff0c\u4f46\u4e0d\u4e00\u5b9a\u6709\u7279\u5f81\u5206\u89e3\u3002\u4f8b\u5982\uff1a\u975e\u65b9\u9635\u7684\u77e9\u9635\u6ca1\u6709\u7279\u5f81\u5206\u89e3\uff0c\u4f46\u6709\u5947\u5f02\u503c\u5206\u89e3\u3002<\/p>\n<p><!-- more --><\/p>\n<h2>\u5947\u5f02\u503c\u5206\u89e3<\/h2>\n<p>\u5c06\u77e9\u9635\u5206\u89e3\u6210\u4e09\u4e2a\u77e9\u9635\u7684\u4e58\u79ef\uff1a<\/p>\n<p>$$A = UDV^T$$<\/p>\n<p>\u5176\u4e2d$A$\u662f\u4e00\u4e2a$m \\times n$\u7684\u77e9\u9635\uff0c$U$\u662f\u4e00\u4e2a$m \\times m$\u7684\u77e9\u9635\uff0c$D$\u662f\u4e00\u4e2a$m \\times n$\u7684\u77e9\u9635\uff0c\u800c$V$\u662f\u4e00\u4e2a$n \\times n$\u7684\u77e9\u9635\u3002\u800c\u4e14$U$\u548c$V$\u662f\u6b63\u4ea4\u77e9\u9635\uff0c$D$\u662f\u5bf9\u89d2\u77e9\u9635\u3002<\/p>\n<p>\u77e9\u9635$D$\u5bf9\u89d2\u7ebf\u4e0a\u7684\u5143\u7d20\u88ab\u79f0\u4e3a\u77e9\u9635$A$\u7684<strong>\u5947\u5f02\u503c<\/strong>\uff0c\u77e9\u9635$U$\u7684\u5217\u5411\u91cf\u79f0\u4e3a<strong>\u5de6\u5947\u5f02\u5411\u91cf<\/strong>\uff0c\u77e9\u9635$V$\u7684\u5217\u5411\u91cf\u79f0\u4e3a<strong>\u53f3\u5947\u5f02\u5411\u91cf<\/strong>\u3002<\/p>\n<h2>\u5947\u5f02\u503c\u548c\u5947\u5f02\u5411\u91cf\u7684\u542b\u4e49<\/h2>\n<p>\u77e9\u9635$A$\u7684\u5de6\u5947\u5f02\u5411\u91cf\u662f$AA^T$\u7684\u7279\u5f81\u5411\u91cf\uff0c\u77e9\u9635$A$\u7684\u53f3\u5947\u5f02\u5411\u91cf\u662f$A^TA$\u7684\u7279\u5f81\u5411\u91cf\uff0c$A$\u7684\u975e\u96f6\u5947\u5f02\u503c\u662f\u77e9\u9635$AA^T$\u6216$A^TA$\u7684\u7279\u5f81\u503c\u7684\u5e73\u65b9\u6839\u3002<\/p>\n<h2>Python\u5b9e\u73b0<\/h2>\n<h3>Numpy<\/h3>\n<pre><code class=\"language-python\">import numpy as np\n\nA = np.array([[1,2,3,4],\n            [5,6,7,8],\n            [9,10,11,12]])\n# \u8fd4\u56de\u4e09\u4e2a\u77e9\u9635\nnp.linalg.svd(A)<\/code><\/pre>\n<h3>Scipy<\/h3>\n<pre><code class=\"language-python\">import numpy as np\nimport scipy as sp\nfrom scipy import linalg\n\nA = np.array([[1,2,3,4],\n            [5,6,7,8],\n            [9,10,11,12]])\n# \u8fd4\u56de\u5947\u5f02\u503c\nprint(linalg.svdvals(A))\n# \u8fd4\u56de\u4e09\u4e2a\u77e9\u9635\nprint(linalg.svd(A))<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5947\u5f02\u503c\u5206\u89e3\u7684\u610f\u4e49 \u9664\u4e86\u7279\u5f81\u5206\u89e3\u5916\uff0c\u8fd8\u6709\u53e6\u4e00\u79cd\u5206\u89e3\u7684\u65b9\u6cd5\uff0c\u79f0\u4e3a\u5947\u5f02\u503c\u5206\u89e3(SVD)\uff0c\u5b83\u53ef\u4ee5\u5c06\u77e9\u9635\u5206\u89e3\u6210\u5947\u5f02\u503c\u548c\u5947 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[527],"tags":[531],"class_list":["post-2100","post","type-post","status-publish","format-standard","hentry","category-ai","tag-531"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2100"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2100\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}