{"id":5874,"date":"2021-12-20T20:22:50","date_gmt":"2021-12-20T12:22:50","guid":{"rendered":"http:\/\/43.154.99.198\/?p=5874"},"modified":"2024-03-01T12:15:04","modified_gmt":"2024-03-01T04:15:04","slug":"multivariate-linear-model","status":"publish","type":"post","link":"https:\/\/www.wangonc.com\/index.php\/2021\/12\/20\/multivariate-linear-model\/","title":{"rendered":"\u591a\u5143\u7ebf\u6027\u6a21\u578b\uff08\u4e8c\uff09"},"content":{"rendered":"<div class=\"pps-series-post-details pps-series-post-details-variant-classic pps-series-post-details-8136\" data-series-id=\"38\"><div class=\"pps-series-meta-content\"><div class=\"pps-series-meta-text\">This entry is \u7b2c 2 \u90e8\u5206\uff0c\u5171 3 in the series <a href=\"https:\/\/www.wangonc.com\/index.php\/series\/machine-learning\/\">\u673a\u5668\u5b66\u4e60<\/a><\/div><\/div><\/div><h2>1\u3001\u591a\u5143\u7ebf\u6027\u6a21\u578b\u6982\u5ff5<\/h2>\n<p>\u5f53\u7ebf\u6027\u6a21\u578b\u4e2d\u6709\u8d85\u8fc7\u4e24\u4e2a\u7684\u5f85\u5b9a\u53c2\u6570\uff08\u5373\u8d85\u8fc7\u4e00\u4e2a\u7279\u5f81\uff09\u65f6\uff0c\u9700\u8981\u7528\u5230\u591a\u5143\u7ebf\u6027\u6a21\u578b<\/p>\n<p>\u5bf9\u4e8e\u591a\u5143\u7ebf\u6027\u6a21\u578b\uff0c\u5176\u53ef\u5217\u51fa\u5982\u4e0b\u51fd\u6570<\/p>\n<pre><code class=\"language-katex\">h_\\theta(x)=\\theta_0+\\theta_1 x_1+\\theta_2 x_2+...+\\theta_nx_n<\/code><\/pre>\n<p>\u5bf9\u4e8e\u53c2\u6570\u03b8\uff0c\u53ef\u5217\u51fa\u5982\u4e0b\u53c2\u6570\u5411\u91cf<\/p>\n<pre><code class=\"language-katex\">\\theta=\\left [\\begin{array}{c} \\theta_0\\\\\\theta_1\\\\ \\theta_2\\\\ ...\\\\ \\theta_n\\\\ \\end{array} \\right]<\/code><\/pre>\n<p>\u5047\u5982\u628a\u628a\u5e38\u91cf\u89c6\u4f5c\u4e00\u4e2a\u7279\u5f81\u6052\u4e3a1\u7684\u503c\uff0c\u5219\u53ef\u4ee5\u5217\u51fa\u5982\u4e0b\u7279\u5f81\u5411\u91cf<\/p>\n<pre><code class=\"language-katex\">x=\\left [\\begin{array}{c} x_0\\\\x_1\\\\ x_2\\\\ ...\\\\ x_n\\\\ \\end{array} \\right]<\/code><\/pre>\n<p>\u6240\u4ee5\u5c31\u53ef\u4ee5\u5f97\u5230\u591a\u5143\u7ebf\u6027\u6a21\u578b\u7684\u6700\u7ec8\u51fd\u6570\uff0c\u5982\u4e0b<\/p>\n<pre><code class=\"language-katex\">h(x)=\\theta^T x<\/code><\/pre>\n<h2>2\u3001\u591a\u5143\u68af\u5ea6\u4e0b\u964d<\/h2>\n<p>\u5bf9\u4e8e\u591a\u5143\u7ebf\u6027\u6a21\u578b\uff0c\u4e5f\u53ef\u4ee5\u7684\u5f97\u5230\u4e00\u4e2a\u7c7b\u4f3c\u7684\u4ee3\u4ef7\u51fd\u6570\u5982\u4e0b<\/p>\n<pre><code class=\"language-katex\">J\\left( {\\theta_{0}},{\\theta_{1}}...{\\theta_{n}} \\right)=\\frac{1}{2m}\\sum\\limits_{i=1}^{m}{{{\\left( h_{\\theta} \\left({x}^{\\left( i \\right)} \\right)-{y}^{\\left( i \\right)} \\right)}^{2}}}<\/code><\/pre>\n<p>\u6240\u4ee5\u5bf9\u4e8e\u591a\u5143\u7ebf\u6027\u6a21\u578b\uff0c\u5176\u68af\u5ea6\u4e0b\u964d\u7b97\u6cd5\u4e3a<\/p>\n<pre><code class=\"language-katex\">\\theta _j:=\\theta _j-\\alpha \\frac {\\partial}{\\partial \\theta_j} J(\\theta_0,\\theta_1...\\theta_n)<\/code><\/pre>\n<p>\u6574\u7406\u540e\u53ef\u4ee5\u5f97\u5230<\/p>\n<pre><code class=\"language-katex\">{{\\theta }_{j}}:={{\\theta }_{j}}-a\\frac{1}{m}\\sum\\limits_{i=1}^{m}{({{h}_{\\theta }}({{x}^{(i)}})-{{y}^{(i)}})}x_{j}^{(i)}<\/code><\/pre>\n<h3>2.1\u3001\u7279\u5f81\u7f29\u653e<\/h3>\n<p><strong>\u7279\u5f81\u7f29\u653e\u662f\u5c06\u4e0d\u540c\u7279\u5f81\u7684\u53d6\u503c\u8303\u56f4\u7f29\u653e\u5230\u76f8\u540c\u7684\u53d6\u503c\u8303\u56f4\u5185<\/strong><\/p>\n<p>\u4f8b\u5982\u6709\u4e00\u6570\u636e\u96c6\u6709\u4e24\u4e2a\u7279\u5f81\uff0c\u53d6\u503c\u5206\u522b\u4e3a0-2000\u548c1-5\uff0c\u5176\u4ee3\u4ef7\u51fd\u6570\u56fe\u50cf\u4f1a\u6bd4\u8f83\u6241\u4ece\u800c\u5f71\u54cd\u68af\u5ea6\u4e0b\u964d\u7684\u6548\u7387<\/p>\n<p>\u5b9e\u9645\u4e0a\u5176\u7f29\u653e\u65b9\u5f0f\u5c31\u662f<code class=\"katex-inline\">{{x}_{n}}=\\frac{{{x}_{n}}-{{\\mu}_{n}}}{{{s}_{n}}}<\/code>\u5176\u4e2d<code class=\"katex-inline\">{\\mu_{n}}<\/code>\u662f\u5e73\u5747\u503c<code class=\"katex-inline\">{s_n}<\/code>\u662f\u6807\u51c6\u5dee<\/p>\n<h3>2.2\u3001\u5b66\u4e60\u7387<\/h3>\n<p>\u53ef\u4ee5\u4f7f\u7528\u8fed\u4ee3\u6b21\u6570\/\u4ee3\u4ef7\u51fd\u6570\u66f2\u7ebf\u6765\u9884\u6d4b\u4f55\u65f6\u7b97\u6cd5\u8d8b\u5411\u4e8e\u6536\u655b<\/p>\n<p>\u53ef\u4ee5\u6bcf\u9694\u5341\u500d\u53d6\u4e00\u5b66\u4e60\u7387\u8fdb\u884c\u8bd5\u9a8c\uff0c\u4ece\u800c\u627e\u5230\u4e00\u4e2a\u6700\u4f18\u5b66\u4e60\u7387<\/p>\n<h2>3\u3001\u7279\u5f81\u548c\u591a\u9879\u5f0f\u56de\u5f52<\/h2>\n<p>\u5982\u623f\u4ef7\u9884\u6d4b\u95ee\u9898,<code class=\"katex-inline\">h_{\\theta}\\left( x \\right)={\\theta_{0}}+{\\theta_{1}}\\times{frontage}+{\\theta_{2}}\\times{depth},x_1=frontage<\/code>(\u4e34\u8857\u5bbd\u5ea6)\uff0c<code class=\"katex-inline\">x_2=depth<\/code>(\u7eb5\u5411\u6df1\u5ea6)\uff0c<code class=\"katex-inline\">x=frontage*depth=area<\/code>(\u9762\u79ef),\u5219<code class=\"katex-inline\">{h_{\\theta}}\\left( x \\right)={\\theta_{0}}+{\\theta_{1}}x<\/code><\/p>\n<p>\u5f53\u7ebf\u6027\u6a21\u578b\u4e0d\u9002\u7528\u4e8e\u6240\u6709\u6570\u636e\u65f6\uff0c\u9700\u8981\u4f7f\u7528\u66f2\u7ebf\u6765\u5f97\u5230\u66f4\u597d\u7684\u7ed3\u679c\uff0c\u901a\u5e38\u6211\u4eec\u9700\u8981\u5148\u89c2\u5bdf\u6570\u636e\u7136\u540e\u518d\u51b3\u5b9a\u51c6\u5907\u5c1d\u8bd5\u600e\u6837\u7684\u6a21\u578b\u3002\u4f8b\u5982\u4f7f\u7528\u4e8c\u6b21\u6a21\u578b\u53ef\u80fd\u4f1a\u5bfc\u81f4\u623f\u5c4b\u9762\u79ef\u589e\u52a0\u4f46\u623f\u4ef7\u4e0b\u964d\u7684\u60c5\u51b5\u51fa\u73b0\uff0c\u6240\u4ee5\u53ef\u4ee5\u4f7f\u7528\u4e09\u6b21\u6a21\u578b<code class=\"katex-inline\">h_{\\theta}\\left( x \\right)={\\theta_{0}}+{\\theta_{1}}{x_{1}}+{\\theta_{2}}{x_{2}^2}+{\\theta_{3}}{x_{3}^3}<\/code>\uff0c\u8fd9\u65f6\u53ef\u4ee5\u4ee4<code class=\"katex-inline\">{{x}_{1}}=x_{1}^{1},{{x}_{2}}=x_{2}^{2},{{x}_{3}}=x_{3}^{3}<\/code>\u6765\u4f7f\u5176\u8f6c\u5316\u4e3a\u4e00\u4e2a\u7ebf\u6027\u6a21\u578b<\/p>\n<blockquote>\n<p>\u4f7f\u7528\u591a\u9879\u5f0f\u56de\u5f52\u6a21\u578b\u65f6\u5e94\u8003\u8651\u8fdb\u884c\u7279\u5f81\u7f29\u653e<\/p>\n<\/blockquote>\n<h2>4\u3001\u6b63\u89c4\u65b9\u7a0b<\/h2>\n<p>\u6b63\u89c4\u65b9\u7a0b\u7528\u4e8e\u8ba1\u7b97\u53c2\u6570\u6700\u5c0f\u503c\u7684\u53e6\u4e00\u79cd\u65b9\u6cd5\uff0c\u5176\u516c\u5f0f\u4e3a<code class=\"katex-inline\">\\theta=(X^TX)^{-1}X^TY<\/code>\uff0c\u5176\u4e2dY\u4e3a\u9884\u6d4b\u503c\u7ec4\u6210\u7684\u77e9\u9635\uff0cX\u4e3a\u7279\u5f81\u5411\u91cf\u7ec4\u6210\u7684\u77e9\u9635\uff0c\u5176\u4e2dX\u4e2d\u9700\u8981\u5728\u7279\u5f81\u4e2d\u52a0\u4e00\u4e2a\u6052\u4e3a1\u7684\u7279\u5f81<\/p>\n<p>\u4f8b\u5982\u6709\u4e00\u6570\u636e\u96c6\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>size<\/th>\n<th>number of bedrooms<\/th>\n<th>number of floors<\/th>\n<th>age of home<\/th>\n<th>price<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>2104<\/td>\n<td>5<\/td>\n<td>1<\/td>\n<td>45<\/td>\n<td>460<\/td>\n<\/tr>\n<tr>\n<td>1416<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<td>40<\/td>\n<td>232<\/td>\n<\/tr>\n<tr>\n<td>1534<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<td>30<\/td>\n<td>315<\/td>\n<\/tr>\n<tr>\n<td>852<\/td>\n<td>2<\/td>\n<td>1<\/td>\n<td>36<\/td>\n<td>178<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5219\u6b64\u65f6X\u5e94\u4e3a<br \/>\n<code class=\"katex-inline\">\\left[\\begin{matrix}1& 2104& 5& 1& 45\\\\1& 1416& 3& 2& 40\\\\1& 1534& 3& 2& 30\\\\1& 852& 2& 1& 36\\\\ \\end{matrix} \\right]<\/code><br \/>\nY\u6b64\u65f6\u5e94\u4e3a<br \/>\n<code class=\"katex-inline\">\\left[\\begin{matrix} 460\\\\232\\\\315\\\\178\\\\ \\end{matrix} \\right]<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"pps-series-post-details pps-series-post-details-variant-classic pps-series-post-details-8136 pps-series-meta-excerpt\" data-series-id=\"38\"><div class=\"pps-series-meta-content\"><div class=\"pps-series-meta-text\">This entry is \u7b2c 2 \u90e8\u5206\uff0c\u5171 3 in the series <a href=\"https:\/\/www.wangonc.com\/index.php\/series\/machine-learning\/\">\u673a\u5668\u5b66\u4e60<\/a><\/div><\/div><\/div><p>1\u3001\u591a\u5143\u7ebf\u6027\u6a21\u578b\u6982\u5ff5 \u5f53\u7ebf\u6027\u6a21\u578b\u4e2d\u6709\u8d85\u8fc7\u4e24\u4e2a\u7684\u5f85\u5b9a\u53c2\u6570\uff08\u5373\u8d85\u8fc7\u4e00\u4e2a\u7279\u5f81\uff09\u65f6\uff0c\u9700\u8981\u7528\u5230\u591a\u5143\u7ebf\u6027\u6a21\u578b \u5bf9\u4e8e\u591a\u5143\u7ebf\u6027 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5885,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,2],"tags":[29],"series":[38],"class_list":["post-5874","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence","category-study-notes","tag-machine-learning","series-machine-learning"],"_links":{"self":[{"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/posts\/5874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/comments?post=5874"}],"version-history":[{"count":3,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/posts\/5874\/revisions"}],"predecessor-version":[{"id":7367,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/posts\/5874\/revisions\/7367"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/media\/5885"}],"wp:attachment":[{"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/media?parent=5874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/categories?post=5874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/tags?post=5874"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.wangonc.com\/index.php\/wp-json\/wp\/v2\/series?post=5874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}