{"id":99,"date":"2023-03-14T22:17:54","date_gmt":"2023-03-14T14:17:54","guid":{"rendered":"https:\/\/blog.mumudlin.com\/?p=99"},"modified":"2023-03-16T20:41:56","modified_gmt":"2023-03-16T12:41:56","slug":"%e5%90%b4%e6%81%a9%e8%be%be%e3%80%8a%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0%e3%80%8b%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/blog.mumudlin.com\/index.php\/%e5%90%b4%e6%81%a9%e8%be%be%e3%80%8a%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0%e3%80%8b%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0\/","title":{"rendered":"\u5434\u6069\u8fbe\u300a\u673a\u5668\u5b66\u4e60\u300b\u5b66\u4e60\u7b14\u8bb0 2023\/3\/16\u66f4\u65b0"},"content":{"rendered":"<h1>1st<\/h1>\n<h2>machine learning<\/h2>\n<h3>1. welcome to machine Learning<\/h3>\n<h3>2. what can machine Learning do<\/h3>\n<hr \/>\n<h1>2st<\/h1>\n<h3>1. Define: what is machine learning?<\/h3>\n<h3>2. Machine Learning algorithms<\/h3>\n<h3>==2.1  Supervised learning (\u76d1\u7763\u5b66\u4e60)==   used most in real-world application<\/h3>\n<p>input             to                output label<\/p>\n<p>x                    to                        y<\/p>\n<p>learns from being given &quot;right answers&quot;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/rain-1302105611.cos.ap-chengdu.myqcloud.com\/202303141326416.png\" alt=\"image-20230314132626238\" \/><\/p>\n<p><strong>Regression<\/strong>: House price prediction             \u2014\u2014\u56de\u5f52\u95ee\u9898<\/p>\n<p>Predict a number infinitely many possible outputs.<\/p>\n<p><strong>Classification<\/strong>: Breast cancer detection      \u2014\u2014 \u5206\u7c7b\u95ee\u9898  class == category<\/p>\n<p>Predict categories.<\/p>\n<p>small number of possible outputs.   <\/p>\n<hr \/>\n<h3>==2.2 Unsupervised learning==(\u65e0\u76d1\u7763\u5b66\u4e60)<\/h3>\n<p>Find something interesting in unlabeled data.<\/p>\n<p>Data only comes with inputs x, but not output labels y. <\/p>\n<p>Algorithm has to find structure in the data.<\/p>\n<p><strong>Clustering<\/strong>(\u96c6\u7fa4\/\u7fa4\u96c6\/\u7c07): Google news \/ Grouping customers<\/p>\n<p>Group similar data points together.<\/p>\n<p><strong>Anomaly detection<\/strong>(\u5f02\u5e38\u68c0\u6d4b): <\/p>\n<p>Find unusual data points.<\/p>\n<p><strong>Dimensionality reduction<\/strong>(\u964d\u7ef4): <\/p>\n<p>Compress data using fewer numbers.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/rain-1302105611.cos.ap-chengdu.myqcloud.com\/202209302124334.png\" alt=\"image-20220930212432205\" \/><\/p>\n<hr \/>\n<h1>3st<\/h1>\n<h2>==Linear Regression Model==: \u7ebf\u6027\u56de\u5f52\u6a21\u578b<\/h2>\n<h3>Terminology<\/h3>\n<p>Training set<\/p>\n<p><strong>Notation\uff1a<\/strong> <\/p>\n<p>x = &quot;input&quot; variable<\/p>\n<p>\u200b        feature<\/p>\n<p>y =  &quot;output&quot; variable<\/p>\n<p>\u200b       &quot;target&quot; variable<\/p>\n<p>m = number of training examples.<\/p>\n<p>(x,y) = single training example.<\/p>\n<p>$(x^{i},y^{i}) = i^{th}$ training example.<\/p>\n<hr \/>\n<p>$\\hat{y}$   is  &quot;y-hat&quot; estimated y<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/rain-1302105611.cos.ap-chengdu.myqcloud.com\/202303142111582.png\" alt=\"image-20230314211118413\" \/><\/p>\n<p>Linear regression with <u><strong>one<\/strong><\/u> variable. \uff08\u5355\u53d8\u91cf\u7ebf\u6027\u56de\u5f52\uff09<\/p>\n<p>Univariate linear regression. <\/p>\n<hr \/>\n<h2>Cost Function \u4ee3\u4ef7\u51fd\u6570 or \u6210\u672c\u51fd\u6570<\/h2>\n<p><strong>Squared error cost function<\/strong> \u5e73\u65b9\u8bef\u5dee\u6210\u672c\u51fd\u6570\/\u4ee3\u4ef7\u51fd\u6570   <\/p>\n<p>Model: $f_{w,b}(x) = wx + b$<\/p>\n<p>w,b : parameters (\u7cfb\u6570\/\u6743\u91cd)<\/p>\n<p>y-intercept\uff1a\u622a\u8ddd<\/p>\n<p>slope\uff1a\u659c\u7387<\/p>\n<p>($\\hat{y}$ - y)  is be called <strong>error(\u8bef\u5dee)<\/strong><\/p>\n<p>$J_{w,b}=\\frac{1}{2m}\\sum_{i=1}^m(\\hat{y}^{(i)} - y^{(i)})^2$ (m = number of training examples)<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/rain-1302105611.cos.ap-chengdu.myqcloud.com\/202303151351879.png\" alt=\"image-20230315135148760\" \/><\/p>\n<p>$J_{w,b}=\\frac{1}{2m}\\sum_{i=1}^m(f_{w,b}(x^{i}) - y^{(i)})^2$<\/p>\n<p>Find <strong>w,b<\/strong>:<\/p>\n<p>$\\hat{y}$ is close to $y^{(i)}$ for all $(x^{(i)},y^{(i)})$<\/p>\n<hr \/>\n<h4>Conclusion<\/h4>\n<p><strong>model<\/strong>\uff1a<\/p>\n<p>$f_{w,b}(x) = wx + b$<\/p>\n<p><strong>parameters\uff1a<\/strong><\/p>\n<p>$w,b$<\/p>\n<p><strong>cost function\uff1a<\/strong><\/p>\n<p>$J_{w,b}=\\frac{1}{2m}\\sum_{i=1}^m(f_{w,b}(x^{i}) - y^{(i)})^2$<\/p>\n<p><strong>goal\uff1a<\/strong><\/p>\n<p>$\\mathop{minimize} \\limits_{w,b} J(w,b)$<\/p>\n<hr \/>\n<p><strong>Simplified<\/strong><\/p>\n<p>$f_{w}(x) = wx$ (if b = 0)<\/p>\n<p>$J_{w}=\\frac{1}{2m}\\sum_{i=1}^m(f_{w}(x^{(i)}) - y^{(i)})^2$<\/p>\n<p>$\\mathop{minimize} \\limits_{w} J(w)$<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/rain-1302105611.cos.ap-chengdu.myqcloud.com\/202303161849512.png\" alt=\"image-20230316184956237\" \/><\/p>\n<p>$f_{w}(x)$ (for fixed w, function of x) (here, x is <strong>input<\/strong>)<\/p>\n<p>J(w) (function of w) (here , w is <strong>parameter<\/strong>)<\/p>\n<hr \/>\n<p><img decoding=\"async\" src=\"https:\/\/rain-1302105611.cos.ap-chengdu.myqcloud.com\/202303161853212.png\" alt=\"image-20230316185339086\" \/><\/p>\n<p>choose <strong>w<\/strong> to minimize J(w)<\/p>\n<hr \/>\n<h3>3D Visualizing<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/rain-1302105611.cos.ap-chengdu.myqcloud.com\/202303161905840.png\" alt=\"image-20230316190530542\" \/><\/p>\n<h1>4st<\/h1>\n<h2>==Gradient Descent(\u68af\u5ea6\u4e0b\u964d)==<\/h2>\n<p>Have some function J(w,b)<\/p>\n<p>want to $\\mathop{min} \\limits_{w,b} J(w,b)$                  <\/p>\n<p>$\\mathop{min} \\limits_{w_{1},...,w_{n},b}J(w_{1},w_{2},...,w_{n},b)$<\/p>\n<p>Outline:<\/p>\n<p>\u200b   Start with some w,b(is not important)(so set w=0,b=0)<\/p>\n<p>\u200b   Keep changing w,b to reduce J(w,b)<\/p>\n<p>\u200b   Until we settle at or near a minimum(may have &gt;1 minimum)<\/p>\n<h3>Gradient descent algorithm<\/h3>\n<p>$w = w - \\alpha \\frac{\\partial}{\\partial w} J(w,b)$ <\/p>\n<p>$\\alpha$ : Learning rate<\/p>\n<p>$\\frac{\\partial}{\\partial w} J(w,b)$ : Derivative(\u5bfc\u6570)<\/p>\n<p>$b = b - \\alpha \\frac{\\partial}{\\partial b} J(w,b)$<\/p>\n<p>Simultaneously update w and b<\/p>\n<hr \/>\n<p><strong>Correct : Simultaneous update<\/strong><\/p>\n<p>$tmp\\_w = w - \\alpha \\frac{\\partial}{\\partial w} J(w,b)$<\/p>\n<p>$tmp\\_b = b - \\alpha \\frac{\\partial}{\\partial b} J(w,b)$<\/p>\n<p>$w = tmp\\_w$<\/p>\n<p>$b = tmp\\_b$<\/p>\n<p><strong>Order of attention<\/strong><\/p>\n<hr \/>\n<h3>Gradient Descent Intuition (\u68af\u5ea6\u4e0b\u964d\u7684\u76f4\u89c2\u7406\u89e3)<\/h3>\n<p>$w = w - \\alpha \\frac{\\partial}{\\partial w} J(w)$ <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/rain-1302105611.cos.ap-chengdu.myqcloud.com\/202303162037037.png\" alt=\"image-20230316203717835\" \/><\/p>\n<hr \/>\n<p>\u5b66\u4e60\u7387<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1st machine learning 1. welcome to machine Learning 2.  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-99","post","type-post","status-publish","format-standard","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/posts\/99","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/comments?post=99"}],"version-history":[{"count":17,"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"predecessor-version":[{"id":121,"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/posts\/99\/revisions\/121"}],"wp:attachment":[{"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mumudlin.com\/index.php\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}