{"id":78,"date":"2019-12-18T16:11:54","date_gmt":"2019-12-18T08:11:54","guid":{"rendered":"https:\/\/kishere.gq\/?p=78"},"modified":"2023-04-25T15:48:21","modified_gmt":"2023-04-25T07:48:21","slug":"78-2","status":"publish","type":"post","link":"https:\/\/blog.kishere.cn\/?p=78","title":{"rendered":"\u673a\u5668\u5b66\u4e601"},"content":{"rendered":"<h2>\u5b9a\u4e49:<\/h2>\n<blockquote><p>\n  Tom\u00a0Mitchell :\u00a0well-posed learning Problem :\u00a0A\u00a0computer\u00a0program\u00a0is\u00a0said to learn from experience E whit respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E.\n<\/p><\/blockquote>\n<h2>\u76d1\u7763\u5b66\u4e60(supervised\u00a0learning):<\/h2>\n<p>&#8220;right\u00a0answer&#8221;given : \u7ed9\u51fa\u6b63\u786e\u7b54\u6848,\u00a0\u7b97\u6cd5\u7684\u76ee\u7684\u662f\u7ed9\u51fa\u66f4\u591a\u7684\u6b63\u786e\u7b54\u6848<\/p>\n<p>\u56de\u5f52\u95ee\u9898(regression\u00a0problem)\u5373:\u8bbe\u6cd5\u9884\u6d4b\u8fde\u7eed\u503c\u7684\u5c5e\u6027<br \/>\n\u5206\u7c7b\u95ee\u9898(classification\u00a0problem)\u5373:\u8bbe\u6cd5\u9884\u6d4b\u4e00\u4e2a\u79bb\u6563\u503c\u7684\u8f93\u51fa(\u59820\u548c1)<\/p>\n<h2>\u65e0\u76d1\u7763\u5b66\u4e60(unsupervised learning):<\/h2>\n<p>&#8220;give the algorithm a tons of data and ask it to find structure in the data&#8221;\u7ed9\u7b97\u6cd5\u6d77\u91cf\u6570\u636e,\u00a0\u627e\u51fa\u4e0d\u540c\u6570\u636e\u7684\u7c7b\u578b\u7ed3\u6784\u00a0<br \/>\n\u805a\u7c7b\u7b97\u6cd5(clustering algorithms):eg.\u65b0\u95fb\u5206\u7c7b,\u00a0\u627e\u51fa\u4e0d\u540c\u6570\u636e\u4e4b\u95f4\u7684\u8054\u7cfb<br \/>\n\u9e21\u5c3e\u9152\u4f1a\u7b97\u6cd5(Cocktail party problem algorithm)eg.\u97f3\u9891\u5206\u79bb,\u00a0\u627e\u51fa\u4e00\u4e2a\u6570\u636e\u4e2d\u4e0d\u540c\u7684\u90e8\u5206<\/p>\n<p>\u8f6f\u4ef6:Octave<\/p>\n<h2>\u7b26\u53f7(Notation):<\/h2>\n<p><span class=\"katex math multi-line\">m<\/span><br \/>\nNumber of training examples(\u8bad\u7ec3\u6837\u672c\u6570\u91cf)<\/p>\n<div class=\"katex math multi-line no-emojify\">x\n<\/div>\n<p>&#8220;input&#8221; variable \/features(\u8f93\u5165\u91cf\/\u7279\u5f81)<\/p>\n<div class=\"katex math multi-line no-emojify\">y\n<\/div>\n<p>&#8220;output&#8221; variable \/&#8221;target&#8221; variable(\u8f93\u51fa\u91cf\/\u9884\u6d4b\u76ee\u6807\u53d8\u91cf)<\/p>\n<div class=\"katex math multi-line no-emojify\">(x ,y)\n<\/div>\n<p>one\u00a0training example (\u4e00\u4e2a\u8bad\u7ec3\u6837\u672c)<\/p>\n<div class=\"katex math multi-line no-emojify\">(x ^{i} , y^{i})\n<\/div>\n<p>the i ^ th training example(\u7b2ci\u4e2a\u8bad\u7ec3\u6837\u672c)<\/p>\n<div class=\"katex math multi-line no-emojify\">h\n<\/div>\n<p>= hypopthesis(\u5047\u8bbe\u51fd\u6570)x,y\u51fd\u6570<\/p>\n<p>\u7ebf\u6027\u56de\u5f52(linear regression) \/\u00a0\u5355\u53d8\u91cf\u7ebf\u6027\u56de\u5f52 (univariatre\u00a0linear\u00a0regression):<\/p>\n<div class=\"katex math multi-line no-emojify\">h_{\u03b8} = \u03b8_0 + \u03b8_1x\n<\/div>\n<p>\u03b8_i : parameters\u53c2\u6570<\/p>\n<h2>\u4ee3\u4ef7\u51fd\u6570(cost function)<\/h2>\n<p>\u4ee3\u4ef7\u51fd\u6570\uff08cost function\uff09\u662f\u5c06\u968f\u673a\u4e8b\u4ef6\u6216\u5176\u6709\u5173\u968f\u673a\u53d8\u91cf\u7684\u53d6\u503c\u6620\u5c04\u4e3a\u975e\u8d1f\u5b9e\u6570\u4ee5\u8868\u793a\u8be5\u968f\u673a\u4e8b\u4ef6\u7684\u201c\u98ce\u9669\u201d\u6216\u201c\u635f\u5931\u201d\u7684\u51fd\u6570\u3002\u901a\u8fc7\u6700\u5c0f\u5316\u4ee3\u4ef7\u51fd\u6570\u6c42\u89e3\u6700\u7b26\u5408\u7684\u5047\u8bbe\u51fd\u6570\u3002<\/p>\n<h3>eg.\u6c42\u623f\u5b50\u9762\u79ef(x)\u548c\u623f\u4ef7(y)\u4e4b\u95f4\u7684\u5047\u8bbe\u51fd\u6570\u53c2\u6570<\/h3>\n<div class=\"katex math multi-line no-emojify\">h_{\u03b8} = \u03b8_0 + \u03b8_1x\n<\/div>\n<p>\u89e3:<\/p>\n<div class=\"katex math multi-line no-emojify\">{minimize \\over \\theta_1 , \\theta_0}  {1\\over 2m} {\\sum_{i=0}^m(h_\\theta(x_i) &#8211; y_i)^2}\n<\/div>\n<blockquote><p>\n  \u95ee\u9898\u53d8\u4e3a\u627e\u5230\u8bad\u7ec3\u96c6\u4e2d\u9884\u6d4b\u503c\u548c\u771f\u5b9e\u503c\u7684\u5dee\u7684\u5e73\u65b9\u7684\u548c\u76841\/2M\u500d\u7684\u6700\u5c0f\u7684\u03b8_0\u548c\u03b8_1\u7684\u503c\n<\/p><\/blockquote>\n<p>\u5b9a\u4e49\u4ee3\u4ef7\u51fd\u6570:<\/p>\n<div class=\"katex math multi-line no-emojify\">J(\\theta_0,\\theta_1) = {1\\over2M}  \\sum_{i = 1}^m (h_\\theta(x_i) &#8211; y_i)^2\n<\/div>\n<p>\u4f18\u5316\u76ee\u6807:<\/p>\n<div class=\"katex math multi-line no-emojify\">{minimize\\over \\theta_0,\\theta_1}  \\underbrace{J(\\theta_0,\\theta_1)}_{\\text{cost function\u4ee3\u4ef7\u51fd\u6570}}\n<\/div>\n<blockquote><p>\n  \u8fd9\u4e2a\u4ee3\u4ef7\u51fd\u6570\u4e5f\u53eb\u5e73\u65b9\u8bef\u5dee\u51fd\u6570(squared error function)\u6216\u8005\u4ee3\u4ef7\u5e73\u65b9\u8bef\u5dee\u51fd\u6570(square error cost function)<br \/>\n  \u4e3a\u4ec0\u4e48\u8981\u6c42\u8bef\u5dee\u7684\u5e73\u65b9\u548c\u5462?\u56e0\u4e3a\u8bef\u5dee\u5e73\u65b9\u4ee3\u4ef7\u51fd\u6570\u5bf9\u4e8e\u5927\u591a\u6570\u95ee\u9898, \u7279\u522b\u662f\u56de\u5f52\u95ee\u9898, \u90fd\u662f\u4e00\u4e2a\u5408\u7406\u7684\u9009\u62e9, \u4e5f\u6709\u5176\u4ed6\u4ee3\u4ef7\u51fd\u6570\u4e5f\u80fd\u5f88\u597d\u7684\u53d1\u6325\u4f5c\u7528, \u4f46\u662f\u5e73\u65b9\u8bef\u5dee\u4ee3\u4ef7\u51fd\u6570\u53ef\u80fd\u662f\u89e3\u51b3\u56de\u5f52\u95ee\u9898\u6700\u5e38\u7528\u7684\u624b\u6bb5\u4e86\n<\/p><\/blockquote>\n<p>\u7b80\u5316\u5047\u8bbe\u51fd\u6570:<\/p>\n<div class=\"katex math multi-line no-emojify\">\\text{\u4ee4}\\theta_0 = 0\n<\/div>\n<p>\u5f97:<\/p>\n<div class=\"katex math multi-line no-emojify\">h_\\theta(x) = \\theta_1x\n<\/div>\n<p>\u4ee3\u4ef7\u51fd\u6570\u53d8\u4e3a:<\/p>\n<div class=\"katex math multi-line no-emojify\">J(\\theta_1) = {1\\over2m} \\sum_{i=1}^m(h_\\theta(x_i) &#8211; y_i)^2\n<\/div>\n<div class=\"katex math multi-line no-emojify\">{minimize\\over \\theta_1}  {J(\\theta_1)}\n<\/div>\n<blockquote><p>\n  \u8fd9\u91cc\u7684\u542b\u4e49\u662f\u53ea\u9009\u62e9\u4e86\u7ecf\u8fc7(0,0)\u70b9\u7684\u51fd\u6570\n<\/p><\/blockquote>\n<table>\n<thead>\n<tr>\n<th>\u5047\u8bbe\u51fd\u6570<\/th>\n<th>\u4ee3\u4ef7\u51fd\u6570<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u5173\u4e8e\u53c2\u6570x\u7684\u51fd\u6570<\/td>\n<td>\u5173\u4e8e\u53c2\u6570\u03b8_1\u7684\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td>x\u662f\u6a2a\u5750\u6807<\/td>\n<td>\u03b8_1\u662f\u5047\u8bbe\u51fd\u6570\u56fe\u50cf\u659c\u7387<\/td>\n<\/tr>\n<tr>\n<td><img decoding=\"async\" src=\"\/wp-content\/uploads\/2019\/12\/QQ\u622a\u56fe20191122201535-300x249.jpg\" alt=\"\" \/><\/td>\n<td><img decoding=\"async\" src=\"\/wp-content\/uploads\/2019\/12\/QQ\u622a\u56fe20191122201552-300x270.jpg\" alt=\"\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5f53\u5047\u8bbe\u51fd\u6570\u53d8\u56de\u539f\u6765\u7684\u6837\u5b50\u65f6, \u5373:<\/p>\n<div class=\"katex math multi-line no-emojify\">h_\\theta = \\theta_0 + \\theta_1 x\n<\/div>\n<p>\u5047\u8bbe\u51fd\u6570\u7684\u56fe\u50cf\u4e3a:<br \/>\n<img decoding=\"async\" src=\"\/wp-content\/uploads\/2019\/12\/QQ\u622a\u56fe20191122202445-290x300.jpg\" alt=\"\" \/><\/p>\n<p>\u4ee3\u4ef7\u51fd\u6570\u7684\u56fe\u50cf\u53d8\u4e3a:<br \/>\n<img decoding=\"async\" src=\"\/wp-content\/uploads\/2019\/12\/QQ\u622a\u56fe20191122202201-300x233.jpg\" alt=\"\" \/><\/p>\n<p>\u4e3a\u4e86\u65b9\u4fbf\u5c55\u793a, \u5e38\u7528\u7b49\u9ad8\u56fe\u4ee3\u66ff\u4e09\u7ef4\u8868\u9762\u56fe<\/p>\n<h2>\u5c06\u4ee3\u4ef7\u51fd\u6570J\u6700\u5c0f\u5316 : \u68af\u5ea6\u4e0b\u964d\u7b97\u6cd5(gradient descent)<\/h2>\n<p>\u6709\u4e00\u4e2a\u51fd\u6570:<\/p>\n<div class=\"katex math multi-line no-emojify\">J(\\theta_0, \\theta_1)\n<\/div>\n<p>\u6c42:<\/p>\n<div class=\"katex math multi-line no-emojify\">\\min_{\\theta_0,\\theta_1} J(\\theta_0, \\theta_1)\n<\/div>\n<p>\u601d\u8def:<\/p>\n<blockquote><p>\n  \u7ed9\u5b9a\u03b8_1,\u03b8_0\u7684\u521d\u59cb\u503c, \u5982\u90fd\u7b49\u4e8e0<br \/>\n  \u6162\u6162\u63a5\u8fd1\u51fd\u6570\u7684\u6700\u5c0f\u503c\n<\/p><\/blockquote>\n<p>\u91cd\u590d\u4e0b\u9762\u8fd9\u4e00\u6b65\u76f4\u5230\u6536\u655b:<\/p>\n<div class=\"katex math multi-line no-emojify\">\\theta_j : = \\theta_j &#8211; \\alpha \\frac{\\partial}{\\partial\\theta_j}J(\\theta_0, \\theta_1)   \\text{ (for j=0 and j=1)}\n<\/div>\n<blockquote><p>\n  &#8216;a:=b&#8217;\u8868\u793a\u5c06b\u8d4b\u503c\u7ed9a<br \/>\n  &#8216;a=b&#8217;\u8868\u793a\u65ad\u8a00a\u548cb\u7684\u503c\u76f8\u7b49<br \/>\n  \u03b1 : \u5b66\u4e60\u7387(learing rate),\u6307\u7684\u662f\u68af\u5ea6\u4e0b\u964d\u65f6, \u6bcf\u4e00\u6b65\u7684\u5e45\u5ea6\n<\/p><\/blockquote>\n<p>\u5bf9\u4e8e\u66f4\u65b0\u65b9\u7a0b, <strong>\u540c\u65f6\u66f4\u65b0<\/strong>\u03b8_0\u548c\u03b8_1<br \/>\n\u4f55\u8c13\u540c\u65f6?<\/p>\n<div class=\"katex math multi-line no-emojify\">temp0:=\\theta_0 &#8211; \\alpha \\frac{\\partial}{\\partial\\theta_0}J(\\theta_0, \\theta_1)\n<\/div>\n<div class=\"katex math multi-line no-emojify\">temp1:=\\theta_1 &#8211; \\alpha \\frac{\\partial}{\\partial\\theta_1}J(\\theta_0, \\theta_1)\n<\/div>\n<div class=\"katex math multi-line no-emojify\">\\theta_0:=temp0\n<\/div>\n<div class=\"katex math multi-line no-emojify\">\\theta_1 :=temp1\n<\/div>\n<p><strong>\u6ce8\u610f:<\/strong> \u4e0d\u80fd\u5728\u8ba1\u7b97\u5b8ctemp0\u540e\u9a6c\u4e0a\u8ba1\u7b97\u03b8_0, \u8fd9\u6837\u7b97\u51fa\u6765\u7684\u03b8_1\u4f1a\u88ab\u66f4\u65b0\u540e\u7684\u03b8_0\u6240\u5f71\u54cd.<\/p>\n<p><strong>\u5bfc\u6570\u9879:<\/strong><\/p>\n<div class=\"katex math multi-line no-emojify\">{\\partial \\over \\partial\\theta_1} {J(\\theta_0,\\theta_1)}\n<\/div>\n<p><strong>\u7684\u610f\u4e49\u662f<\/strong><br \/>\n\u51fd\u6570J()\u5173\u4e8e \u03b8_i \u7684\u659c\u7387<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5f53\u521d\u59cb\u503c\u5927\u4e8e\u6700\u5c0f\u503c<\/th>\n<th>\u5f53\u521d\u59cb\u503c\u5c0f\u4e8e\u6700\u5c0f\u503c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"\/wp-content\/uploads\/2019\/12\/Image-300x211.png\" alt=\"\" \/><\/td>\n<td><img decoding=\"async\" src=\"\/wp-content\/uploads\/2019\/12\/Image1-300x204.png\" alt=\"\" \/><\/td>\n<\/tr>\n<tr>\n<td>\u5bfc\u6570\u9879\u662f\u6b63\u6570, \u03b8\u5411\u6700\u5c0f\u503c\u79fb\u52a8<\/td>\n<td>\u5bfc\u6570\u9879\u662f\u8d1f\u6570, \u03b8\u5411\u6700\u5c0f\u503c\u79fb\u52a8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5f53\u03b8\u8fbe\u5230\u6700\u4f4e\u70b9\u65f6, \u5bfc\u6570\u9879=0, \u03b8\u4e0d\u518d\u66f4\u65b0<br \/>\n<strong>\u5b66\u4e60\u7387\u03b1\u7684\u610f\u4e49\u662f:<\/strong><br \/>\n\u03b8\u6bcf\u6b21\u5411\u6700\u5c0f\u503c\u79fb\u52a8\u7684\u5e45\u5ea6<\/p>\n<table>\n<thead>\n<tr>\n<th>\u03b1\u592a\u5927<\/th>\n<th>\u03b1\u592a\u5c0f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"\/wp-content\/uploads\/2019\/12\/Image2-300x183.png\" alt=\"\" \/><\/td>\n<td><img decoding=\"async\" src=\"\/wp-content\/uploads\/2019\/12\/Image3-300x183.png\" alt=\"\" \/><\/td>\n<\/tr>\n<tr>\n<td>\u6bcf\u6b21\u79fb\u52a8\u7684\u5e45\u5ea6\u592a\u5c0f, \u5230\u8fbe\u6700\u4f4e\u70b9\u7684\u9700\u8981\u5f88\u591a\u6b65<\/td>\n<td>\u6bcf\u6b21\u79fb\u52a8\u7684\u5e45\u5ea6\u592a\u5927, \u5bfc\u81f4\u65e0\u6cd5\u6536\u655b\u751a\u81f3\u53d1\u6563<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e8b\u5b9e\u4e0a\u7531\u4e8e\u659c\u7387\u5728\u9760\u8fd1\u6700\u4f4e\u70b9\u7684\u8fc7\u7a0b\u4e2d, \u4e0d\u65ad\u5730\u5728\u51cf\u5c11, \u6240\u4ee5\u68af\u5ea6\u4e0b\u964d\u5c06\u81ea\u52a8\u51cf\u5c0f\u6bcf\u6b65\u7684\u5e45\u5ea6<\/p>\n<p>\u6c42\u51fa\u504f\u5bfc\u9879:<\/p>\n<div class=\"katex math multi-line no-emojify\">\\begin{aligned}<br \/>\n\\rm{{{\\partial \\over \\partial\\theta_j }J(\\theta_0,\\theta_1)=\\frac {\\partial}{\\partial\\theta_j}{1\\over 2m}\\sum_{i=1}^m(h_\\theta(x^i)-y^i)^2}}\\\\<br \/>\n\\rm{={\\partial\\over\\partial\\theta_j}{1\\over 2m}{\\sum_{i=1}^m(\\theta_0 + \\theta_1x^i-y^i}}\\\\<br \/>\n\\rm{j=0 : {\\partial\\over\\partial\\theta_0}J(\\theta_0,\\theta_1) = \\frac{1}{m}\\sum_{i=1}^m(h_\\theta(x^i)-y^i)}\\\\<br \/>\n\\rm{j=1 : {\\partial\\over\\partial\\theta_1}J(\\theta_0,\\theta_1) = \\frac{1}{m}\\sum_{i=1}^m(h_\\theta(x^i)-y^i)x^i}<br \/>\n\\end{aligned}\n<\/div>\n<p>&#8220;Batch&#8221;Gradient Desent(Batch\u4e0b\u964d\u7b97\u6cd5) : each step of gradinet descent uses all the training examples.\u6bcf\u4e00\u6b65\u68af\u5ea6\u4e0b\u964d\u90fd\u904d\u5386\u6574\u4e2a\u8bad\u7ec3\u96c6\u6837\u672c<\/p>\n<h2>\u7ebf\u6027\u4ee3\u6570\u57fa\u7840<\/h2>\n<p>\u77e9\u9635(matrix):<\/p>\n<div class=\"katex math multi-line no-emojify\">A=<br \/>\n\\begin{bmatrix}<br \/>\n1 &amp; 2 &amp; 3\\\\<br \/>\n4 &amp; 5 &amp; 6\\\\<br \/>\n7 &amp; 8 &amp; 9\\\\<br \/>\n\\end{bmatrix}<br \/>\n(\\rm{R^{ 3\\times2}})\n<\/div>\n<div class=\"katex math multi-line no-emojify\">A_{1 2} = \\text{1\u884c2\u5217}(1^{th}row, 2^{th}col)=2\n<\/div>\n<p>\u5411\u91cf(vector):\u53ea\u6709\u4e00\u5217\u7684\u77e9\u9635<\/p>\n<div class=\"katex math multi-line no-emojify\">y=<br \/>\n\\begin{bmatrix}<br \/>\n460\\\\<br \/>\n232\\\\<br \/>\n315\\\\<br \/>\n178\\\\<br \/>\n\\end{bmatrix}<br \/>\n(\\rm{R^4})\\text{(\u56db\u7ef4\u5411\u91cf\u96c6\u5408)}\n<\/div>\n<div class=\"katex math multi-line no-emojify\">y_i = 460\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9a\u4e49: Tom\u00a0Mitchell :\u00a0well-posed learning Problem :\u00a0A\u00a0computer\u00a0program\u00a0is\u00a0said to learn from experience E whit respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E. \u76d1\u7763\u5b66\u4e60(supervised\u00a0learning): &#8220;right\u00a0answer&#8221;given : \u7ed9\u51fa\u6b63\u786e\u7b54\u6848,\u00a0\u7b97\u6cd5\u7684\u76ee\u7684\u662f\u7ed9\u51fa\u66f4\u591a\u7684\u6b63\u786e\u7b54\u6848 \u56de\u5f52\u95ee\u9898(regression\u00a0problem)\u5373:\u8bbe\u6cd5\u9884\u6d4b\u8fde\u7eed\u503c\u7684\u5c5e\u6027 \u5206\u7c7b\u95ee\u9898(classification\u00a0problem)\u5373:\u8bbe\u6cd5\u9884\u6d4b\u4e00\u4e2a\u79bb\u6563\u503c\u7684\u8f93\u51fa(\u59820\u548c1) \u65e0\u76d1\u7763\u5b66\u4e60(unsupervised learning): &#8220;give the algorithm a tons of data and ask it to find structure in the data&#8221;\u7ed9\u7b97\u6cd5\u6d77\u91cf\u6570\u636e,\u00a0\u627e\u51fa\u4e0d\u540c\u6570\u636e\u7684\u7c7b\u578b\u7ed3\u6784\u00a0 \u805a\u7c7b\u7b97\u6cd5(clustering algorithms):eg.\u65b0\u95fb\u5206\u7c7b,\u00a0\u627e\u51fa\u4e0d\u540c\u6570\u636e\u4e4b\u95f4\u7684\u8054\u7cfb \u9e21\u5c3e\u9152\u4f1a\u7b97\u6cd5(Cocktail party problem algorithm)eg.\u97f3\u9891\u5206\u79bb,\u00a0\u627e\u51fa\u4e00\u4e2a\u6570\u636e\u4e2d\u4e0d\u540c\u7684\u90e8\u5206 \u8f6f\u4ef6:Octave \u7b26\u53f7(Notation): m Number of training examples(\u8bad\u7ec3\u6837\u672c\u6570\u91cf) x &#8220;input&#8221; variable \/features(\u8f93\u5165\u91cf\/\u7279\u5f81) y &#8220;output&#8221; variable \/&#8221;target&#8221; variable(\u8f93\u51fa\u91cf\/\u9884\u6d4b\u76ee\u6807\u53d8\u91cf) (x ,y) one\u00a0training example (\u4e00\u4e2a\u8bad\u7ec3\u6837\u672c) (x ^{i} , y^{i}) the i ^ th training example(\u7b2ci\u4e2a\u8bad\u7ec3\u6837\u672c) h = hypopthesis(\u5047\u8bbe\u51fd\u6570)x,y\u51fd\u6570 \u7ebf\u6027\u56de\u5f52(linear regression) \/\u00a0\u5355\u53d8\u91cf\u7ebf\u6027\u56de\u5f52 (univariatre\u00a0linear\u00a0regression): h_{\u03b8} = \u03b8_0 + \u03b8_1x \u03b8_i : parameters\u53c2\u6570 \u4ee3\u4ef7\u51fd\u6570(cost function) \u4ee3\u4ef7\u51fd\u6570\uff08cost function\uff09\u662f\u5c06\u968f\u673a\u4e8b\u4ef6\u6216\u5176\u6709\u5173\u968f\u673a\u53d8\u91cf\u7684\u53d6\u503c\u6620\u5c04\u4e3a\u975e\u8d1f\u5b9e\u6570\u4ee5\u8868\u793a\u8be5\u968f\u673a\u4e8b\u4ef6\u7684\u201c\u98ce\u9669\u201d\u6216\u201c\u635f\u5931\u201d\u7684\u51fd\u6570\u3002\u901a\u8fc7\u6700\u5c0f\u5316\u4ee3\u4ef7\u51fd\u6570\u6c42\u89e3\u6700\u7b26\u5408\u7684\u5047\u8bbe\u51fd\u6570\u3002 eg.\u6c42\u623f\u5b50\u9762\u79ef(x)\u548c\u623f\u4ef7(y)\u4e4b\u95f4\u7684\u5047\u8bbe\u51fd\u6570\u53c2\u6570 h_{\u03b8} = \u03b8_0 + \u03b8_1x \u89e3: {minimize \\over \\theta_1 , \\theta_0} {1\\over 2m} {\\sum_{i=0}^m(h_\\theta(x_i) &#8211; y_i)^2} \u95ee\u9898\u53d8\u4e3a\u627e\u5230\u8bad\u7ec3\u96c6\u4e2d\u9884\u6d4b\u503c\u548c\u771f\u5b9e\u503c\u7684\u5dee\u7684\u5e73\u65b9\u7684\u548c\u76841\/2M\u500d\u7684\u6700\u5c0f\u7684\u03b8_0\u548c\u03b8_1\u7684\u503c \u5b9a\u4e49\u4ee3\u4ef7\u51fd\u6570: J(\\theta_0,\\theta_1) = {1\\over2M} \\sum_{i = 1}^m (h_\\theta(x_i) &#8211; y_i)^2 \u4f18\u5316\u76ee\u6807: {minimize\\over \\theta_0,\\theta_1} \\underbrace{J(\\theta_0,\\theta_1)}_{\\text{cost function\u4ee3\u4ef7\u51fd\u6570}} \u8fd9\u4e2a\u4ee3\u4ef7\u51fd\u6570\u4e5f\u53eb\u5e73\u65b9\u8bef\u5dee\u51fd\u6570(squared error function)\u6216\u8005\u4ee3\u4ef7\u5e73\u65b9\u8bef\u5dee\u51fd\u6570(square error cost function) \u4e3a\u4ec0\u4e48\u8981\u6c42\u8bef\u5dee\u7684\u5e73\u65b9\u548c\u5462?\u56e0\u4e3a\u8bef\u5dee\u5e73\u65b9\u4ee3\u4ef7\u51fd\u6570\u5bf9\u4e8e\u5927\u591a\u6570\u95ee\u9898, \u7279\u522b\u662f\u56de\u5f52\u95ee\u9898, \u90fd\u662f\u4e00\u4e2a\u5408\u7406\u7684\u9009\u62e9, \u4e5f\u6709\u5176\u4ed6\u4ee3\u4ef7\u51fd\u6570\u4e5f\u80fd\u5f88\u597d\u7684\u53d1\u6325\u4f5c\u7528, \u4f46\u662f\u5e73\u65b9\u8bef\u5dee\u4ee3\u4ef7\u51fd\u6570\u53ef\u80fd\u662f\u89e3\u51b3\u56de\u5f52\u95ee\u9898\u6700\u5e38\u7528\u7684\u624b\u6bb5\u4e86 \u7b80\u5316\u5047\u8bbe\u51fd\u6570: \\text{\u4ee4}\\theta_0 = 0 \u5f97: h_\\theta(x) = \\theta_1x \u4ee3\u4ef7\u51fd\u6570\u53d8\u4e3a: J(\\theta_1) = {1\\over2m} \\sum_{i=1}^m(h_\\theta(x_i) &#8211; y_i)^2 {minimize\\over \\theta_1} {J(\\theta_1)} \u8fd9\u91cc\u7684\u542b\u4e49\u662f\u53ea\u9009\u62e9\u4e86\u7ecf\u8fc7(0,0)\u70b9\u7684\u51fd\u6570 \u5047\u8bbe\u51fd\u6570 \u4ee3\u4ef7\u51fd\u6570 \u5173\u4e8e\u53c2\u6570x\u7684\u51fd\u6570 \u5173\u4e8e\u53c2\u6570\u03b8_1\u7684\u51fd\u6570 x\u662f\u6a2a\u5750\u6807 \u03b8_1\u662f\u5047\u8bbe\u51fd\u6570\u56fe\u50cf\u659c\u7387 \u5f53\u5047\u8bbe\u51fd\u6570\u53d8\u56de\u539f\u6765\u7684\u6837\u5b50\u65f6, \u5373: h_\\theta = \\theta_0 +&#8230;<\/p>\n","protected":false},"author":1,"featured_media":94,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/posts\/78"}],"collection":[{"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":10,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":293,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions\/293"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/media\/94"}],"wp:attachment":[{"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}