<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[數聚點: 高級約維安]]></title><description><![CDATA[約維安計畫：用一年的時間培養出能獨當一面的約維安，在這個文明階段，高級約維安需要學習進階的程式語言應用，包含資料科學管線、Python 機器學習、R 語言統計分析、資料結構與演算法。]]></description><link>https://datainpoint.substack.com/s/a1b</link><image><url>https://substackcdn.com/image/fetch/$s_!XUts!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F546bc6e8-b295-4597-8630-6ad507c81372_500x500.png</url><title>數聚點: 高級約維安</title><link>https://datainpoint.substack.com/s/a1b</link></image><generator>Substack</generator><lastBuildDate>Thu, 20 Aug 2026 07:10:00 GMT</lastBuildDate><atom:link href="https://datainpoint.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[DATAINPOINT, INC.]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[datainpoint@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[datainpoint@substack.com]]></itunes:email><itunes:name><![CDATA[Yao-Jen Kuo]]></itunes:name></itunes:owner><itunes:author><![CDATA[Yao-Jen Kuo]]></itunes:author><googleplay:owner><![CDATA[datainpoint@substack.com]]></googleplay:owner><googleplay:email><![CDATA[datainpoint@substack.com]]></googleplay:email><googleplay:author><![CDATA[Yao-Jen Kuo]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[如何組織資料科學專案]]></title><description><![CDATA[&#20316;&#21697;&#38598; 101&#65306;&#31532;&#19968;&#37096;&#20998;]]></description><link>https://datainpoint.substack.com/p/portfolio-part-one</link><guid isPermaLink="false">https://datainpoint.substack.com/p/portfolio-part-one</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Fri, 04 Oct 2024 03:59:09 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0647410b-876c-47c4-a560-a66c24cfc303_480x270.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Q3o7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Q3o7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif 424w, https://substackcdn.com/image/fetch/$s_!Q3o7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif 848w, https://substackcdn.com/image/fetch/$s_!Q3o7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif 1272w, https://substackcdn.com/image/fetch/$s_!Q3o7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Q3o7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif" width="480" height="270" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:270,&quot;width&quot;:480,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2195987,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Q3o7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif 424w, https://substackcdn.com/image/fetch/$s_!Q3o7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif 848w, https://substackcdn.com/image/fetch/$s_!Q3o7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif 1272w, https://substackcdn.com/image/fetch/$s_!Q3o7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd19e3ff3-be44-4129-a38c-a505e03c0ddd_480x270.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;giphy.com</figcaption></figure></div><h2>&#38754;&#35430;&#24037;&#20316;&#30340;&#27969;&#31243;</h2><p>&#38754;&#35430;&#24037;&#20316;&#30340;&#27969;&#31243;&#22823;&#33268;&#19978;&#26377;&#65306;</p><ol><li><p>&#22635;&#23531;&#30003;&#35531;&#34920;&#12289;&#19978;&#20659;&#31777;&#27511;&#65288;curriculum vitae, CV&#65289;&#65292;&#36890;&#24120;&#24314;&#35696;&#26159;&#19968;&#38913;&#31777;&#27511;&#65288;one-page CV&#65289;&#20006;&#19988;&#19981;&#38656;&#35201;&#38468;&#29031;&#29255;&#12290;</p></li><li><p>&#33021;&#21147;&#20670;&#21521;&#28204;&#39511;&#65288;online aptitude test&#65289;&#65292;&#20839;&#23481;&#36890;&#24120;&#26159;&#33287;&#25033;&#24501;&#32887;&#32570;&#20043;&#23560;&#26989;&#36611;&#28858;&#28961;&#38364;&#30340;&#28204;&#39511;&#65292;&#26377;&#40670;&#20687;&#26159;&#22522;&#30990;&#30340;&#35486;&#25991;&#12289;&#25976;&#23416;&#33287;&#37007;&#36655;&#28204;&#39511;&#12290;</p></li><li><p>&#20154;&#36039;&#38754;&#35430;&#65292;&#20839;&#23481;&#36890;&#24120;&#26371;&#21644;&#25033;&#24501;&#32887;&#32570;&#20043;&#23560;&#26989;&#26377;&#30456;&#38364;&#65292;&#20294;&#19981;&#26159;&#22826;&#28145;&#20837;&#65292;&#27604;&#36611;&#28145;&#20837;&#30340;&#28966;&#40670;&#26371;&#25850;&#22312;&#38754;&#35430;&#20505;&#36984;&#20154;&#23565;&#26044;&#32887;&#32570;&#20839;&#23481;&#30340;&#29702;&#35299;&#31243;&#24230;&#12289;&#23565;&#26044;&#22296;&#38538;&#30340;&#38928;&#26399;&#12289;&#23565;&#26044;&#20844;&#21496;&#30340;&#35469;&#35672;&#20197;&#21450;&#23565;&#26044;&#20844;&#21496;&#25152;&#23660;&#29986;&#26989;&#30340;&#36264;&#21218;&#33287;&#36817;&#27841;&#12290;</p></li><li><p>&#23560;&#26989;&#33021;&#21147;&#38754;&#35430;&#65292;&#20839;&#23481;&#26371;&#21644;&#25033;&#24501;&#32887;&#32570;&#20043;&#23560;&#26989;&#39640;&#24230;&#30456;&#38364;&#65292;&#26371;&#30001;&#32887;&#32570;&#25152;&#23660;&#30340;&#20027;&#31649;&#25110;&#36039;&#28145;&#21516;&#20107;&#20358;&#36000;&#36012;&#65292;&#24418;&#24335;&#21487;&#33021;&#21253;&#21547;&#32218;&#19978;&#32771;&#38988;&#12289;&#23526;&#39636;&#28204;&#39511;&#21367;&#12289;&#21475;&#38957;&#38754;&#35430;&#29978;&#33267;&#26159;&#23560;&#26696;&#23526;&#20316;&#65292;&#22312;&#36889;&#20491;&#38542;&#27573;&#22914;&#26524;&#34920;&#29694;&#33391;&#22909;&#65292;&#37636;&#21462;&#30340;&#21487;&#33021;&#24615;&#23601;&#26371;&#30456;&#30070;&#39640;&#12290;&#22312;&#32218;&#19978;&#32771;&#38988;&#12289;&#23526;&#39636;&#28204;&#39511;&#21367;&#25110;&#23560;&#26696;&#23526;&#20316;&#20013;&#65292;&#20505;&#36984;&#20154;&#22810;&#21322;&#34389;&#26044;&#34987;&#21205;&#25509;&#25910;&#25361;&#25136;&#30340;&#34389;&#22659;&#65292;&#22522;&#26412;&#19978;&#23601;&#26159;&#20208;&#36084;&#22522;&#26412;&#21151;&#33287;&#23560;&#26989;&#32032;&#39178;&#35211;&#25307;&#25286;&#25307;&#65307;&#32780;&#22312;&#21475;&#38957;&#38754;&#35430;&#30340;&#26178;&#20505;&#65292;&#26159;&#20505;&#36984;&#20154;&#26377;&#27231;&#26371;&#33021;&#22816;&#21270;&#34987;&#21205;&#28858;&#20027;&#21205;&#30340;&#38627;&#24471;&#27231;&#26371;&#65292;&#20316;&#21697;&#38598;&#23601;&#26371;&#22312;&#27492;&#26178;&#30331;&#22580;&#65292;&#21487;&#20197;&#36879;&#36942;&#35299;&#37323;&#36039;&#26009;&#20358;&#28304;&#12289;&#23526;&#20316;&#36942;&#31243;&#25152;&#36973;&#36935;&#30340;&#22256;&#38627;&#12289;&#35299;&#27770;&#22256;&#38627;&#30340;&#20316;&#27861;&#20197;&#21450;&#21576;&#29694;&#20316;&#21697;&#65292;&#35731;&#38754;&#35430;&#23448;&#25812;&#20219;&#12300;&#32838;&#32893;&#12301;&#33287;&#12300;&#25552;&#21839;&#12301;&#30340;&#35282;&#33394;&#65292;&#34249;&#27492;&#34920;&#29694;&#33258;&#24049;&#22312;&#24037;&#20316;&#22580;&#21512;&#20013;&#22914;&#20309;&#33287;&#32893;&#30526;&#36914;&#34892;&#28317;&#36890;&#12290;</p></li><li><p>&#20027;&#31649;&#38754;&#35430;&#65292;&#36942;&#20102;&#23560;&#26989;&#33021;&#21147;&#38754;&#35430;&#20195;&#34920;&#24050;&#32147;&#34987;&#32887;&#32570;&#25152;&#23660;&#30340;&#22296;&#38538;&#25110;&#37096;&#38272;&#26680;&#21487;&#37636;&#21462;&#65292;&#26368;&#24460;&#26159;&#35731;&#20505;&#36984;&#20154;&#21644;&#26356;&#39640;&#23652;&#32026;&#30340;&#32147;&#29702;&#20154;&#26377;&#20132;&#27969;&#30340;&#27231;&#26371;&#65292;&#36890;&#24120;&#21482;&#35201;&#34920;&#29694;&#24471;&#38568;&#21644;&#65292;&#27794;&#26377;&#19981;&#21512;&#36969;&#30340;&#34892;&#28858;&#33289;&#27490;&#65292;&#24456;&#22810;&#26178;&#20505;&#36889;&#21482;&#26159;&#32842;&#20633;&#19968;&#26684;&#30340;&#26371;&#35527;&#65292;&#20445;&#25345;&#36629;&#39686;&#19988;&#24841;&#24709;&#30340;&#24515;&#24773;&#65292;&#31505;&#23481;&#21487;&#25516;&#22320;&#28310;&#20633;&#25910;&#37636;&#21462;&#36890;&#30693;&#21363;&#21487;&#12290;</p></li></ol><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&#25976;&#32858;&#40670; is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#30340;&#32068;&#25104;</h2><p>&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#23526;&#38555;&#30340;&#24418;&#24335;&#26371;&#20197;&#36039;&#26009;&#22846;&#20316;&#28858;&#21934;&#20301;&#65292;&#19968;&#20491;&#23560;&#26696;&#23601;&#26159;&#19968;&#20491;&#36039;&#26009;&#22846;&#65292;&#23560;&#26696;&#21517;&#31281;&#21363;&#28858;&#36039;&#26009;&#22846;&#21517;&#31281;&#65292;&#26377;&#30340;&#26178;&#20505;&#36039;&#26009;&#22846;&#26371;&#20316;&#28858;&#19978;&#32218;&#37096;&#32626;&#30340;&#20358;&#28304;&#65292;&#22240;&#27492;&#30433;&#37327;&#20197;&#23567;&#23531;&#33521;&#25991;&#21629;&#21517;&#12289;&#20197;&#24213;&#32218;&#25110;&#32773;&#28187;&#34399;&#20316;&#28858;&#21934;&#23383;&#30340;&#20998;&#38548;&#31526;&#65292;&#25105;&#20491;&#20154;&#26371;&#26356;&#20559;&#22909;&#29992;&#24213;&#32218;&#20570;&#20998;&#38548;&#31526;&#65292;&#21407;&#22240;&#26159;&#22312;&#31243;&#24335;&#35486;&#35328;&#20013;&#28187;&#34399;&#33287;&#29289;&#20214;&#21517;&#31281;&#30456;&#37168;&#30340;&#26178;&#20505;&#65288;&#28961;&#35542;&#20013;&#38291;&#26377;&#28961;&#31354;&#30333;&#65289;&#65292;&#26371;&#35222;&#28858;&#29289;&#20214;&#30340;&#28187;&#27861;&#36939;&#31639;&#65292;&#32780;&#28858;&#20102;&#36991;&#20813;&#22312;&#36889;&#31278;&#24773;&#27841;&#19979;&#35201;&#36914;&#34892;&#38989;&#22806;&#30340;&#27161;&#35387;&#65288;&#20363;&#22914;&#20351;&#29992;&#36339;&#33067;&#23383;&#20803; \ &#25110;&#32773; tilt &#31526;&#34399; `&#65289;&#12290;&#22312;&#36889;&#20491;&#36039;&#26009;&#22846;&#35041;&#38957;&#65292;&#36890;&#24120;&#26371;&#30001;&#19979;&#21015;&#36889;&#24190;&#20491;&#27284;&#26696;&#12289;&#36039;&#26009;&#22846;&#25152;&#32068;&#25104;&#65306;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/portfolio-part-one">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：深度學習（一）]]></title><description><![CDATA[&#31532;&#22235;&#21313;&#20116;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-forty-five-deep-learning-part-one</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-forty-five-deep-learning-part-one</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Wed, 28 Aug 2024 10:02:48 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/20dfdd41-c710-436f-bdff-fd87301b653f_500x281.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!skjO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!skjO!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif 424w, https://substackcdn.com/image/fetch/$s_!skjO!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif 848w, https://substackcdn.com/image/fetch/$s_!skjO!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif 1272w, https://substackcdn.com/image/fetch/$s_!skjO!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!skjO!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif" width="500" height="281" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:281,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5217542,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!skjO!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif 424w, https://substackcdn.com/image/fetch/$s_!skjO!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif 848w, https://substackcdn.com/image/fetch/$s_!skjO!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif 1272w, https://substackcdn.com/image/fetch/$s_!skjO!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc803ba8b-fdff-4561-a094-b00e9613c921_500x281.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: giphy.com</figcaption></figure></div><h2>&#35079;&#21512;&#20989;&#25976;</h2><p>&#24478;<a href="https://datainpoint.substack.com/p/week-forty-one-normal-equations">&#27491;&#35215;&#26041;&#31243;&#24335;</a>&#12289;<a href="https://datainpoint.substack.com/p/week-forty-two-gradient-descent">&#26799;&#24230;&#36958;&#28187;</a>&#12289;<a href="https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one">&#32645;&#21513;&#26031;&#36852;&#27512;</a>&#20877;&#21040;&#28145;&#24230;&#23416;&#32722;&#65292;&#25105;&#20497;&#21487;&#20197;&#25551;&#32362;&#20986;&#19968;&#26781;&#27231;&#22120;&#23416;&#32722;&#30340;&#23567;&#24465;&#65292;&#35731;&#21021;&#23416;&#32773;&#24478;&#23436;&#20840;&#38272;&#22806;&#28450;&#21040;&#30053;&#25026;&#20989;&#25976;&#36817;&#20284;&#30340;&#25216;&#24039;&#33287;&#25361;&#25136;&#12290;&#22312;&#21069;&#19977;&#32773;&#25105;&#20497;&#25152;&#36817;&#20284;&#30340;&#20989;&#25976; f &#37117;&#26159;&#23660;&#26044;&#12300;&#38750;&#12301;&#35079;&#21512;&#20989;&#25976;&#65292;&#28145;&#24230;&#23416;&#32722;&#38936;&#22495;&#20013;&#35201;&#36879;&#36942;&#28436;&#31639;&#27861;&#36817;&#20284;&#30340;&#20989;&#25976;&#65292;&#21063;&#26159;&#23660;&#26044;&#12300;&#35079;&#21512;&#12301;&#20989;&#25976;&#65288;function composition&#65289;&#65292;&#32780;&#38750;&#35079;&#21512;&#20989;&#25976;&#33287;&#35079;&#21512;&#20989;&#25976;&#30340;&#24046;&#30064;&#65292;&#20063;&#36896;&#23601;&#20102;&#23563;&#25214;&#21443;&#25976;&#26368;&#20339;&#21270;&#30340;&#26178;&#20505;&#25152;&#20208;&#36084;&#25216;&#24039;&#30340;&#19981;&#21516;&#12290;</p><p>&#35079;&#21512;&#20989;&#25976;&#65306;<a href="https://en.wikipedia.org/wiki/Function_composition">https://en.wikipedia.org/wiki/Function_composition</a></p><h2>&#28145;&#24230;&#21069;&#39243;&#32178;&#36335;</h2><p>&#28145;&#24230;&#23416;&#32722;&#20013;&#26368;&#22522;&#30990;&#30340;&#27169;&#22411;&#31281;&#28858;&#28145;&#24230;&#21069;&#39243;&#32178;&#36335;&#65288;deep feedforward neural networks&#65289;&#65292;&#21448;&#31281;&#28858;&#22810;&#23652;&#24863;&#30693;&#22120;&#65288;multiple layer perceptrons&#65289;&#65292;&#30446;&#27161;&#26159;&#36817;&#20284;&#26576;&#20491;&#35079;&#21512;&#20989;&#25976; f&#65292;&#21487;&#33021;&#30001; n &#20491;&#20989;&#25976;&#37832;&#32080;&#32068;&#25104;&#65292;&#20363;&#22914;&#30070; n &#28858; 3 &#30340;&#26178;&#20505;&#65292;&#21487;&#20197;&#34920;&#31034;&#28858;&#65306;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8zZ8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8zZ8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png 424w, https://substackcdn.com/image/fetch/$s_!8zZ8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png 848w, https://substackcdn.com/image/fetch/$s_!8zZ8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png 1272w, https://substackcdn.com/image/fetch/$s_!8zZ8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8zZ8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png" width="964" height="1354" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1354,&quot;width&quot;:964,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:446331,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8zZ8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png 424w, https://substackcdn.com/image/fetch/$s_!8zZ8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png 848w, https://substackcdn.com/image/fetch/$s_!8zZ8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png 1272w, https://substackcdn.com/image/fetch/$s_!8zZ8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff537bf28-36db-42e7-8338-9242cd9f9627_964x1354.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: https://alexlenail.me/NN-SVG</figcaption></figure></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f(x) = f^{(3)}(f^{(2)}(f^{(1)}(x)))&quot;,&quot;id&quot;:&quot;WRSYGWKDYR&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#19978;&#27161; (1) &#23601;&#31281;&#28858;&#31532;&#19968;&#23652;&#65292;&#26356;&#24120;&#35211;&#30340;&#21517;&#31281;&#26159;&#36664;&#20837;&#23652;&#65288;input layer&#65289;&#65292;&#19978;&#27161; (2) &#23601;&#31281;&#28858;&#31532;&#20108;&#23652;&#65292;&#26356;&#24120;&#35211;&#30340;&#21517;&#31281;&#26159;&#38577;&#34255;&#23652;&#65288;hidden layer&#65289;&#65292;&#33267;&#26044;&#19978;&#27161; (3) &#23601;&#31281;&#28858;&#31532;&#19977;&#23652;&#65292;&#26356;&#24120;&#35211;&#30340;&#21517;&#31281;&#26159;&#36664;&#20986;&#23652;&#65288;output layer&#65289;&#65307;&#30070; n &#28858; 4 &#30340;&#26178;&#20505;&#65292;&#21487;&#20197;&#34920;&#31034;&#28858;&#65306;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!snNx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!snNx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png 424w, https://substackcdn.com/image/fetch/$s_!snNx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png 848w, https://substackcdn.com/image/fetch/$s_!snNx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png 1272w, https://substackcdn.com/image/fetch/$s_!snNx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!snNx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png" width="1334" height="1366" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1366,&quot;width&quot;:1334,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:538188,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!snNx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png 424w, https://substackcdn.com/image/fetch/$s_!snNx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png 848w, https://substackcdn.com/image/fetch/$s_!snNx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png 1272w, https://substackcdn.com/image/fetch/$s_!snNx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb04f0a07-7dbf-49e6-822e-202fdb1eccc8_1334x1366.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: https://alexlenail.me/NN-SVG</figcaption></figure></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f(x) = f^{(4)}(f^{(3)}(f^{(2)}(f^{(1)}(x))))&quot;,&quot;id&quot;:&quot;YAPVXJDVNK&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#36889;&#26178;&#19978;&#27161; (1) &#31281;&#28858;&#36664;&#20837;&#23652;&#65288;input layer&#65289;&#65292;&#19978;&#27161; (2) &#33287;&#19978;&#27161; (3) &#23601;&#31281;&#28858;&#38577;&#34255;&#23652;&#65288;hidden layer&#65289;&#65292;&#33267;&#26044;&#19978;&#27161; (4) &#31281;&#28858;&#36664;&#20986;&#23652;&#65288;output layer&#65289;&#65292;&#38568;&#33879; n &#35722;&#22823;&#65292;&#20197;&#27492;&#39006;&#25512;&#38500;&#20102;&#31532;&#19968;&#23652;&#33287;&#31532; n &#23652;&#31281;&#28858;&#36664;&#20837;&#23652;&#12289;&#36664;&#20986;&#23652;&#65292;&#31532;&#20108;&#23652;&#33267;&#31532; n-1 &#23652;&#30342;&#31281;&#28858;&#38577;&#34255;&#23652;&#12290;</p><h2>&#12300;&#38577;&#34255;&#12301;&#30340;&#21629;&#21517;&#30001;&#20358;</h2><p>&#30001; n &#20491;&#20989;&#25976;&#37832;&#32080;&#32068;&#25104;&#30340;&#20989;&#25976;&#65292;&#20854;&#20013; n &#22823;&#26044;&#31561;&#26044; 3&#65292;&#24847;&#21363;&#33267;&#23569;&#35201;&#26377;&#19968;&#23652;&#38577;&#34255;&#23652;&#25165;&#31281;&#28858;&#28145;&#24230;&#23416;&#32722;&#65292;&#33267;&#26044;&#28858;&#20160;&#40636;&#25490;&#38500;&#20102;&#36664;&#20837;&#23652;&#33287;&#36664;&#20986;&#23652;&#20197;&#22806;&#30340;&#23652;&#25976;&#34987;&#21629;&#21517;&#28858;&#12300;&#38577;&#34255;&#12301;&#65311;&#20854;&#21629;&#21517;&#32227;&#30001;&#26159;&#22240;&#28858;&#35347;&#32244;&#36039;&#26009;&#30340;&#22238;&#39243;&#20316;&#29992;&#20677;&#27490;&#26044;&#36664;&#20986;&#23652;&#65292;&#28961;&#27861;&#24433;&#38911;&#26356;&#20043;&#21069;&#30340;&#23652;&#65292;&#24847;&#21363;&#35347;&#32244;&#36039;&#26009;&#22312;&#27169;&#22411;&#35347;&#32244;&#38542;&#27573;&#20677;&#21487;&#20197;&#22238;&#39243;&#21040;&#36664;&#20986;&#23652;&#30340;&#21443;&#25976;&#26368;&#36969;&#21270;&#65292;&#20013;&#38291;&#23652;&#25976;&#37117;&#26159;&#30001;&#23416;&#32722;&#28436;&#31639;&#27861;&#27770;&#23450;&#20854;&#36817;&#20284; f &#20989;&#25976;&#30340;&#21443;&#25976;&#65292;&#30333;&#35441;&#25991;&#30340;&#35498;&#26126;&#21363;&#26159;&#65292;&#30001;&#26044;&#35347;&#32244;&#36039;&#26009;&#20013;&#28961;&#27861;&#35264;&#23519;&#21040;&#20013;&#38291;&#23652;&#25976;&#30340;&#36664;&#20986;&#65292;&#25925;&#23559;&#20854;&#21629;&#21517;&#28858;&#38577;&#34255;&#23652;&#12290;</p><h2>&#27867;&#29992;&#29305;&#24501;&#24037;&#31243;</h2><p>&#23559;&#20989;&#25976; f &#25913;&#28858;&#20197;&#35079;&#21512;&#20989;&#25976;&#30340;&#24418;&#24335;&#21435;&#36817;&#20284;&#26377;&#26126;&#39023;&#21508;&#19968;&#20491;&#32570;&#40670;&#33287;&#20778;&#40670;&#65292;&#32570;&#40670;&#21363;&#26159;&#35201;&#36817;&#20284;&#30340;&#20989;&#25976;&#25976;&#37327;&#19981;&#20677;&#22686;&#22810;&#20102;&#65288;&#33267;&#23569;&#26377; 3 &#20491;&#20989;&#25976;&#38656;&#35201;&#36817;&#20284;&#20358;&#21512;&#25104;&#20989;&#25976; f&#65292;&#22240;&#28858; n &#24517;&#38920;&#22823;&#26044;&#31561;&#26044; 3&#65289;&#65292;&#20063;&#22240;&#28858;&#36889;&#20123;&#20989;&#25976;&#26377;&#21512;&#25104;&#12289;&#37832;&#32080;&#38364;&#20418;&#65292;&#38656;&#35201;&#20197;&#36899;&#37782;&#27861;&#21063;&#34389;&#29702;&#20559;&#24494;&#20998;&#30340;&#35336;&#31639;&#65292;&#36896;&#25104;&#35336;&#31639;&#37327;&#27604;&#38750;&#21512;&#25104;&#20989;&#25976;&#20358;&#24471;&#22823;&#65307;&#20778;&#40670;&#21063;&#26159;&#21487;&#20197;&#23559;&#38577;&#34255;&#23652;&#20316;&#28858;&#38750;&#32218;&#24615;&#36681;&#25563;&#20358;&#25844;&#20805;&#32218;&#24615;&#12289;&#38750;&#32218;&#24615;&#27169;&#22411;&#30340;&#27867;&#29992;&#24615;&#65292;&#23601;&#20687;&#26159;&#28858;&#35347;&#32244;&#36039;&#26009;&#25552;&#20379;&#26356;&#22810;&#30340;&#29305;&#24501;&#19968;&#33324;&#65292;&#22914;&#27492;&#19968;&#20358;&#28145;&#24230;&#23416;&#32722;&#22312;&#36984;&#25799;&#38750;&#32218;&#24615;&#36681;&#25563;&#20989;&#25976;&#30340;&#29872;&#31680;&#19978;&#21448;&#27604;&#20659;&#32113;&#27231;&#22120;&#23416;&#32722;&#27169;&#22411;&#26356;&#26377;&#24392;&#24615;&#19988;&#31777;&#21934;&#65292;&#20659;&#32113;&#27231;&#22120;&#27169;&#22411;&#24517;&#38920;&#25163;&#21205;&#24314;&#31435;&#38750;&#32218;&#24615;&#36681;&#25563;&#20989;&#25976;&#65292;&#20363;&#22914;&#37341;&#23565;&#19981;&#35542;&#26159;&#35486;&#38899;&#36776;&#35672;&#25110;&#32773;&#38651;&#33126;&#35222;&#35258;&#37117;&#20197;&#29544;&#31435;&#19988;&#23560;&#38272;&#30340;&#38750;&#32218;&#24615;&#36681;&#25563;&#20989;&#25976;&#20358;&#25033;&#29992;&#65307;&#21453;&#35264;&#28145;&#24230;&#23416;&#32722;&#30340;&#20316;&#27861;&#21063;&#26159;&#25505;&#29992;&#23559;&#38750;&#32218;&#24615;&#36681;&#25563;&#20989;&#25976;&#32013;&#20837;&#20102;&#35347;&#32244;&#30340;&#31684;&#30087;&#65292;&#22312;&#23416;&#32722;&#28436;&#31639;&#27861;&#20013;&#25214;&#23563;&#30456;&#23565;&#33391;&#22909;&#30340;&#38750;&#32218;&#24615;&#36681;&#25563;&#20989;&#25976;&#65292;&#20197;&#24335;&#23376;&#34920;&#36948;&#21363;&#28858;&#65306;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y=f(x;\\theta,w)=\\phi (x;\\theta)^{\\top}w&quot;,&quot;id&quot;:&quot;AJBGLWSLZK&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#24847;&#21363;&#23559;&#21407;&#26412;&#30340;&#29305;&#24501;&#30697;&#38499;&#20778;&#21270;&#25104;&#20102;&#32147;&#36942;&#38750;&#32218;&#24615;&#36681;&#25563;&#32780;&#24471;&#30340;&#36664;&#20986;&#65292;&#34249;&#27492;&#29554;&#24471;&#19968;&#20491;&#39640;&#24230;&#36890;&#29992;&#12289;&#36969;&#29992;&#24291;&#27867;&#24773;&#22659;&#30340;&#29305;&#24501;&#30697;&#38499;&#12290;&#24050;&#32147;&#23565;&#27231;&#22120;&#23416;&#32722;&#29702;&#35542;&#26377;&#30456;&#30070;&#35469;&#35672;&#30340;&#35712;&#32773;&#65292;&#21487;&#20197;&#23559;&#38577;&#34255;&#23652;&#30340;&#20316;&#29992;&#35222;&#28858;&#19968;&#31278;&#22312;&#35347;&#32244;&#36942;&#31243;&#20013;&#20381;&#25818;&#28145;&#24230;&#23416;&#32722;&#26550;&#27083;&#35373;&#35336;&#33287;&#27963;&#21270;&#20989;&#25976;&#36984;&#29992;&#32780;&#29986;&#20986;&#30340;&#12300;&#27867;&#29992;&#29305;&#24501;&#24037;&#31243;&#12301;&#65292;&#23427;&#21487;&#33021;&#26159;&#22312;&#35347;&#32244;&#36942;&#31243;&#20013;&#28858;&#35347;&#32244;&#36039;&#26009;&#29983;&#25104;&#20102;&#39640;&#27425;&#38917;&#12289;&#20132;&#20114;&#38917;&#12289;&#27161;&#28310;&#21270;&#25110;&#32773;&#26159;&#36899;&#32396;&#20540;&#38626;&#25955;&#21270;&#31561;&#12290;</p><h2>&#28145;&#24230;&#23416;&#32722;&#30340;&#20989;&#25976;</h2><p>&#23450;&#32681;&#19968;&#20491;&#26368;&#21934;&#32020;&#30340;&#28145;&#24230;&#21069;&#39243;&#32178;&#36335;&#65292;&#39318;&#20808;&#38656;&#35201;&#27770;&#23450;&#23652;&#25976;&#33287;&#21508;&#23652;&#30340;&#21934;&#20803;&#25976;&#65292;&#20854;&#20013;&#21934;&#20803;&#25976;&#33287;&#23652;&#25976;&#30340;&#26550;&#27083;&#65292;&#23601;&#26371;&#27770;&#23450;&#21040;&#32317;&#21443;&#25976;&#30340;&#25976;&#37327;&#65292;&#28982;&#24460;&#38656;&#35201;&#36984;&#25799;&#29992;&#26044;&#38577;&#34255;&#23652;&#30340;&#27963;&#21270;&#20989;&#25976;&#65288;activation functions&#65289;&#26368;&#24460;&#21063;&#26159;&#36984;&#25799;&#22914;&#20309;&#36939;&#34892;&#23416;&#32722;&#28436;&#31639;&#27861;&#65292;&#38614;&#28982;&#26412;&#36074;&#19978;&#20063;&#26159;&#21033;&#29992;&#26799;&#24230;&#36958;&#28187;&#30340;&#23416;&#32722;&#28436;&#31639;&#27861;&#65292;&#20294;&#30001;&#26044;&#28145;&#24230;&#21069;&#39243;&#32178;&#36335;&#26159;&#19968;&#31278;&#21512;&#25104;&#20989;&#25976;&#30340;&#36817;&#20284;&#65292;&#20854;&#23416;&#32722;&#28436;&#31639;&#27861;&#31281;&#28858;&#20498;&#20659;&#36958;&#65288;backpropagation&#65289;&#12290;</p><p>&#20551;&#22914;&#25105;&#20497;&#35201;&#21033;&#29992;&#28145;&#24230;&#21069;&#39243;&#32178;&#36335;&#20358;&#35299;&#27770; MNIST &#25163;&#23531;&#25976;&#23383;&#36776;&#35672;&#30340;&#21839;&#38988;&#65292;&#35442;&#24590;&#40636;&#24478;&#38646;&#38283;&#22987;&#24605;&#32771;&#26550;&#27083;&#12289;&#27963;&#21270;&#20989;&#25976;&#33287;&#20498;&#20659;&#36958;&#65311;&#25105;&#20497;&#26371;&#20808;&#22312;&#19979;&#19968;&#27425;&#38651;&#23376;&#22577;&#20013;&#23566;&#35712;&#25688;&#35201; Gilbert Strang: The Functions of Deep Learning &#20877;&#36914;&#20837;&#23526;&#20316;&#29872;&#31680;&#12290;</p><p>&#31532;&#22235;&#21313;&#20116;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#28145;&#24230;&#23416;&#32722;&#65288;&#19968;&#65289;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#20998;&#20139;&#128588;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-five-deep-learning-part-one?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-five-deep-learning-part-one?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-five-deep-learning-part-one/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-five-deep-learning-part-one/comments"><span>Leave a comment</span></a></p>]]></content:encoded></item><item><title><![CDATA[約維安計畫：羅吉斯迴歸（下）]]></title><description><![CDATA[&#31532;&#22235;&#21313;&#22235;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-forty-four-logistic-regression-part-two</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-forty-four-logistic-regression-part-two</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Tue, 16 Jul 2024 09:01:17 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/22f70aba-4da4-45ab-b410-cdd51d94766e_480x282.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LWgY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LWgY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif 424w, https://substackcdn.com/image/fetch/$s_!LWgY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif 848w, https://substackcdn.com/image/fetch/$s_!LWgY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif 1272w, https://substackcdn.com/image/fetch/$s_!LWgY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LWgY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif" width="480" height="282" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:282,&quot;width&quot;:480,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:539508,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LWgY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif 424w, https://substackcdn.com/image/fetch/$s_!LWgY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif 848w, https://substackcdn.com/image/fetch/$s_!LWgY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif 1272w, https://substackcdn.com/image/fetch/$s_!LWgY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab2468f-80b4-444f-b336-2541767fb8be_480x282.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;giphy.com</figcaption></figure></div><h2>&#32645;&#21513;&#26031;&#36852;&#27512;&#30340;&#25104;&#26412;&#20989;&#25976;</h2><p>&#22312;<a href="https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one">&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#32645;&#21513;&#26031;&#36852;&#27512;&#65288;&#19978;&#65289;</a>&#19968;&#25991;&#20013;&#25105;&#20497;&#25552;&#21040;&#20102;&#32645;&#21513;&#26031;&#36852;&#27512;&#39006;&#21029;&#38928;&#28204;&#27169;&#22411;&#30340;&#23450;&#32681;&#12289;&#20132;&#21449;&#29109;&#65288;cross entropy&#65289;&#25104;&#26412;&#20989;&#25976;&#12289;Sigmoid &#20989;&#25976;&#20197;&#21450;&#22914;&#20309;&#36939;&#29992;&#26799;&#24230;&#36958;&#28187;&#65288;gradient descent&#65289;&#23416;&#32722;&#28436;&#31639;&#26041;&#27861;&#27714;&#35299;&#27402;&#37325;&#21521;&#37327;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\n\\text{For each epoch:} \\\\\nw := w - \\eta \\nabla_w J(w) \\; \\text{, where } \\eta \\in \\mathbb{R}^+ \n\\end{gather}&quot;,&quot;id&quot;:&quot;PUPFROGPPE&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#22312;&#36889;&#20491;&#24335;&#23376;&#20013;&#26368;&#37325;&#35201;&#30340;&#19968;&#20491;&#27714;&#35299;&#20219;&#21209;&#23601;&#26159;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#26799;&#24230;&#65292;&#37027;&#40636;&#36889;&#20491;&#25104;&#26412;&#20989;&#25976; J&#65292;&#20063;&#23601;&#26159;&#20132;&#21449;&#29109;&#25104;&#26412;&#20989;&#25976;&#30340;&#20559;&#24494;&#35442;&#24590;&#40636;&#25512;&#23566;&#21602;&#65311;&#39318;&#20808;&#25105;&#20497;&#23559;&#25104;&#26412;&#20989;&#25976; J &#30340;&#20839;&#23481;&#20877;&#32048;&#23531;&#19968;&#27425;&#65306;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\nz = Xw \\text{,}\\; X \\in \\mathbb{R^{m \\times n}} \\text{,} \\; w \\in \\mathbb{R^n}\\\\\n\\hat{p} = \\sigma(z) \\text{, where } \\sigma(x) = \\frac{1}{1 + e^{-x}} \\\\\nJ(\\hat{p}) = \\frac{1}{m} \\left( -ylog(\\hat{p}) - (1-y)log(1-\\hat{p}) \\right) \\\\\nJ(w) = \\frac{1}{m} \\left( -ylog(\\sigma(Xw)) - (1-y)log(1-\\sigma(Xw)) \\right)\n\\end{gather}&quot;,&quot;id&quot;:&quot;YPUIKYRGEM&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#20180;&#32048;&#27298;&#26597;&#25104;&#26412;&#20989;&#25976; J &#30340;&#32068;&#25104;&#65292;&#25105;&#20497;&#26371;&#30332;&#29694;&#36889;&#26159;&#19968;&#20491;&#37832;&#32080;&#20989;&#25976;&#65288;chaining function&#65289;&#30340;&#32080;&#27083;&#65292;&#20839;&#23652;&#26377;&#23565;&#29305;&#24501;&#30697;&#38499;&#21644;&#27402;&#37325;&#21521;&#37327;&#30456;&#20056;&#32080;&#26524;&#25033;&#29992; Sigmoid &#20989;&#25976;&#65292;&#22806;&#23652;&#21063;&#26377;&#23565; Sigmoid &#20989;&#25976;&#36664;&#20986;&#25033;&#29992;&#23565;&#25976;&#20989;&#25976;&#65292;&#33509;&#26159;&#24819;&#38918;&#21033;&#25512;&#23566;&#20854;&#25104;&#26412;&#20989;&#25976;&#30340;&#26799;&#24230;&#65292;&#25105;&#20497;&#21487;&#20197;&#38928;&#26399;&#24517;&#38920;&#20855;&#26377;&#24190;&#38917;&#20808;&#20633;&#30693;&#35672;&#65306;&#36899;&#37782;&#27861;&#21063;&#65288;chain rule&#65289;&#12289;&#23565;&#25976;&#20989;&#25976;&#24494;&#20998;&#20197;&#21450; Sigmoid &#20989;&#25976;&#24494;&#20998;&#12290;</p><h2>&#36899;&#37782;&#27861;&#21063;</h2><p>&#36899;&#37782;&#27861;&#21063;&#21487;&#20197;&#29992;&#26044;&#27714;&#35299;&#37832;&#32080;&#20989;&#25976;&#30340;&#23566;&#25976;&#65292;&#22914;&#26524;&#19968;&#20491;&#37832;&#32080;&#20989;&#25976; h &#26159;&#30001; g &#21644; f &#20841;&#20989;&#25976;&#20381;&#24207;&#20316;&#29992;&#21512;&#25104;&#65292;g &#20989;&#25976;&#20808;&#20316;&#29992;&#65292;&#20854;&#36664;&#20986;&#20877;&#25104;&#28858; f &#20989;&#25976;&#30340;&#36664;&#20837;&#65292;&#37027;&#40636; h &#20989;&#25976;&#38364;&#26044; x &#30340;&#23566;&#25976;&#28858;&#20841;&#20491;&#24494;&#20998;&#32080;&#26524;&#30340;&#30456;&#20056;&#65292;&#20381;&#24207;&#26159; h &#20989;&#25976;&#38364;&#26044; g &#20989;&#25976;&#30340;&#24494;&#20998;&#12289;g &#20989;&#25976;&#38364;&#26044; x &#30340;&#24494;&#20998;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\nh(x) = f(g(x)) \\\\\nh = f \\circ g \\\\\nh'(x) = f'(g(x))g'(x) \\\\\n\\frac{dh}{dx} = \\frac{d h}{dg}\\frac{dg}{dx}\n\\end{gather}&quot;,&quot;id&quot;:&quot;MFCQONNBPG&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#23559;&#36899;&#37782;&#27861;&#21063;&#25033;&#29992;&#26044;&#25104;&#26412;&#20989;&#25976; J &#30340;&#26799;&#24230;&#27714;&#35299;&#65292;&#21487;&#20197;&#23559;&#20854;&#23531;&#25104;&#20841;&#20491;&#20559;&#24494;&#20998;&#32080;&#26524;&#30340;&#32080;&#21512;&#65292;&#20381;&#24207;&#26159;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#23565;&#25976;&#20989;&#25976;&#30340;&#20559;&#24494;&#20998;&#12289;&#23565;&#25976;&#20989;&#25976;&#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#20559;&#24494;&#20998;&#12290;&#25509;&#19979;&#20358;&#25105;&#20497;&#21487;&#20197;&#25286;&#38283;&#20358;&#35299;&#36889;&#20841;&#20491;&#20559;&#24494;&#20998;&#30340;&#37096;&#20998;&#65292;&#26368;&#24460;&#32080;&#21512;&#36215;&#20358;&#24471;&#21040;&#24819;&#35201;&#27714;&#35299;&#30340;&#12300;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#26799;&#24230;&#12301;&#12290;</p><h2>&#23565;&#25976;&#20989;&#25976;&#20559;&#24494;&#20998;</h2><p>&#38364;&#26044;&#23565;&#25976;&#20989;&#25976;&#20559;&#24494;&#20998;&#65292;&#20808;&#20633;&#30693;&#35672;&#65288;&#19981;&#21478;&#22806;&#35657;&#26126;&#30340;&#37096;&#20998;&#65289;&#28858;&#65306;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\n\\frac{d}{dx}log(x) = \\frac{1}{x} \\\\\n\\frac{d}{dx}log(1-x) = \\frac{-1}{1-x}\n\\end{gather}&quot;,&quot;id&quot;:&quot;NJFDWLZMHR&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#22240;&#27492;&#25105;&#20497;&#21487;&#20197;&#20808;&#23559;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#20559;&#24494;&#20998;&#25512;&#23566;&#28858;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#23565;&#25976;&#20989;&#25976;&#30340;&#20559;&#24494;&#20998;&#24418;&#24335;&#65306;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\nJ(w) = \\frac{1}{m} \\left( -ylog(\\hat{p}) - (1-y)log(1-\\hat{p}) \\right)\\\\\n\\nabla_w J(w) = \\frac{1}{m} \\left( -y\\frac{1}{\\hat{p}} \\frac{\\partial \\hat{p}}{\\partial z} - (1-y)\\frac{-1}{1-\\hat{p}} \\frac{\\partial(1-\\hat{p})}{\\partial z} \\right)\n\\end{gather}&quot;,&quot;id&quot;:&quot;GVQWLPJXTX&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#23436;&#25104;&#23565;&#25976;&#20989;&#25976;&#20559;&#24494;&#20998;&#30340;&#37096;&#20998;&#65292;&#25509;&#19979;&#20358;&#26159; Sigmoid &#20989;&#25976;&#20559;&#24494;&#20998;&#30340;&#37096;&#20998;&#12290;</p><h2>Sigmoid &#20989;&#25976;&#20559;&#24494;&#20998;</h2><p>&#38364;&#26044; Sigmoid &#20989;&#25976;&#20559;&#24494;&#20998;&#65292;&#20808;&#20633;&#30693;&#35672;&#65288;&#19981;&#21478;&#22806;&#35657;&#26126;&#30340;&#37096;&#20998;&#65289;&#28858;&#65306;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\frac{d}{dx}\\sigma(x) &amp;= \\frac{d}{dx} \\left( (1+e^{-x})^{-1} \\right) \\\\\n&amp;= \\frac{0 \\cdot (1+e^{-x})-1 \\cdot (e^{-x} \\cdot (-1) )}{(1 + e^{-x})^2}\\\\\n&amp;= \\frac{e^{-x}}{(1+e^{-x})^2}\\\\\n&amp;= \\frac{1-1+e^{-x}}{(1+e^{-x})^2}\\\\\n&amp;= \\frac{1+e^{-x}}{(1+e^{-x})^2} - \\frac{1}{(1+e^{-x})^2} \\\\\n&amp;= \\frac{1}{1+e^{-x}} - \\frac{1}{(1+e^{-x})^2} \\\\\n&amp;= \\frac{1}{1+e^{-x}} \\left( 1 - \\frac{1}{1+e^{-x}} \\right) \\\\\n&amp;= \\sigma(x)\\left( 1-\\sigma(x) \\right)\n\\end{align}&quot;,&quot;id&quot;:&quot;MFGMYWWFPR&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#20808;&#20633;&#30693;&#35672;&#20013;&#30340;&#31532;&#20108;&#24335;&#36939;&#29992;&#21040;&#24494;&#20998;&#30340;&#38500;&#27861;&#35215;&#21063;&#12289;&#31532;&#22235;&#24335;&#21063;&#36939;&#29992;&#21040;&#20102;&#19968;&#20491;&#24039;&#22937;&#30340; +1-1 &#30340;&#25216;&#24039;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\nh(x) = \\frac{f(x)}{g(x)}\\\\\nh'(x) = \\frac{f(x)g'(x) - f'(x)g(x)}{g^2(x)}\n\\end{gather}&quot;,&quot;id&quot;:&quot;EOYAHZNLMB&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#22240;&#27492;&#25105;&#20497;&#21487;&#20197;&#25509;&#33879;&#23559;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#20559;&#24494;&#20998;&#25512;&#23566;&#28858;&#26368;&#32066;&#30340;&#24418;&#24335;&#65306;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\nabla_w J(w) &amp;= \\frac{1}{m} \\left( -y\\frac{1}{\\hat{p}} \\frac{\\partial \\hat{p}}{\\partial z} - (1-y)\\frac{-1}{1-\\hat{p}} \\frac{\\partial(1-\\hat{p})}{\\partial z} \\right) \\\\\n&amp;= \\frac{1}{m} \\left( -y\\frac{1}{\\hat{p}} \\sigma(z)(1-\\sigma(z))\\sigma'(z) + (1-y)\\frac{1}{1-\\hat{p}}\\sigma(z)(1-\\sigma(z))\\sigma'(z)\\right) \\\\\n&amp;= \\frac{1}{m}\\sigma'(z) \\left( -y\\frac{1}{\\sigma(z)} \\sigma(z)(1-\\sigma(z)) + (1-y)\\frac{1}{1-\\sigma(z)}\\sigma(z)(1-\\sigma(z))\\right) \\\\\n&amp;= \\frac{1}{m}\\sigma'(z) \\left( -y(1-\\sigma(z)) + (1-y)\\sigma(z) \\right) \\\\\n&amp;=\\frac{1}{m}\\sigma'(z)\\left( -y+y\\sigma(z) + \\sigma(z)-y\\sigma(z) \\right) \\\\\n&amp;=\\frac{1}{m}\\sigma'(z)\\left(\\sigma(z)-y \\right)\\\\\n&amp;=\\frac{1}{m}X^{\\top}\\left(\\sigma(Xw)-y \\right)\n\\end{align}&quot;,&quot;id&quot;:&quot;KOVLDEXKMQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#25105;&#20497;&#32066;&#26044;&#25512;&#23566;&#20986;&#20197;&#20132;&#21449;&#29109;&#20316;&#28858;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#26799;&#24230;&#65292;&#26368;&#24460;&#23559;&#32645;&#21513;&#26031;&#36852;&#27512;&#26799;&#24230;&#36958;&#28187;&#30340;&#27867;&#22411;&#24335;&#34920;&#31034;&#22914;&#19979;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\n\\text{For each epoch:} \\\\\nw := w - \\eta \\nabla_w J(w) \\; \\text{, where } \\eta \\in \\mathbb{R}^+ \\\\\nw := w - \\eta \\frac{1}{m}X^{\\top} \\left( \\sigma(Xw) - y \\right)\n\\end{gather}&quot;,&quot;id&quot;:&quot;VDJOHDYKEO&quot;}" data-component-name="LatexBlockToDOM"></div><h2>&#20197; Numpy &#23526;&#20316;&#32645;&#21513;&#26031;&#36852;&#27512;</h2><p>&#25104;&#21151;&#25512;&#23566;&#20986;&#20197;&#20132;&#21449;&#29109;&#20316;&#28858;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#26799;&#24230;&#20043;&#24460;&#65292;&#26368;&#24460;&#25105;&#20497;&#23531;&#20316;&#19968;&#20491;&#39006;&#21029; LogisticRegression&#65292;&#20197; Python &#33287; Numpy &#27169;&#32068;&#23526;&#20316;&#65292;&#22312;&#32102;&#23450;&#36969;&#30070;&#36039;&#26009;&#38598;&#30340;&#29305;&#24501;&#30697;&#38499;&#33287;&#30446;&#27161;&#21521;&#37327;&#65292;&#33021;&#22816;&#36845;&#20195;&#20778;&#21270;&#38568;&#27231;&#29983;&#25104;&#30340;&#27402;&#37325;&#21521;&#37327;&#65292;&#36914;&#32780;&#29983;&#25104; h &#20989;&#25976;&#12290;</p><pre><code><code>class LogisticRegression:
    def fit(self, X_train, y_train):
        # ...
    def predict(self, X_test):
        # ...</code></code></pre><p>LogisticRegression &#39006;&#21029;&#30340;&#20351;&#29992;&#26159;&#20197; fit() &#26041;&#27861;&#29983;&#25104;&#27402;&#37325;&#21521;&#37327;&#65292;&#20006;&#20197; predict() &#26041;&#27861;&#29983;&#25104;&#38928;&#28204;&#12290;&#25105;&#20497;&#21487;&#20197;&#23559; LogisticRegression &#39006;&#21029;&#25033;&#29992;&#22312; Kaggle &#30340; Titanic &#36039;&#26009;&#38598;&#65292;&#34249;&#27492;&#20358;&#39511;&#35657;&#23427;&#30340;&#21487;&#29992;&#24615;&#12290;</p><pre><code><code>train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
X_train = train["Fare"].values.reshape(-1, 1)
y_train = train["Survived"].values
X_test = test["Fare"].values.reshape(-1, 1)
logistic_regression = LogisticRegression()
logistic_regression.fit(X_train, y_train)
y_pred = logistic_regression.predict(X_test)</code></code></pre><p>&#31532;&#22235;&#21313;&#22235;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#32645;&#21513;&#26031;&#36852;&#27512;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#20998;&#20139;&#128588;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-four-logistic-regression-part-two?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-four-logistic-regression-part-two?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-four-logistic-regression-part-two/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-four-logistic-regression-part-two/comments"><span>Leave a comment</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#21487;&#20197;&#40670;&#36984;&#19979;&#21015;&#36899;&#32080;&#35079;&#35069;&#23436;&#25972;&#30340;&#20839;&#23481;&#33287;&#31243;&#24335;&#30908;&#21040;&#33258;&#24049;&#30340; Google Drive &#20043;&#20013;&#12290;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/week-forty-four-logistic-regression-part-two">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：羅吉斯迴歸（上）]]></title><description><![CDATA[&#31532;&#22235;&#21313;&#19977;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Sat, 22 Jun 2024 03:59:43 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!lSnV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lSnV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lSnV!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif 424w, https://substackcdn.com/image/fetch/$s_!lSnV!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif 848w, https://substackcdn.com/image/fetch/$s_!lSnV!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif 1272w, https://substackcdn.com/image/fetch/$s_!lSnV!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lSnV!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif" width="480" height="480" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:480,&quot;width&quot;:480,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7803418,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lSnV!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif 424w, https://substackcdn.com/image/fetch/$s_!lSnV!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif 848w, https://substackcdn.com/image/fetch/$s_!lSnV!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif 1272w, https://substackcdn.com/image/fetch/$s_!lSnV!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67806323-8070-4e45-a1df-5edbf398f0df_480x480.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;giphy.com</figcaption></figure></div><h2>&#20160;&#40636;&#26159;&#32645;&#21513;&#26031;&#36852;&#27512;</h2><p>&#22312;<a href="https://datainpoint.substack.com/p/week-forty-two-gradient-descent">&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#26799;&#24230;&#36958;&#28187;</a>&#19968;&#25991;&#20013;&#25105;&#20497;&#25552;&#21040;&#20102;&#26799;&#24230;&#36958;&#28187;&#65288;gradient descent&#65289;&#65292;&#36889;&#26159;&#19968;&#31278;&#20197;&#22810;&#27425;&#36845;&#20195;&#30340;&#26041;&#24335;&#20778;&#21270;&#27402;&#37325;&#21521;&#37327;&#65292;&#36914;&#32780;&#20197;&#20778;&#21270;&#36942;&#24460;&#30340;&#27402;&#37325;&#21521;&#37327;&#29983;&#25104; h &#20989;&#25976;&#30340;&#23416;&#32722;&#28436;&#31639;&#27861;&#65288;learning algorithm&#65289;&#65292;&#20063;&#26159;&#25105;&#20497;&#22312;&#27231;&#22120;&#23416;&#32722;&#31995;&#21015;&#25991;&#31456;&#20013;&#65292;&#32380;&#31532;&#19968;&#20491;&#23416;&#32722;&#28436;&#31639;&#27861;&#27491;&#35215;&#26041;&#31243;&#24335;&#65288;normal equations&#65289;&#20043;&#24460;&#25152;&#23416;&#26371;&#30340;&#31532;&#20108;&#20491;&#23416;&#32722;&#28436;&#31639;&#27861;&#12290;</p><p>&#31532;&#19968;&#20491;&#23416;&#32722;&#28436;&#31639;&#27861;&#65306;&#27491;&#35215;&#26041;&#31243;&#24335;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\hat{y} = h(X) = Xw \\; \\text{,where} \\; X \\in \\mathbb{R^{m \\times n}} \\\\\nw = \\left( X^\\top X \\right)^{-1} X^\\top y \\; \\text{,where} \\; w \\in \\mathbb{R}^n ;\\ y \\in \\mathbb{R}^m\n\\end{align}&quot;,&quot;id&quot;:&quot;SSQGJYZDVP&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#31532;&#20108;&#20491;&#23416;&#32722;&#28436;&#31639;&#27861;&#65306;&#26799;&#24230;&#36958;&#28187;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\n\\text{For each epoch:} \\\\\nw := w - \\eta \\nabla_w J(w) \\; \\text{, where } \\eta \\in \\mathbb{R}^+ \n\\end{gather}&quot;,&quot;id&quot;:&quot;WPFHPMJRAA&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#22312;&#20808;&#21069;&#20171;&#32057;&#36889;&#20841;&#20491;&#23416;&#32722;&#28436;&#31639;&#27861;&#30340;&#25991;&#31456;&#20013;&#65292;&#25105;&#20497;&#30340;&#25104;&#26412;&#20989;&#25976;&#65288;cost function&#65289;&#37117;&#26159;&#20197;&#22343;&#26041;&#35492;&#24046;&#65288;mean square error&#65289;&#28858;&#20363;&#65292;&#35336;&#31639;&#22343;&#26041;&#35492;&#24046;&#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#20559;&#24494;&#20998;&#65292;&#29554;&#24471;&#26799;&#24230;&#30340;&#20540;&#65292;&#20358;&#22238;&#25512;&#26799;&#24230;&#28858;&#38646;&#30340;&#27402;&#37325;&#21521;&#37327;&#35299;&#65292;&#25110;&#32773;&#20197;&#26799;&#24230;&#20056;&#19978;&#23416;&#32722;&#36895;&#29575;&#65288;learning rate&#65289;&#20358;&#24471;&#30693;&#22312;&#35442;&#27425;&#36845;&#20195;&#20013;&#27402;&#37325;&#21521;&#37327;&#25033;&#35442;&#34987;&#26356;&#26032;&#30340;&#26041;&#21521;&#33287;&#37327;&#20540;&#12290;</p><p>&#37027;&#40636;&#30070;&#25104;&#26412;&#20989;&#25976;&#19981;&#26159;&#22343;&#26041;&#35492;&#24046;&#30340;&#26178;&#20505;&#21602;&#65311;&#22343;&#26041;&#35492;&#24046;&#26159;&#36852;&#27512;&#30340;&#23416;&#32722;&#28436;&#31639;&#26041;&#27861;&#26368;&#28858;&#27867;&#29992;&#30340;&#25104;&#26412;&#20989;&#25976;&#65292;&#32780;&#20132;&#21449;&#29109;&#65288;cross entropy&#65289;&#21063;&#26159;&#20998;&#39006;&#30340;&#26368;&#28858;&#27867;&#29992;&#30340;&#25104;&#26412;&#20989;&#25976;&#65292;&#32645;&#21513;&#26031;&#36852;&#27512;&#65288;logistic regression&#65289;&#23601;&#26159;&#19968;&#31278;&#22522;&#26044;&#20132;&#21449;&#29109;&#20316;&#28858;&#25104;&#26412;&#20989;&#25976;&#12289;Sigmoid &#20989;&#25976;&#20316;&#28858;&#27963;&#21270;&#20989;&#25976;&#65288;activation function&#65289;&#30340;&#20998;&#39006;&#23416;&#32722;&#28436;&#31639;&#27861;&#65292;&#38614;&#28982;&#23427;&#30340;&#21629;&#21517;&#20013;&#26377;&#36852;&#27512;&#65288;regression&#65289;&#65292;&#20294;&#20854;&#23526;&#26159;&#39006;&#21029;&#38928;&#28204;&#30340;&#27169;&#22411;&#65292;&#32780;&#38750;&#25976;&#20540;&#38928;&#28204;&#30340;&#27169;&#22411;&#12290;</p><h2>&#20132;&#21449;&#29109;</h2><p>&#20132;&#21449;&#29109;&#26159;&#19968;&#31278;&#22522;&#26044;&#23565;&#25976;&#20989;&#25976;&#33287;&#20998;&#39006;&#27231;&#29575;&#25152;&#35373;&#35336;&#32780;&#25104;&#30340;&#25104;&#26412;&#20989;&#25976;&#65292;&#23427;&#21033;&#29992;&#20102;&#22312;&#23565;&#25976;&#20989;&#25976;&#21069;&#38754;&#21152;&#19978;&#19968;&#20491;&#36000;&#34399;&#65292;&#36948;&#25104;&#20998;&#39006;&#23416;&#32722;&#28436;&#31639;&#27861;&#30340;&#26680;&#24515;&#30446;&#30340;&#65306;&#37679;&#35492;&#20998;&#39006;&#26371;&#36896;&#25104;&#24456;&#22823;&#30340;&#25104;&#26412;&#65292;&#27491;&#30906;&#20998;&#39006;&#26371;&#36896;&#25104;&#24456;&#20302;&#30340;&#25104;&#26412;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{equation}\n  J(\\hat{p_i})=\\begin{cases}\n   -log(1 - \\hat{p_i}), &amp; \\text{if $y_i = 0$}.\\\\\n   -log(\\hat{p_i}), &amp; \\text{if $y_i = 1$}.\n  \\end{cases}\n\\end{equation}&quot;,&quot;id&quot;:&quot;FSGHJMOCCD&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#22312;&#23565;&#25033;&#30446;&#27161;&#21521;&#37327;&#30340;&#31532; i &#20491;&#20803;&#32032;&#28858; 0 &#26178;&#65292;&#27169;&#22411;&#33509;&#36664;&#20986;&#24494;&#23567;&#30340;&#27231;&#29575; epsilon &#34920;&#31034;&#27491;&#30906;&#38928;&#28204;&#65292;&#27492;&#26178;&#36000;&#23565;&#25976;&#20989;&#25976;&#30340;&#20540;&#28858; -log(1 - epsilon) &#25509;&#36817;&#26044;&#38646;&#65307;&#27169;&#22411;&#33509;&#36664;&#20986;&#26997;&#39640;&#30340;&#27231;&#29575; 1 - epsilon &#34920;&#31034;&#37679;&#35492;&#38928;&#28204;&#65292;&#27492;&#26178;&#36000;&#23565;&#25976;&#20989;&#25976;&#30340;&#20540;&#28858; -log(epsilon) &#25509;&#36817;&#26044;&#28961;&#38480;&#22823;&#12290;</p><p>&#22312;&#23565;&#25033;&#30446;&#27161;&#21521;&#37327;&#30340;&#31532; i &#20491;&#20803;&#32032;&#28858; 1 &#26178;&#65292;&#27169;&#22411;&#33509;&#36664;&#20986;&#24494;&#23567;&#30340;&#27231;&#29575; epsilon &#34920;&#31034;&#37679;&#35492;&#38928;&#28204;&#65292;&#27492;&#26178;&#36000;&#23565;&#25976;&#20989;&#25976;&#30340;&#20540;&#28858; -log(epsilon) &#25509;&#36817;&#26044;&#28961;&#38480;&#22823;&#65307;&#27169;&#22411;&#33509;&#36664;&#20986;&#26997;&#39640;&#30340;&#27231;&#29575; 1 - epsilon &#34920;&#31034;&#27491;&#30906;&#38928;&#28204;&#65292;&#27492;&#26178;&#36000;&#23565;&#25976;&#20989;&#25976;&#30340;&#20540;&#28858; -log(1 - epsilon) &#25509;&#36817;&#26044;&#38646;&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6Sie!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6Sie!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png 424w, https://substackcdn.com/image/fetch/$s_!6Sie!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png 848w, https://substackcdn.com/image/fetch/$s_!6Sie!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png 1272w, https://substackcdn.com/image/fetch/$s_!6Sie!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6Sie!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png" width="763" height="375" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/127d4f12-874e-42db-b359-f563d88d04df_763x375.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:375,&quot;width&quot;:763,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34121,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6Sie!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png 424w, https://substackcdn.com/image/fetch/$s_!6Sie!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png 848w, https://substackcdn.com/image/fetch/$s_!6Sie!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png 1272w, https://substackcdn.com/image/fetch/$s_!6Sie!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F127d4f12-874e-42db-b359-f563d88d04df_763x375.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>&#34249;&#30001;&#36889;&#20841;&#20491;&#36000;&#23565;&#25976;&#20989;&#25976;&#30340;&#29305;&#24615;&#65292;&#25105;&#20497;&#21487;&#20197;&#23559;&#23427;&#20497;&#21512;&#32780;&#28858;&#19968;&#65292;&#25104;&#28858;&#20132;&#21449;&#29109;&#20989;&#25976;&#65292;&#30070;&#25105;&#20497;&#23559; y_i &#20998;&#21029;&#20197; 0 &#25110; 1 &#24118;&#20837;&#26178;&#65292;&#23601;&#21487;&#20197;&#21508;&#33258;&#24471;&#21040;&#21407;&#26412;&#30340;&#20841;&#20491;&#36000;&#23565;&#25976;&#20989;&#25976;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{equation}\n  J(\\hat{p})= \\frac{1}{m} \\left( \\sum_i^m -(1-y_i)log(1 - \\hat{p_i})- y_i log(\\hat{p_i}) \\right)\n\\end{equation}&quot;,&quot;id&quot;:&quot;UJKQRHOSNU&quot;}" data-component-name="LatexBlockToDOM"></div><h2>Sigmoid &#20989;&#25976;</h2><p>&#30001;&#26044;&#29305;&#24501;&#30697;&#38499;&#21644;&#27402;&#37325;&#21521;&#37327;&#20013;&#20803;&#32032;&#30456;&#20056;&#30456;&#21152;&#30340;&#32080;&#26524;&#26159;&#36899;&#32396;&#20540;&#30340;&#32218;&#24615;&#20989;&#25976;&#65292;&#33509;&#24819;&#23559;&#20854;&#36681;&#25563;&#28858;&#27231;&#29575;&#30340;&#36664;&#20986;&#65292;&#23601;&#38656;&#35201;&#20208;&#36084; Sigmoid &#20989;&#25976;&#65292;&#35442;&#20989;&#25976;&#26159;&#19968;&#20491;&#23559;&#36899;&#32396;&#20540;&#36664;&#20837;&#26144;&#23556;&#33267; [0, 1] &#31684;&#22285;&#30340;&#27963;&#21270;&#20989;&#25976;&#65292;&#30001;&#33258;&#28982;&#23565;&#25976;&#30340;&#24213;&#25976; e&#65288;Euler&#8217;s constant&#65289;&#25152;&#32068;&#25104;&#65292;&#20063;&#34987;&#31281;&#20316;&#32645;&#21513;&#26031;&#20989;&#25976;&#65288;logistic function&#65289;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\sigma(x) = \\frac{1}{1 + e^{-x}} \\\\\n\\hat{p_i} = \\sigma(x_iw_i)\n\\end{align}&quot;,&quot;id&quot;:&quot;VALCIDEWZD&quot;}" data-component-name="LatexBlockToDOM"></div><p>Sigmoid &#20989;&#25976;&#22312;&#36664;&#20837;&#36899;&#32396;&#20540;&#24456;&#23567;&#65288;&#36000;&#28961;&#38480;&#22823;&#65289;&#30340;&#24773;&#27841;&#19979;&#65292;&#26371;&#24471;&#21040;&#19968;&#20491;&#25509;&#36817;&#26044;&#38646;&#30340;&#36664;&#20986;&#65307;&#22312;&#36664;&#20837;&#36899;&#32396;&#20540;&#24688;&#24039;&#31561;&#26044; 1 &#30340;&#24773;&#27841;&#19979;&#65292;&#26371;&#24471;&#21040;&#21083;&#22909;&#31561;&#26044; 0.5 &#30340;&#36664;&#20986;&#65307;&#22312;&#36664;&#20837;&#36899;&#32396;&#20540;&#24456;&#22823;&#65288;&#28961;&#38480;&#22823;&#65289;&#30340;&#24773;&#27841;&#19979;&#65292;&#26371;&#24471;&#21040;&#19968;&#20491;&#25509;&#36817;&#26044; 1 &#30340;&#36664;&#20986;&#65292;&#22240;&#27492;&#26159;&#19968;&#31278;&#23559;&#36899;&#32396;&#20540;&#36664;&#20837;&#36681;&#25563;&#28858;&#27231;&#29575;&#20540;&#30340;&#27963;&#21270;&#20989;&#25976;&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qTmJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qTmJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png 424w, https://substackcdn.com/image/fetch/$s_!qTmJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png 848w, https://substackcdn.com/image/fetch/$s_!qTmJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png 1272w, https://substackcdn.com/image/fetch/$s_!qTmJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qTmJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png" width="689" height="509" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:509,&quot;width&quot;:689,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:45538,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qTmJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png 424w, https://substackcdn.com/image/fetch/$s_!qTmJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png 848w, https://substackcdn.com/image/fetch/$s_!qTmJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png 1272w, https://substackcdn.com/image/fetch/$s_!qTmJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e13dc66-0985-4f8f-ad8a-4cfaa219ddc1_689x509.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>&#32645;&#21513;&#26031;&#36852;&#27512;</h2><p>&#22312;&#20351;&#29992;&#20132;&#21449;&#29109;&#20316;&#28858;&#25104;&#26412;&#20989;&#25976;&#12289;Sigmoid &#20989;&#25976;&#20316;&#28858;&#27963;&#21270;&#20989;&#25976;&#30340;&#24773;&#27841;&#19979;&#65292;&#25105;&#20497;&#33021;&#22816;&#20197;&#26799;&#24230;&#36958;&#28187;&#30340;&#23416;&#32722;&#28436;&#31639;&#26041;&#27861;&#27714;&#24471;&#27402;&#37325;&#21521;&#37327;&#65292;&#36889;&#20415;&#26159;&#32645;&#21513;&#26031;&#36852;&#27512;&#30340;&#20108;&#20803;&#20998;&#39006;&#27169;&#22411;&#65292;&#20854;&#21629;&#21517;&#30001;&#20358;&#32645;&#21513;&#26031;&#65288;logistic&#65289;&#23601;&#26159;&#22240;&#28858; Sigmoid &#20989;&#25976;&#20063;&#34987;&#31281;&#28858; Logistic &#20989;&#25976;&#30340;&#21407;&#22240;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\nz = Xw \\\\\n\\hat{p} = \\sigma(z) \\text{, where } \\sigma(x) = \\frac{1}{1 + e^{-x}} \\\\\nJ(\\hat{p}) = \\frac{1}{m} \\left( -ylog(\\hat{p}) - (1-y)log(1-\\hat{p}) \\right) \\\\\nJ(w) = \\frac{1}{m} \\left( -ylog(\\sigma(Xw)) - (1-y)log(1-\\sigma(Xw)) \\right)\n\\end{gather}&quot;,&quot;id&quot;:&quot;AESTVICKOS&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#20877;&#36879;&#36942;&#26799;&#24230;&#36958;&#28187;&#30340;&#23416;&#32722;&#28436;&#31639;&#26041;&#27861;&#27714;&#35299;&#27402;&#37325;&#21521;&#37327;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\n\\text{For each epoch:} \\\\\nw := w - \\eta \\nabla_w J(w) \\; \\text{, where } \\eta \\in \\mathbb{R}^+ \n\\end{gather}&quot;,&quot;id&quot;:&quot;THBSEVEPDY&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#19979;&#19968;&#31687;&#25991;&#31456;&#65292;&#25105;&#20497;&#23601;&#35201;&#25509;&#33879;&#25512;&#23566;&#20197;&#20132;&#21449;&#29109;&#20316;&#28858;&#25104;&#26412;&#20989;&#25976; J &#38364;&#26044;&#27402;&#37325;&#21521;&#37327;&#30340;&#26799;&#24230;&#65292;&#31532;&#22235;&#21313;&#19977;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#32645;&#21513;&#26031;&#36852;&#27512;&#65288;&#19978;&#65289;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#20998;&#20139;&#128588;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one/comments"><span>Leave a comment</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#21487;&#20197;&#40670;&#36984;&#19979;&#21015;&#36899;&#32080;&#35079;&#35069;&#23436;&#25972;&#30340;&#20839;&#23481;&#33287;&#31243;&#24335;&#30908;&#21040;&#33258;&#24049;&#30340; Google Drive &#20043;&#20013;&#12290;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/week-forty-three-logistic-regression-part-one">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：梯度遞減]]></title><description><![CDATA[&#31532;&#22235;&#21313;&#20108;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-forty-two-gradient-descent</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-forty-two-gradient-descent</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Tue, 04 Jun 2024 13:01:12 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!yKFi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yKFi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yKFi!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif 424w, https://substackcdn.com/image/fetch/$s_!yKFi!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif 848w, https://substackcdn.com/image/fetch/$s_!yKFi!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif 1272w, https://substackcdn.com/image/fetch/$s_!yKFi!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yKFi!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif" width="640" height="640" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:640,&quot;width&quot;:640,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7986159,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yKFi!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif 424w, https://substackcdn.com/image/fetch/$s_!yKFi!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif 848w, https://substackcdn.com/image/fetch/$s_!yKFi!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif 1272w, https://substackcdn.com/image/fetch/$s_!yKFi!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8deb47b7-e637-415c-aabc-8863854b0bb9_640x640.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://giphy.com">giphy.com</a></figcaption></figure></div><h2>&#20160;&#40636;&#26159;&#26799;&#24230;&#36958;&#28187;</h2><p>&#22312;<a href="https://datainpoint.substack.com/p/week-forty-one-normal-equations">&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#27491;&#35215;&#26041;&#31243;&#24335;</a>&#19968;&#25991;&#20013;&#25105;&#20497;&#25552;&#21040;&#20102;&#27491;&#35215;&#26041;&#31243;&#24335;&#65288;normal equations&#65289;&#65292;&#36889;&#26159;&#38754;&#23565;&#36852;&#27512;&#30340;&#27231;&#22120;&#23416;&#32722;&#20219;&#21209;&#26178;&#30340;&#20989;&#25976;&#29983;&#25104;&#26041;&#27861;&#65292;&#20063;&#26159;&#25105;&#20497;&#22312;&#27231;&#22120;&#23416;&#32722;&#31995;&#21015;&#25991;&#31456;&#20013;&#25152;&#23416;&#26371;&#30340;&#31532;&#19968;&#20491;&#23416;&#32722;&#28436;&#31639;&#27861;&#65288;learning algorithm&#65289;&#12290;&#22312;&#36039;&#26009;&#38598;&#32102;&#23450;&#29305;&#24501;&#30697;&#38499;&#33287;&#30446;&#27161;&#21521;&#37327;&#65292;&#20197;&#21450;&#36939;&#29992;&#22343;&#26041;&#35492;&#24046;&#65288;mean square error&#65289;&#20316;&#28858;&#25928;&#33021;&#35413;&#20272;&#30340;&#21069;&#25552;&#19979;&#65292;&#25105;&#20497;&#33021;&#22816;&#35336;&#31639;&#27402;&#37325;&#21521;&#37327;&#65292;&#36914;&#32780;&#29983;&#25104; h &#20989;&#25976;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\hat{y} = h(X) = Xw \\; \\text{,where} \\; X \\in \\mathbb{R^{m \\times n}} \\\\\nw = \\left( X^\\top X \\right)^{-1} X^\\top y \\; \\text{,where} \\; w \\in \\mathbb{R}^n ;\\ y \\in \\mathbb{R}^m\n\\end{align}&quot;,&quot;id&quot;:&quot;NPHVLNMPAO&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#19981;&#36942;&#65292;&#20006;&#38750;&#25152;&#26377;&#21069;&#25552;&#30456;&#21516;&#30340;&#21839;&#38988;&#20197;&#27491;&#35215;&#26041;&#31243;&#24335;&#27714;&#35299;&#27402;&#37325;&#21521;&#37327;&#37117;&#26159;&#26368;&#26377;&#25928;&#29575;&#30340;&#20316;&#27861;&#65292;&#21407;&#22240;&#26159;&#22312;&#27491;&#35215;&#26041;&#31243;&#24335;&#20013;&#65292;&#24517;&#38920;&#35201;&#27714;&#35299;&#36681;&#32622;&#29305;&#24501;&#30697;&#38499;&#21644;&#29305;&#24501;&#30697;&#38499;&#30456;&#20056;&#24460;&#30340;&#21453;&#30697;&#38499;&#65292;&#36681;&#32622;&#29305;&#24501;&#30697;&#38499;&#30340;&#22806;&#22411;&#28858; (n, m)&#65292;&#32780;&#29305;&#24501;&#30697;&#38499;&#30340;&#22806;&#22411;&#28858; (m, n)&#65292;&#20841;&#32773;&#30456;&#20056;&#20043;&#24460;&#30340;&#30697;&#38499;&#22806;&#22411;&#28858; (n, n)&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\nX^\\top \\in \\mathbb{R^{n \\times m}} \\\\\nX \\in \\mathbb{R^{m \\times n }} \\\\\n\\left( X^\\top X \\right)^{-1} \\in \\mathbb{R^{n \\times n}}\n\\end{align}&quot;,&quot;id&quot;:&quot;ZVZPAQBVWV&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#27714;&#35299;&#19968;&#20491;&#22806;&#22411;&#28858; (n, n) &#30340;&#21453;&#30697;&#38499;&#65292;&#27161;&#28310;&#30340;&#26178;&#38291;&#35336;&#31639;&#35079;&#38620;&#24230;&#26159;&#22823; O &#31526;&#34399; n &#30340;&#31435;&#26041; O(n^3)&#65292;&#22240;&#27492;&#30070;&#29305;&#24501;&#30697;&#38499;&#30340;&#35722;&#25976;&#22686;&#21152; 10 &#20493;&#26178;&#65292;&#25152;&#38656;&#35201;&#30340;&#35336;&#31639;&#26178;&#38291;&#20006;&#19981;&#26159;&#22686;&#21152; 10 &#20493;&#65292;&#32780;&#26159;&#22686;&#21152; 1000 &#20493;&#65292;&#28858;&#27492;&#22312;&#22240;&#25033; n &#24456;&#22823;&#30340;&#29376;&#27841;&#26178;&#65292;&#25105;&#20497;&#26371;&#25913;&#29992;&#31532;&#20108;&#20491;&#23416;&#32722;&#28436;&#31639;&#27861;&#65306;&#26799;&#24230;&#36958;&#28187;&#65288;gradient descent&#65289;&#12290;&#20854;&#20013;&#26799;&#24230;&#65288;gradient&#65289;&#25351;&#30340;&#26159;&#22312;&#21521;&#37327;&#23565;&#20989;&#25976;&#30340;&#20559;&#24494;&#20998;&#65292;&#23565;&#25033;&#23566;&#25976;&#65288;derivative&#65289;&#25351;&#30340;&#26159;&#32020;&#37327;&#23565;&#20989;&#25976;&#30340;&#20559;&#24494;&#20998;&#12290;<br>&#26799;&#24230;&#36958;&#28187;&#25351;&#30340;&#26159;&#65292;&#22312;&#36039;&#26009;&#38598;&#32102;&#23450;&#29305;&#24501;&#30697;&#38499;&#33287;&#30446;&#27161;&#21521;&#37327;&#65292;&#19988;&#25928;&#33021;&#35413;&#20272;&#30340;&#20989;&#25976;&#21487;&#20197;&#20570;&#26368;&#23567;&#21270;&#25110;&#26368;&#22823;&#21270;&#30340;&#21069;&#25552;&#19979;&#65292;&#25105;&#20497;&#33021;&#22816;&#20197;&#22810;&#27425;&#36845;&#20195;&#30340;&#26041;&#24335;&#20778;&#21270;&#27402;&#37325;&#21521;&#37327;&#65292;&#36914;&#32780;&#20197;&#20778;&#21270;&#36942;&#24460;&#30340;&#27402;&#37325;&#21521;&#37327;&#29983;&#25104; h &#20989;&#25976;&#12290;&#20854;&#20013; w &#26159;&#38568;&#27231;&#29983;&#25104;&#30340;&#27402;&#37325;&#21521;&#37327;&#65292;J &#20989;&#25976;&#26159;&#25104;&#26412;&#20989;&#25976;&#65288;cost function&#65289;&#65292;&#20063;&#23601;&#26159;&#29992;&#20358;&#36914;&#34892;&#25928;&#33021;&#35413;&#20272;&#30340;&#20989;&#25976;&#65292;&#26377;&#26178;&#20063;&#23531;&#20570; L &#20989;&#25976;&#21363;&#25613;&#22833;&#20989;&#25976;&#65288;loss function&#65289;&#65292;&#32780; epsilon &#21063;&#26159;&#19968;&#20491;&#27491;&#30340;&#32020;&#37327;&#65292;&#31281;&#20316;&#23416;&#32722;&#36895;&#29575;&#65288;learning rate&#65289;&#65292;&#26159;&#19968;&#20491;&#27770;&#23450;&#20778;&#21270;&#24133;&#24230;&#30340;&#27491;&#25976;&#32020;&#37327;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{flalign}\n&amp;\\text{For each epoch:} \\\\\n&amp;w := w - \\epsilon \\nabla_w J(w) \\; \\text{, where } \\epsilon \\in \\mathbb{R}^+ \n\\end{flalign}&quot;,&quot;id&quot;:&quot;CFKBHEANVM&quot;}" data-component-name="LatexBlockToDOM"></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3wLL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3wLL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png 424w, https://substackcdn.com/image/fetch/$s_!3wLL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png 848w, https://substackcdn.com/image/fetch/$s_!3wLL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png 1272w, https://substackcdn.com/image/fetch/$s_!3wLL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3wLL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png" width="994" height="750" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:750,&quot;width&quot;:994,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:144120,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3wLL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png 424w, https://substackcdn.com/image/fetch/$s_!3wLL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png 848w, https://substackcdn.com/image/fetch/$s_!3wLL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png 1272w, https://substackcdn.com/image/fetch/$s_!3wLL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd5b3ebb-4fad-4fbb-9c5a-9c22490883de_994x750.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>&#19978;&#22294;&#20013;&#30340;&#34253;&#33394;&#34395;&#32218;&#25551;&#32362;&#19968;&#20491;&#25104;&#26412;&#20989;&#25976; f&#65292;&#32160;&#33394;&#23526;&#32218;&#25551;&#32362;&#35442;&#20989;&#25976;&#30340;&#23566;&#25976;&#65292;&#23565;&#26044; x &lt; 0 &#30340;&#37096;&#20998;&#23566;&#25976;&#28858;&#36000;&#65292;&#25152;&#20197; x &#26371;&#21521;&#21491;&#31227;&#21205;&#65307;&#23565;&#26044; x &gt; 0 &#30340;&#37096;&#20998;&#23566;&#25976;&#28858;&#27491;&#65292;&#25152;&#20197; x &#26371;&#21521;&#24038;&#31227;&#21205;&#65307;&#23565;&#26044; x = 0 &#30340;&#37096;&#20998;&#23566;&#25976;&#28858;&#38646;&#65292;x &#19981;&#31227;&#21205;&#12290;</p><h2>&#25928;&#33021;&#35413;&#20272;</h2><p>&#20197;&#22343;&#26041;&#35492;&#24046;&#65288;mean square error&#65289;&#20316;&#28858;&#25104;&#26412;&#20989;&#25976; J &#20358;&#30070;&#20363;&#23376;&#65292;&#25105;&#20497;&#21487;&#20197;&#25512;&#23566;&#26799;&#24230;&#30340;&#34920;&#31034;&#24335;&#22914;&#19979;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\text{Let } J(w) &amp;= MSE \\\\\n&amp;= \\frac{1}{m}  || \\hat{y} - y ||^2 \\\\\n&amp;= \\frac{1}{m} || h(X) - y ||^2\n\\end{align}&quot;,&quot;id&quot;:&quot;CEKBJYYUGN&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\nabla_wJ(w) &amp;= \\nabla_w \\left( \\frac{1}{m} || h(X) - y ||^2 \\right)  \\\\\n&amp;= \\frac{1}{m} \\nabla_w|| Xw - y ||^2 \\\\\n&amp;= \\frac{1}{m} \\nabla_w \\left( Xw - y \\right)^\\top\\left( Xw - y \\right) \\\\\n&amp;= \\frac{1}{m} \\nabla_w \\left( w^\\top X^\\top Xw - 2w^\\top X^\\top y + y^\\top y \\right) \\\\\n&amp;= \\frac{1}{m} \\left( 2X^\\top X w - 2X^\\top y \\right) \\\\\n&amp;= \\frac{2}{m} X^\\top \\left(Xw - y\\right) \\\\\n&amp;= \\frac{2}{m} X^\\top \\left(\\hat{y} - y\\right)\n\\end{align}&quot;,&quot;id&quot;:&quot;TTJLKWJWMR&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#22240;&#27492;&#65292;&#30070;&#20197;&#22343;&#26041;&#35492;&#24046;&#20316;&#28858;&#25104;&#26412;&#20989;&#25976;&#26178;&#65292;&#25105;&#20497;&#21487;&#20197;&#23559;&#26799;&#24230;&#36958;&#28187;&#30340;&#27867;&#22411;&#24335;&#34920;&#31034;&#22914;&#19979;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n&amp;\\text{For each epoch:} \\\\\n&amp;w := w - \\epsilon \\frac{2}{m} X^\\top \\left(\\hat{y} - y\\right) \\; \\text{, where } \\epsilon \\in \\mathbb{R}^+\n\\end{align}&quot;,&quot;id&quot;:&quot;TVUJHJOMJK&quot;}" data-component-name="LatexBlockToDOM"></div><h2>&#20197; Numpy &#23526;&#20316;&#26799;&#24230;&#36958;&#28187;</h2><p>&#25104;&#21151;&#25512;&#23566;&#20986;&#27491;&#35215;&#26041;&#31243;&#24335;&#20043;&#24460;&#65292;&#26368;&#24460;&#25105;&#20497;&#23531;&#20316;&#19968;&#20491;&#39006;&#21029; GradientDescent&#65292;&#20197; Python &#33287; Numpy &#27169;&#32068;&#23526;&#20316;&#65292;&#22312;&#32102;&#23450;&#36969;&#30070;&#36039;&#26009;&#38598;&#30340;&#29305;&#24501;&#30697;&#38499;&#33287;&#30446;&#27161;&#21521;&#37327;&#65292;&#33021;&#22816;&#36845;&#20195;&#20778;&#21270;&#38568;&#27231;&#29983;&#25104;&#30340;&#27402;&#37325;&#21521;&#37327;&#65292;&#36914;&#32780;&#29983;&#25104; h &#20989;&#25976;&#12290;&#23526;&#20316;&#36942;&#31243;&#20013;&#25105;&#20497;&#26371;&#29992;&#21040; Numpy &#27169;&#32068;&#30340; np.transpose() &#25110; ndarray &#30340; T &#23660;&#24615;&#20358;&#29983;&#25104;&#36681;&#32622;&#30697;&#38499;&#12289;np.dot() &#25110; ndarray &#30340; dot() &#26041;&#27861;&#20358;&#35336;&#31639;&#21521;&#37327;&#33287;&#30697;&#38499;&#30340;&#30456;&#20056;&#12290;</p><pre><code><code>class GradientDescent:
    def fit(self, X_train, y_train):
        # ...
    def predict(self, X_test):
        # ...</code></code></pre><p>GradientDescent &#39006;&#21029;&#30340;&#20351;&#29992;&#26159;&#20197; fit() &#26041;&#27861;&#29983;&#25104;&#27402;&#37325;&#21521;&#37327;&#65292;&#20006;&#20197; predict() &#26041;&#27861;&#29983;&#25104;&#38928;&#28204;&#12290;&#25105;&#20497;&#21487;&#20197;&#23559; GradientDescent &#39006;&#21029;&#25033;&#29992;&#22312; Kaggle &#30340; House Prices &#36039;&#26009;&#38598;&#65292;&#34249;&#27492;&#20358;&#39511;&#35657;&#23427;&#30340;&#21487;&#29992;&#24615;&#12290;</p><pre><code><code>train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
X_train = train["OverallQual"].values.reshape(-1, 1)
y_train = train["SalePrice"].values
X_test = test["OverallQual"].values.reshape(-1, 1)
gradient_descent = GradientDescent()
gradient_descent.fit(X_train, y_train)
y_pred = gradient_descent.predict(X_test)</code></code></pre><p>&#31532;&#22235;&#21313;&#20108;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#26799;&#24230;&#36958;&#28187;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#20998;&#20139;&#128588;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-two-gradient-descent?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-two-gradient-descent?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-two-gradient-descent/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-two-gradient-descent/comments"><span>Leave a comment</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#21487;&#20197;&#40670;&#36984;&#19979;&#21015;&#36899;&#32080;&#35079;&#35069;&#23436;&#25972;&#30340;&#20839;&#23481;&#33287;&#31243;&#24335;&#30908;&#21040;&#33258;&#24049;&#30340; Google Drive &#20043;&#20013;&#12290;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/week-forty-two-gradient-descent">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：正規方程式]]></title><description><![CDATA[&#31532;&#22235;&#21313;&#19968;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-forty-one-normal-equations</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-forty-one-normal-equations</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Sun, 12 May 2024 13:01:37 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f1f314f8-1654-4d80-95e3-866a6aefd5db_450x282.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3afT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3afT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif 424w, https://substackcdn.com/image/fetch/$s_!3afT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif 848w, https://substackcdn.com/image/fetch/$s_!3afT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif 1272w, https://substackcdn.com/image/fetch/$s_!3afT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3afT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif" width="450" height="282" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:282,&quot;width&quot;:450,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:791577,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3afT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif 424w, https://substackcdn.com/image/fetch/$s_!3afT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif 848w, https://substackcdn.com/image/fetch/$s_!3afT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif 1272w, https://substackcdn.com/image/fetch/$s_!3afT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0e52218-4e56-43c8-9355-6de4371c3e8a_450x282.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">  &#20358;&#28304;&#65306;<a href="https://giphy.com">giphy.com</a></figcaption></figure></div><h2>&#20160;&#40636;&#26159;&#27491;&#35215;&#26041;&#31243;&#24335;</h2><p>&#22312;<a href="https://datainpoint.substack.com/p/week-fourty-getting-started-with-machinelearning">&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#27231;&#22120;&#23416;&#32722;&#22522;&#30990;</a>&#19968;&#25991;&#20013;&#25105;&#20497;&#25552;&#21040;&#20102;&#24120;&#35211;&#30340;&#27231;&#22120;&#23416;&#32722;&#20219;&#21209;&#65292;&#20854;&#20013;&#19968;&#38917;&#32819;&#29087;&#33021;&#35443;&#30340;&#12300;&#36852;&#27512;&#12301;&#20854;&#20219;&#21209;&#25551;&#36848;&#26159;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#36039;&#26009;&#38928;&#28204;&#26576;&#20491;&#25976;&#20540;&#65292;&#36664;&#20986;&#30340;&#36039;&#26009;&#28858;&#36899;&#32396;&#30340;&#24418;&#24335;&#12290;<br>&#25105;&#20497;&#21487;&#20197;&#23559;&#36852;&#27512;&#35222;&#28858;&#29702;&#35299;&#27231;&#22120;&#23416;&#32722;&#28436;&#31639;&#27861;&#30340;&#31532;&#19968;&#20491;&#37324;&#31243;&#30865;&#65292;&#27491;&#35215;&#26041;&#31243;&#24335;&#65288;normal equations&#65289;&#21063;&#26159;&#21332;&#21161;&#25105;&#20497;&#36948;&#21040;&#36889;&#20491;&#37324;&#31243;&#30865;&#30340;&#23416;&#32722;&#28436;&#31639;&#27861;&#65292;&#20063;&#23601;&#26159;&#38754;&#23565;&#36852;&#27512;&#30340;&#27231;&#22120;&#23416;&#32722;&#20219;&#21209;&#26178;&#30340;&#20989;&#25976;&#29983;&#25104;&#26041;&#27861;&#12290;&#35442;&#20989;&#25976;&#25105;&#20497;&#26283;&#19988;&#20197; h &#20989;&#25976;&#20316;&#28858;&#21629;&#21517;&#65292;&#24847;&#21363; hypothesis&#65292;h &#20989;&#25976;&#30340;&#36664;&#20837;&#24418;&#24335;&#28858;&#21521;&#37327;&#65292;&#36664;&#20986;&#24418;&#24335;&#28858;&#32020;&#37327;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\hat{y} = h(x) = x_0 + w_1x_1 + w_2x_2+...+w_nx_n&quot;,&quot;id&quot;:&quot;MOWUQHWNMT&quot;}" data-component-name="LatexBlockToDOM"></div><p>h &#20989;&#25976;&#30001;&#25130;&#36317;&#38917;&#12289;&#27402;&#37325;&#65288;&#25110;&#31281;&#20418;&#25976;&#65289;&#20197;&#21450;&#29305;&#24501;&#25152;&#32068;&#21512;&#32780;&#25104;&#65292;&#20854;&#20013;&#25130;&#36317;&#38917;&#12289;&#29305;&#24501;&#30001;&#36039;&#26009;&#38598;&#25552;&#20379;&#65292;&#27402;&#37325;&#21063;&#30001;&#27231;&#22120;&#23416;&#32722;&#28436;&#31639;&#27861;&#27770;&#23450;&#12290;&#36889;&#37002;&#25105;&#20497;&#35264;&#23519;&#21040;&#25130;&#36317;&#38917;&#21152;&#19978;&#27402;&#37325;&#30340;&#20491;&#25976;&#24688;&#24039;&#27604;&#29305;&#24501;&#20491;&#25976;&#22810;&#20986;&#19968;&#20491;&#65292;&#22914;&#26524;&#20491;&#25976;&#30456;&#21516;&#65292;&#23601;&#21487;&#20197;&#21270;&#28858;&#21521;&#37327;&#30456;&#20056;&#24418;&#24335;&#65292;&#22240;&#27492;&#21487;&#20197;&#28858;&#25130;&#36317;&#38917;&#37197;&#23565;&#19968;&#20491;&#31561;&#26044; 1 &#30340;&#27402;&#37325;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\hat{y} = h(x) &amp;= w_0x_0 + w_1x_1 + w_2x_2+...+w_nx_n \\; \\text{,where} \\; w_0 = 1 \\\\\n&amp;=w^\\top x \\; \\text{,where} \\; x \\in \\mathbb{R}^n\n\\end{align}&quot;,&quot;id&quot;:&quot;QVSITGNBCI&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#30070;&#36664;&#20837; h &#20989;&#25976;&#20677;&#26377;&#19968;&#20491;&#35264;&#28204;&#20540;&#30340;&#29305;&#24501;&#65292;&#36664;&#20837;&#24418;&#24335;&#28858;&#21521;&#37327;&#12289;&#36664;&#20986;&#24418;&#24335;&#28858;&#32020;&#37327;&#65307;&#30070;&#26377;&#22810;&#20491;&#35264;&#28204;&#20540;&#30340;&#29305;&#24501;&#26178;&#65292;&#36664;&#20837;&#24418;&#24335;&#28858;&#30697;&#38499;&#20854;&#23560;&#26377;&#21517;&#35422;&#31281;&#28858;&#29305;&#24501;&#30697;&#38499;&#65288;feature matrix&#65289;&#12289;&#36664;&#20986;&#24418;&#24335;&#28858;&#21521;&#37327;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\hat{y} = h(X) = Xw \\; \\text{,where} \\; X \\in \\mathbb{R^{m \\times n}}&quot;,&quot;id&quot;:&quot;GUNVLTDYVZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#32780;&#27491;&#35215;&#26041;&#31243;&#24335;&#25351;&#30340;&#23601;&#26159;&#65292;&#22312;&#36039;&#26009;&#38598;&#32102;&#23450;&#29305;&#24501;&#30697;&#38499;&#33287;&#30446;&#27161;&#21521;&#37327;&#65288;&#33287;&#27169;&#22411;&#36664;&#20986;&#30340;&#38928;&#28204;&#22806;&#22411;&#12289;&#26684;&#24335;&#22343;&#30456;&#21516;&#65292;&#20294;&#26159;&#20358;&#33258;&#26044;&#36039;&#26009;&#38598;&#20013;&#30495;&#23526;&#12289;&#24050;&#23526;&#29694;&#20043;&#25976;&#20540;&#65289;&#30340;&#21069;&#25552;&#19979;&#65292;&#25105;&#20497;&#23601;&#33021;&#22816;&#35336;&#31639;&#27402;&#37325;&#21521;&#37327;&#65292;&#36914;&#32780;&#29983;&#25104; h &#20989;&#25976;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;w = \\left( X^\\top X \\right)^{-1} X^\\top y \\; \\text{,where} \\; w \\in \\mathbb{R}^n ;\\ y \\in \\mathbb{R}^m&quot;,&quot;id&quot;:&quot;MSVQMNXJBX&quot;}" data-component-name="LatexBlockToDOM"></div><h2>&#27402;&#37325;&#21521;&#37327;</h2><p>&#27402;&#37325;&#21521;&#37327;&#65288;weights&#65289;&#26159;&#25511;&#21046;&#27169;&#22411;&#38928;&#28204;&#34892;&#28858;&#30340;&#20381;&#25818;&#65292;&#29992;&#20358;&#27770;&#23450;&#27599;&#20491;&#23565;&#25033;&#30340;&#29305;&#24501;&#23565;&#38928;&#28204;&#30340;&#24433;&#38911;&#31243;&#24230;&#12290;&#33509;&#26159;&#31532; i &#20491;&#29305;&#24501;&#23565;&#25033;&#20102;&#27491;&#27402;&#37325;&#65292;&#21063;&#22686;&#21152;&#27492;&#29305;&#24501;&#30340;&#20540;&#26371;&#25552;&#39640;&#38928;&#28204;&#20540;&#65292;&#24847;&#21363;&#23565;&#26044;&#35442;&#29305;&#24501;&#33287;&#38928;&#28204;&#28858;&#27491;&#30456;&#38364;&#65307;&#21453;&#20043;&#33509;&#26159;&#31532; i &#20491;&#29305;&#24501;&#23565;&#25033;&#20102;&#36000;&#27402;&#37325;&#65292;&#21063;&#22686;&#21152;&#27492;&#29305;&#24501;&#30340;&#20540;&#26371;&#38477;&#20302;&#38928;&#28204;&#20540;&#65292;&#24847;&#21363;&#23565;&#26044;&#35442;&#29305;&#24501;&#33287;&#38928;&#28204;&#28858;&#36000;&#30456;&#38364;&#65307;&#33509;&#26159;&#31532; i &#20491;&#29305;&#24501;&#30340;&#32085;&#23565;&#20540;&#22823;&#65292;&#37027;&#40636;&#35442;&#29305;&#24501;&#23565;&#26044;&#38928;&#28204;&#30340;&#24433;&#38911;&#21147;&#22823;&#65292;&#21453;&#20043;&#33509;&#26159;&#31532; i &#20491;&#29305;&#24501;&#30340;&#32085;&#23565;&#20540;&#36264;&#36817;&#26044;&#38646;&#65292;&#37027;&#40636;&#35442;&#29305;&#24501;&#23565;&#26044;&#38928;&#28204;&#27627;&#28961;&#24433;&#38911;&#21147;&#12290;<br>&#36879;&#36942;&#27491;&#35215;&#26041;&#31243;&#24335;&#25105;&#20497;&#21487;&#20197;&#35336;&#31639;&#20986;&#27402;&#37325;&#21521;&#37327;&#29983;&#25104; h &#20989;&#25976;&#65292;&#36914;&#32780;&#29554;&#24471;&#36664;&#20837;&#29305;&#24501;&#23565;&#25033;&#36664;&#20986;&#38928;&#28204;&#30340;&#27169;&#22411;&#12290;&#27491;&#35215;&#26041;&#31243;&#24335;&#21448;&#26159;&#22914;&#20309;&#25512;&#23566;&#32780;&#24471;&#65311;&#26412;&#25991;&#24050;&#32147;&#23559;&#12300;&#36852;&#27512;&#12301;&#30340;&#27231;&#22120;&#23416;&#32722;&#20219;&#21209;&#65288;task, T&#65289;&#23450;&#32681;&#24471;&#30456;&#30070;&#32048;&#33193;&#65306;&#22312;&#36039;&#26009;&#32102;&#23450;&#29305;&#24501;&#30697;&#38499;&#33287;&#30446;&#27161;&#21521;&#37327;&#30340;&#24773;&#27841;&#19979;&#29983;&#25104; h &#20989;&#25976;&#65292;&#35442; h &#20989;&#25976;&#33021;&#22816;&#36664;&#20837;&#29305;&#24501;&#23565;&#25033;&#36664;&#20986;&#38928;&#28204;&#12290;</p><h2>&#25928;&#33021;&#35413;&#20272;</h2><p>&#25509;&#33879;&#26159;&#23450;&#32681;&#25928;&#33021;&#35413;&#20272;&#65288;performance measure, P&#65289;&#65292;&#30070;&#25105;&#20497;&#36879;&#36942; h &#20989;&#25976;&#29554;&#24471;&#20102;&#38928;&#28204;&#65292;&#21487;&#20197;&#23559;&#20854;&#33287;&#30446;&#27161;&#21521;&#37327;&#36914;&#34892;&#27604;&#23565;&#65292;&#30001;&#26044;&#38928;&#28204;&#33287;&#30446;&#27161;&#21521;&#37327;&#37117;&#23660;&#26044;&#36899;&#32396;&#24418;&#24335;&#65292;&#20841;&#32773;&#20043;&#38291;&#30340;&#35492;&#24046;&#21487;&#20197;&#30001;&#22343;&#26041;&#35492;&#24046;&#65288;mean square error&#65289;&#27770;&#23450;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{MSE} = \\frac{1}{m} \\sum_i \\left( \\hat{y_i} - y_i \\right)^2&quot;,&quot;id&quot;:&quot;RYBGLUOXLV&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#21521;&#37327;&#33287;&#30697;&#38499;&#24418;&#24335;&#30340;&#35336;&#31639;&#26371;&#27604;&#32020;&#37327;&#36939;&#31639;&#26356;&#21152;&#24555;&#25463;&#26377;&#25928;&#29575;&#65292;&#25152;&#20197;&#25105;&#20497;&#23559;&#22343;&#26041;&#35492;&#24046;&#25913;&#20197;&#21521;&#37327;&#24418;&#24335;&#34920;&#31034;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{MSE} = \\frac{1}{m}  || \\hat{y} - y ||^2 = \\frac{1}{m} || h(X) - y ||^2&quot;,&quot;id&quot;:&quot;DWJCYGAKDE&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#28858;&#20102;&#35731;&#22343;&#26041;&#35492;&#24046;&#26368;&#23567;&#65292;&#21487;&#20197;&#27714;&#35299;&#26799;&#24230;&#28858;&#38646;&#30340;&#35299;&#65292;&#26799;&#24230;&#65288;gradient&#65289;&#25351;&#30340;&#26159;&#22312;&#21521;&#37327;&#23565;&#20989;&#25976;&#30340;&#20559;&#24494;&#20998;&#65292;&#23565;&#25033;&#23566;&#25976;&#65288;derivative&#65289;&#25351;&#30340;&#26159;&#32020;&#37327;&#23565;&#20989;&#25976;&#30340;&#20559;&#24494;&#20998;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{align}\n\\nabla_wMSE &amp;= 0 \\\\\n\\frac{1}{m} \\nabla_w|| Xw - y ||^2 &amp;= 0 \\\\\n\\nabla_w \\left( Xw - y \\right)^\\top\\left( Xw - y \\right)  &amp;= 0 \\\\\n\\nabla_w \\left( w^\\top X^\\top Xw - 2w^\\top X^\\top y + y^\\top y \\right) &amp;= 0 \\\\\n2X^\\top X w - 2X^\\top y &amp;= 0 \\\\\nX^\\top X w = X^\\top y\\\\\nw = \\left( X^\\top X \\right)^{-1}X^\\top y\n\\end{align}&quot;,&quot;id&quot;:&quot;URRXJJQVHD&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#33267;&#27492;&#25105;&#20497;&#33021;&#22816;&#24471;&#30693;&#27491;&#35215;&#26041;&#31243;&#24335;&#30340;&#27714;&#35299;&#65292;&#28304;&#26044;&#35731;&#25928;&#33021;&#35413;&#20272;&#30340;&#22343;&#26041;&#35492;&#24046;&#26368;&#23567;&#21270;&#65292;&#36914;&#32780;&#35336;&#31639;&#35731;&#27402;&#37325;&#21521;&#37327;&#23565;&#22343;&#26041;&#35492;&#24046;&#20989;&#25976;&#30340;&#26799;&#24230;&#28858;&#38646;&#30340;&#35299;&#12290;</p><h2>&#20197; Numpy &#23526;&#20316;&#27491;&#35215;&#26041;&#31243;&#24335;</h2><p>&#25104;&#21151;&#25512;&#23566;&#20986;&#27491;&#35215;&#26041;&#31243;&#24335;&#20043;&#24460;&#65292;&#26368;&#24460;&#25105;&#20497;&#23531;&#20316;&#19968;&#20491;&#39006;&#21029; NormalEquations&#65292;&#20197; Python &#33287; Numpy &#27169;&#32068;&#23526;&#20316;&#65292;&#22312;&#32102;&#23450;&#36969;&#30070;&#36039;&#26009;&#38598;&#30340;&#29305;&#24501;&#30697;&#38499;&#33287;&#30446;&#27161;&#21521;&#37327;&#65292;&#33021;&#22816;&#29983;&#25104; h &#20989;&#25976;&#30340;&#27402;&#37325;&#21521;&#37327;&#12290;&#23526;&#20316;&#36942;&#31243;&#20013;&#25105;&#20497;&#26371;&#29992;&#21040; Numpy &#27169;&#32068;&#30340; np.transpose() &#25110; ndarray &#30340; T &#23660;&#24615;&#20358;&#29983;&#25104;&#36681;&#32622;&#30697;&#38499;&#12289;np.linalg.inv() &#20358;&#29983;&#25104;&#21453;&#30697;&#38499;&#12289;np.dot() &#25110; ndarray &#30340; dot() &#26041;&#27861;&#20358;&#35336;&#31639;&#21521;&#37327;&#33287;&#30697;&#38499;&#30340;&#30456;&#20056;&#12290;</p><pre><code>class NormalEquations:
    def fit(self, X_train, y_train):
        # ...
    def predict(self, X_test):
        # ...</code></pre><p>NormalEquations &#39006;&#21029;&#30340;&#20351;&#29992;&#26159;&#20197; fit() &#26041;&#27861;&#29983;&#25104;&#27402;&#37325;&#21521;&#37327;&#65292;&#20006;&#20197; predict() &#26041;&#27861;&#23559;&#29983;&#25104;&#38928;&#28204;&#12290;&#25105;&#20497;&#21487;&#20197;&#23559; NormalEquations &#39006;&#21029;&#25033;&#29992;&#22312; Kaggle &#30340; House Prices &#36039;&#26009;&#38598;&#65292;&#34249;&#27492;&#20358;&#39511;&#35657;&#23427;&#30340;&#21487;&#29992;&#24615;&#12290;</p><pre><code>train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
X_train = train["OverallQual"].values.reshape(-1, 1)
y_train = train["SalePrice"].values
X_test = test["OverallQual"].values.reshape(-1, 1)
normal_equations = NormalEquations()
normal_equations.fit(X_train, y_train)
y_pred = normal_equations.predict(X_test)</code></pre><p>&#31532;&#22235;&#21313;&#19968;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#27491;&#35215;&#26041;&#31243;&#24335;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-one-normal-equations?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-one-normal-equations?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-forty-one-normal-equations/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-forty-one-normal-equations/comments"><span>Leave a comment</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2>
      <p>
          <a href="https://datainpoint.substack.com/p/week-forty-one-normal-equations">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：機器學習基礎 ]]></title><description><![CDATA[&#31532;&#22235;&#21313;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-fourty-getting-started-with-machinelearning</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-fourty-getting-started-with-machinelearning</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Fri, 15 Mar 2024 09:01:24 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f4257c8b-2da1-4933-bfcb-9efc4990473a_480x270.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4icI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4icI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif 424w, https://substackcdn.com/image/fetch/$s_!4icI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif 848w, https://substackcdn.com/image/fetch/$s_!4icI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif 1272w, https://substackcdn.com/image/fetch/$s_!4icI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4icI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif" width="480" height="270" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:270,&quot;width&quot;:480,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:469980,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4icI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif 424w, https://substackcdn.com/image/fetch/$s_!4icI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif 848w, https://substackcdn.com/image/fetch/$s_!4icI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif 1272w, https://substackcdn.com/image/fetch/$s_!4icI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2190f69b-dcc4-4db0-823e-32bf9bc54fd2_480x270.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;giphy.com</figcaption></figure></div><h2>&#27231;&#22120;&#23416;&#32722;&#28436;&#31639;&#27861;</h2><p>&#25130;&#33267;&#30446;&#21069;&#28858;&#27490;&#65292;&#25105;&#35258;&#24471;&#36996;&#26159;&#27794;&#26377;&#20854;&#20182;&#23565;&#27231;&#22120;&#23416;&#32722;&#28436;&#31639;&#27861;&#30340;&#23450;&#32681;&#27604;&#24471;&#19978; Tom Mitchell &#30340;&#29256;&#26412;&#65292;&#26356;&#31777;&#30701;&#30340;&#29256;&#26412;&#35299;&#37323;&#33021;&#21147;&#19981;&#36275;&#12289;&#31687;&#24133;&#26356;&#38263;&#30340;&#29256;&#26412;&#19981;&#22816;&#31934;&#32244;&#65292;&#22312;&#35299;&#37323;&#33021;&#21147;&#33287;&#31934;&#32244;&#31243;&#24230;&#19978;&#65292;&#36889;&#27573;&#35441;&#29694;&#38542;&#27573;&#23621;&#26044;&#21508;&#31278;&#29256;&#26412;&#23450;&#32681;&#20043;&#39318;&#65292;Well&#8230;it is definitely &#8220;In My Humble Opinion.&#8221;</p><blockquote><p>A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P if its performance at tasks in T, as measured by P, improves with experience E.</p><p>Tom Mitchell</p></blockquote><p>&#19968;&#27573;&#20855;&#20633;&#38928;&#28204;&#25976;&#20540;&#12289;&#38928;&#28204;&#39006;&#21029;&#25110;&#25366;&#25496;&#29305;&#24501;&#30340;&#38651;&#33126;&#31243;&#24335;&#65288;&#20063;&#23601;&#26159;&#25105;&#20497;&#26085;&#24120;&#20439;&#31281;&#30340;&#27169;&#22411;&#65289;&#65292;&#25033;&#35442;&#31526;&#21512;&#12300;&#19977;&#20491;&#35201;&#32032;&#12301;&#12289;&#12300;&#19968;&#20491;&#20294;&#26360;&#12301;&#30340;&#29305;&#24615;&#12290;&#20854;&#20013;&#65292;&#19977;&#20491;&#35201;&#32032;&#20381;&#24207;&#28858;&#32147;&#39511;&#65288;Experience&#65289;&#12289;&#20219;&#21209;&#65288;Task&#65289;&#33287;&#25928;&#33021;&#35413;&#20272;&#65288;Performance measure&#65289;&#65307;&#19968;&#20491;&#20294;&#26360;&#65288;Condition&#65289;&#21063;&#28858;&#38568;&#33879;&#27511;&#21490;&#36039;&#26009;&#35264;&#28204;&#20540;&#25976;&#37327;&#22686;&#21152;&#65292;&#22312;&#20854;&#20182;&#26781;&#20214;&#19981;&#35722;&#21069;&#25552;&#19979;&#27169;&#22411;&#30340;&#34920;&#29694;&#25033;&#35442;&#35201;&#35722;&#24471;&#26356;&#20778;&#31168;&#65292;&#20063;&#23601;&#26159;&#38928;&#28204;&#30340;&#35492;&#24046;&#38477;&#20302;&#12289;&#25366;&#25496;&#36039;&#26009;&#29305;&#24501;&#30340;&#33021;&#21147;&#25552;&#21319;&#12290;</p><p>&#23565;&#26044; Tom Mitchell &#26377;&#33288;&#36259;&#30340;&#35712;&#32773;&#65292;&#21487;&#20197;&#35264;&#30475;&#20182;&#30340; Wikipedia &#38913;&#38754;&#65306;<a href="https://en.wikipedia.org/wiki/Tom_M._Mitchell">https://en.wikipedia.org/wiki/Tom_M._Mitchell</a>&#65292;&#25110;&#32773;&#20182;&#22312;&#21345;&#20839;&#22522;&#32654;&#38534;&#22823;&#23416;&#65288;Carnegie Mellon University, CMU&#65289;&#30340;&#38913;&#38754;&#65306;<a href="https://www.cs.cmu.edu/~tom">https://www.cs.cmu.edu/~tom</a>&#12290;</p><h2>&#20219;&#21209;</h2><p>&#27231;&#22120;&#23416;&#32722;&#28436;&#31639;&#27861;&#30340;&#38656;&#27714;&#12289;&#21205;&#27231;&#28304;&#33258;&#26044;&#36575;&#39636;&#24037;&#31243;&#24107;&#22312;&#25776;&#23531;&#31243;&#24335;&#35299;&#27770;&#29694;&#23526;&#19990;&#30028;&#30340;&#21839;&#38988;&#26178;&#65292;&#30896;&#21040;&#20102;&#12300;&#22266;&#23450;&#31243;&#24335;&#12301;&#38627;&#20197;&#35299;&#27770;&#30340;&#21839;&#38988;&#65292;&#22240;&#27492;&#23563;&#27714;&#33021;&#22816;&#35731;&#38651;&#33126;&#31243;&#24335;&#22522;&#26044;&#22914;&#20154;&#24037;&#26234;&#24935;&#19968;&#33324;&#30340;&#33021;&#21147;&#20358;&#38754;&#23565;&#36889;&#39006;&#22411;&#21839;&#38988;&#65292;&#24120;&#35211;&#30340;&#27231;&#22120;&#23416;&#32722;&#20219;&#21209;&#26377;&#22810;&#31278;&#65306;</p><ul><li><p>&#20998;&#39006;&#65288;Classification&#65289;&#65306;&#20998;&#39006;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#36039;&#26009;&#27512;&#23660;&#25104;&#28858; k &#39006;&#21029;&#20013;&#30340;&#20854;&#20013;&#19968;&#20491;&#65292;&#36664;&#20986;&#30340;&#36039;&#26009;&#28858;&#38626;&#25955;&#30340;&#24418;&#24335;&#65292;&#20363;&#22914;&#29289;&#20214;&#36776;&#35672;&#12289;&#36024;&#27454;&#30003;&#35531;&#26680;&#20934;&#33287;&#21542;&#25110;&#30142;&#30149;&#35386;&#26039;&#38512;&#24615;&#38525;&#24615;&#31561;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f: \\mathbb{R}^n \\rightarrow \\{ 1, ..., k \\} &quot;,&quot;id&quot;:&quot;NJHZDTIFZG&quot;}" data-component-name="LatexBlockToDOM"></div></li><li><p>&#36852;&#27512;&#65288;Regression&#65289;&#65306;&#36852;&#27512;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#36039;&#26009;&#38928;&#28204;&#26576;&#20491;&#25976;&#20540;&#65292;&#36664;&#20986;&#30340;&#36039;&#26009;&#28858;&#36899;&#32396;&#30340;&#24418;&#24335;&#65292;&#20363;&#22914;&#36024;&#27454;&#26680;&#20934;&#37329;&#38989;&#12289;&#37329;&#34701;&#21830;&#21697;&#20729;&#26684;&#38928;&#28204;&#25110;&#25151;&#23627;&#25104;&#20132;&#20729;&#26684;&#38928;&#28204;&#31561;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f: \\mathbb{R}^n \\rightarrow \\mathbb{R}&quot;,&quot;id&quot;:&quot;HEQYSEXALL&quot;}" data-component-name="LatexBlockToDOM"></div></li><li><p>&#36681;&#37636;&#65288;Transcription&#65289;&#65306;&#36681;&#37636;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#38750;&#32080;&#27083;&#21270;&#29305;&#24501;&#65288;Unstructured features&#65289;&#36681;&#25563;&#28858;&#38626;&#25955;&#30340;&#25991;&#23383;&#26684;&#24335;&#65292;&#20363;&#22914;&#20809;&#23416;&#23383;&#20803;&#36776;&#35672;&#65288;Optical Character Recognition, OCR&#65289;&#25110;&#35486;&#38899;&#36776;&#35672;&#12290;</p></li><li><p>&#27231;&#22120;&#32763;&#35695;&#65288;Machine translation&#65289;&#65306;&#27231;&#22120;&#32763;&#35695;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#35486;&#35328;&#30340;&#25991;&#23383;&#31526;&#34399;&#24207;&#21015;&#36681;&#25563;&#25104;&#21478;&#19968;&#31278;&#35486;&#35328;&#30340;&#25991;&#23383;&#31526;&#34399;&#24207;&#21015;&#12290;</p></li><li><p>&#32080;&#27083;&#21270;&#36664;&#20986;&#65288;Structured output&#65289;&#65306;&#32080;&#27083;&#21270;&#36664;&#20986;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#38750;&#32080;&#27083;&#21270;&#29305;&#24501;&#36681;&#25563;&#28858;&#26377;&#25928;&#12289;&#33021;&#22816;&#34987;&#33258;&#28982;&#35486;&#35328;&#29702;&#35299;&#30340;&#25991;&#23383;&#26684;&#24335;&#65292;&#20363;&#22914;&#24433;&#20687;&#27161;&#35387;&#65288;Image captioning&#65289;&#12289;&#35422;&#24615;&#27161;&#35387;&#12290;</p></li><li><p>&#30064;&#24120;&#20597;&#28204;&#65288;Anomaly detection&#65289;&#65306;&#30064;&#24120;&#20597;&#28204;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#19968;&#32068;&#20107;&#20214;&#24207;&#21015;&#36664;&#20986;&#28858;&#30064;&#24120;&#27161;&#35352;&#65292;&#20363;&#22914;&#20449;&#29992;&#21345;&#35408;&#27450;&#20597;&#28204;&#12290;</p></li><li><p>&#21512;&#25104;&#33287;&#25277;&#27171;&#65288;Synthesis and sampling&#65289;&#65306;&#21512;&#25104;&#33287;&#25277;&#27171;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#36039;&#26009;&#36664;&#20986;&#29305;&#23450;&#39006;&#22411;&#30340;&#26684;&#24335;&#65292;&#20363;&#22914;&#35486;&#38899;&#21512;&#25104;&#33021;&#22816;&#24478;&#25552;&#20379;&#30340;&#25991;&#23383;&#36664;&#20986;&#19968;&#27573;&#33287;&#35442;&#25991;&#23383;&#30456;&#31526;&#30340;&#35486;&#38899;&#65292;&#30446;&#21069;&#25105;&#20497;&#22312; Medium &#30475;&#21040;&#27599;&#19968;&#31687;&#33521;&#25991;&#25991;&#31456;&#37117;&#26377;&#35486;&#38899;&#21512;&#25104;&#30340;&#21151;&#33021;&#65292;&#23559;&#25991;&#31456;&#36681;&#25563;&#28858;&#26377;&#32882;&#26360;&#24418;&#24335;&#12290;</p></li><li><p>&#36986;&#28431;&#20540;&#22635;&#35036;&#65288;Imputation of missing values&#65289;&#65306;&#36986;&#28431;&#20540;&#22635;&#35036;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#36986;&#28431;&#20540;&#36039;&#26009;&#36664;&#20986;&#20854;&#38928;&#28204;&#20540;&#12290;</p></li><li><p>&#21435;&#38620;&#35338;&#65288;Denoising&#65289;&#65306;&#21435;&#38620;&#35338;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#28151;&#38620;&#27171;&#26412;&#36664;&#20986;&#28858;&#38928;&#28204;&#32020;&#28136;&#27171;&#26412;&#65292;&#25110;&#26356;&#24291;&#27867;&#22320;&#36664;&#20986;&#38928;&#28204;&#26781;&#20214;&#27231;&#29575;&#20998;&#20296;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\n    f: \\tilde{x} \\rightarrow x \\\\ \n    f: \\tilde{x} \\rightarrow p( x | \\tilde{x} )\n\\end{gather}&quot;,&quot;id&quot;:&quot;SBOWJURUIM&quot;}" data-component-name="LatexBlockToDOM"></div></li><li><p>&#23494;&#24230;&#20272;&#35336;&#65288;Density estimation&#65289;&#25110;&#27231;&#29575;&#36074;&#37327;&#20989;&#25976;&#20272;&#35336;&#65288;Probability mass function estimation&#65289;&#65306;&#23494;&#24230;&#20272;&#35336;&#20219;&#21209;&#26371;&#35201;&#27714;&#38651;&#33126;&#31243;&#24335;&#29986;&#29983;&#19968;&#20491;&#20989;&#25976;&#65292;&#36889;&#20491;&#20989;&#25976;&#33021;&#22816;&#23559;&#36664;&#20837;&#30340;&#36899;&#32396;&#36039;&#26009;&#36664;&#20986;&#28858;&#27231;&#29575;&#23494;&#24230;&#20989;&#25976;&#65292;&#25110;&#32773;&#23559;&#36664;&#20837;&#30340;&#38626;&#25955;&#36039;&#26009;&#36664;&#20986;&#28858;&#27231;&#29575;&#36074;&#37327;&#20989;&#25976;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p : \\mathbb{R}^n \\rightarrow \\mathbb{R} &quot;,&quot;id&quot;:&quot;DIJYIJCOVE&quot;}" data-component-name="LatexBlockToDOM"></div></li></ul><h2>&#25928;&#33021;&#35413;&#20272;</h2><p>&#30070;&#38651;&#33126;&#31243;&#24335;&#20381;&#29031;&#31243;&#24335;&#35373;&#35336;&#32773;&#65288;&#21253;&#21547;&#36575;&#39636;&#24037;&#31243;&#24107;&#12289;&#36039;&#26009;&#31185;&#23416;&#23478;&#25110;&#36039;&#26009;&#20998;&#26512;&#24107;&#31561;&#65289;&#30340;&#35201;&#27714;&#38918;&#21033;&#29986;&#29983;&#20102;&#19968;&#20491;&#20989;&#25976;&#65292;&#19979;&#19968;&#27493;&#33258;&#28982;&#35201;&#37341;&#23565;&#36889;&#20491;&#20989;&#25976;&#26159;&#21542;&#33021;&#36948;&#25104;&#20219;&#21209;&#12289;&#33021;&#36948;&#25104;&#22810;&#23569;&#21046;&#23450;&#34913;&#37327;&#30340;&#23610;&#24230;&#12290;&#23565;&#26044;&#20998;&#39006;&#12289;&#36681;&#37636;&#31561;&#20219;&#21209;&#32780;&#35328;&#65292;&#24120;&#29992;&#20358;&#20570;&#25928;&#33021;&#35413;&#20272;&#30340;&#26159;&#28310;&#30906;&#29575;&#65288;Accuracy&#65289;&#25110;&#32773;&#35492;&#24046;&#29575;&#65288;Error rate&#65289;&#65292;&#20841;&#32773;&#37117;&#26159;&#20197;&#20171;&#26044; 0 &#33287; 1 &#20043;&#38291;&#30340;&#27604;&#29575;&#35336;&#31639;&#65292;&#22240;&#27492;&#21448;&#31281;&#28858;&#38928;&#26399;&#30340; 0-1 &#25613;&#22833;&#65288;Expected 0-1 loss&#65289;&#65292;&#26412;&#36074;&#19978;&#28310;&#30906;&#29575;&#33287;&#35492;&#24046;&#29575;&#26159;&#30456;&#21516;&#30340;&#27010;&#24565;&#65292;&#21069;&#32773;&#26159;&#27491;&#38754;&#34920;&#21015;&#32780;&#24460;&#32773;&#26159;&#36000;&#38754;&#34920;&#21015;&#65292;&#22914;&#27492;&#32780;&#24050;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{gather}\n    \\text{Accuracy} = \\frac{\\text{Number of correct prediction}}{\\text{Number of total sample}} \\\\ \n    \\text{Error rate} = 1 - \\text{Accuracy}\n\\end{gather}&quot;,&quot;id&quot;:&quot;VEWINCMBZU&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#23565;&#26044;&#36852;&#27512;&#12289;&#23494;&#24230;&#20272;&#35336;&#31561;&#20219;&#21209;&#32780;&#35328;&#65292;&#24120;&#29992;&#20358;&#20570;&#25928;&#33021;&#35413;&#20272;&#30340;&#21063;&#26159;&#24179;&#22343;&#24179;&#26041;&#35492;&#24046;&#65288;Mean squared Error, MSE&#65289;&#25110;&#32773;&#24179;&#22343;&#23565;&#25976;&#27231;&#29575;&#12290;</p><p>&#27231;&#22120;&#23416;&#32722;&#28436;&#31639;&#27861;&#30340;&#25928;&#33021;&#35413;&#20272;&#33879;&#37325;&#22312;&#12300;&#20808;&#21069;&#27794;&#26377;&#36935;&#36942;&#12301;&#30340;&#36039;&#26009;&#65292;&#22240;&#27492;&#20316;&#28858;&#25928;&#33021;&#35413;&#20272;&#26178;&#25152;&#20351;&#29992;&#30340;&#28204;&#35430;&#36039;&#26009;&#38598;&#65288;Test data&#65289;&#36319;&#35347;&#32244;&#27231;&#22120;&#23416;&#32722;&#28436;&#31639;&#27861;&#30340;&#35347;&#32244;&#36039;&#26009;&#38598;&#65288;Train data&#65289;&#26159;&#20998;&#38283;&#30340;&#12290;&#25928;&#33021;&#35413;&#20272;&#30340;&#27010;&#24565;&#30475;&#20284;&#31777;&#21934;&#12289;&#30452;&#35264;&#65292;&#20294;&#26159;&#22312;&#35413;&#20272;&#30340;&#36942;&#31243;&#24120;&#26371;&#36973;&#36935;&#21040;&#35377;&#22810;&#38656;&#35201;&#25225;&#25799;&#30340;&#22580;&#26223;&#65292;&#20363;&#22914;&#30064;&#24120;&#20597;&#28204;&#20219;&#21209;&#38754;&#23565;&#30340;&#36664;&#20986;&#20998;&#20296;&#26377;&#26997;&#22823;&#30340;&#33853;&#24046;&#65292;&#26159;&#21542;&#33021;&#22816;&#20351;&#29992;&#33287;&#36664;&#20986;&#20998;&#20296;&#30456;&#23565;&#22343;&#21243;&#30340;&#20998;&#39006;&#20219;&#21209;&#21516;&#27171;&#30340;&#25928;&#33021;&#35413;&#20272;&#24230;&#37327;&#26041;&#24335;&#65311;</p><h2>&#32147;&#39511;</h2><p>&#27231;&#22120;&#23416;&#32722;&#28436;&#31639;&#27861;&#22823;&#33268;&#19978;&#20998;&#28858;&#38750;&#30435;&#30563;&#24335;&#65288;Unsupervised&#65289;&#25110;&#30435;&#30563;&#24335;&#65288;Supervised&#65289;&#65292;&#20841;&#32773;&#30340;&#24046;&#30064;&#23601;&#22312;&#26044;&#35347;&#32244;&#36942;&#31243;&#20013;&#25152;&#20351;&#29992;&#30340;&#35347;&#32244;&#36039;&#26009;&#38598;&#39006;&#22411;&#20043;&#19981;&#21516;&#65292;&#36039;&#26009;&#38598;&#65288;Dataset&#65289;&#26159;&#35377;&#22810;&#27171;&#26412;&#30340;&#38598;&#21512;&#65292;&#32780;&#27171;&#26412;&#20063;&#31281;&#28858;&#36039;&#26009;&#40670;&#65288;Data points&#65289;&#12290;</p><p>&#24180;&#20195;&#26368;&#20037;&#36960;&#30340;&#36039;&#26009;&#38598;&#20043;&#19968;&#26159;&#23478;&#21947;&#25142;&#26313;&#30340;&#40182;&#23614;&#33457;&#65288;Iris dataset&#65289;&#65292;&#30001; 150 &#26666;&#40182;&#23614;&#33457;&#19981;&#21516;&#37096;&#20301;&#30340;&#25976;&#20540;&#28204;&#37327;&#38598;&#21512;&#32780;&#25104;&#20316;&#28858;&#29305;&#24501;&#65292;&#21253;&#21547;&#19977;&#31278;&#19981;&#21516;&#30340;&#29289;&#31278;&#65306;Setosa&#12289;Versicolor &#33287; Virginica &#38598;&#21512;&#32780;&#25104;&#20316;&#28858;&#30446;&#27161;&#12290;</p><pre><code>from sklearn.datasets import load_iris

iris = load_iris()
print(iris.data)
print(iris.target)
print(iris.feature_names)
print(iris.target_names)</code></pre><p>&#25551;&#36848;&#36039;&#26009;&#21450;&#30340;&#24120;&#35211;&#26041;&#27861;&#26159;&#20351;&#29992;&#35373;&#35336;&#30697;&#38499;&#65288;Design matrix&#65289;&#65292;&#27599;&#21015;&#23565;&#25033;&#19981;&#21516;&#29305;&#24501;&#12289;&#27599;&#27396;&#21547;&#26377;&#19981;&#21516;&#27171;&#26412;&#30340;&#30697;&#38499;&#65292;&#20363;&#22914;&#40182;&#23614;&#33457;&#36039;&#26009;&#38598;&#21253;&#21547; 150 &#20491;&#27171;&#26412;&#65292;&#27599;&#20491;&#27171;&#26412;&#26377;&#22235;&#20491;&#29305;&#24501;&#65292;&#22240;&#27492;&#25105;&#20497;&#23601;&#21487;&#20197;&#25551;&#36848;&#19968;&#20491;&#35373;&#35336;&#30697;&#38499;&#20358;&#34920;&#31034;&#35442;&#36039;&#26009;&#38598;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;X \\in \\mathbb{R}^{150 \\times 4}&quot;,&quot;id&quot;:&quot;DMKGOETXQO&quot;}" data-component-name="LatexBlockToDOM"></div><pre><code>print(iris.data.shape)</code></pre><p>&#28982;&#32780;&#33509;&#35201;&#23559;&#36039;&#26009;&#38598;&#25551;&#36848;&#28858;&#35373;&#35336;&#30697;&#38499;&#65292;&#24517;&#38920;&#23559;&#27599;&#20491;&#27171;&#26412;&#37117;&#25551;&#36848;&#25104;&#30456;&#21516;&#38263;&#24230;&#30340;&#21521;&#37327;&#65292;&#36889;&#22312;&#23526;&#21209;&#19978;&#20006;&#38750;&#19968;&#20214;&#23481;&#26131;&#30340;&#20107;&#24773;&#65292;&#20363;&#22914;&#36039;&#26009;&#38598;&#26159;&#19981;&#21516;&#38263;&#12289;&#23532;&#12289;&#35299;&#26512;&#24230;&#30340;&#24433;&#20687;&#65292;&#23601;&#19981;&#33021;&#20197;&#30456;&#21516;&#38263;&#24230;&#30340;&#21521;&#37327;&#25551;&#36848;&#65292;&#24517;&#38920;&#35201;&#25913;&#25551;&#36848;&#28858;&#21547;&#26377; m &#20491;&#20803;&#32032;&#30340;&#38598;&#21512;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;X: \\{ x^{(1)}, x^{(2)}, ..., x^{(m)} \\}&quot;,&quot;id&quot;:&quot;PZMUFAWDEH&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#38750;&#30435;&#30563;&#24335;&#23416;&#32722;&#28436;&#31639;&#27861;&#28085;&#33995;&#36039;&#26009;&#38598;&#30340;&#29305;&#24501;&#37096;&#20998;&#65292;&#32780;&#30435;&#30563;&#24335;&#23416;&#32722;&#21063;&#28085;&#33995;&#36039;&#26009;&#38598;&#30340;&#29305;&#24501;&#33287;&#30446;&#27161;&#37096;&#20998;&#12290;&#20855;&#39636;&#20358;&#35498;&#65292;&#38750;&#30435;&#30563;&#24335;&#23416;&#32722;&#28436;&#31639;&#27861;&#35430;&#22294;&#22312;&#35264;&#28204;&#38568;&#27231;&#21521;&#37327; x &#20043;&#24460;&#65292;&#23416;&#32722;&#20854;&#20013;&#30340;&#27231;&#29575;&#20998;&#20296; p(x)&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p(x) = \\prod_{i=1}^{n}p(x_i | x_1, ..., x_{i-1})&quot;,&quot;id&quot;:&quot;THUJEFJFIV&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#32780;&#30435;&#30563;&#24335;&#23416;&#32722;&#28436;&#31639;&#27861;&#21063;&#35430;&#22294;&#22312;&#35264;&#28204;&#38568;&#27231;&#21521;&#37327; x &#20197;&#21450;&#20854;&#23565;&#25033;&#21521;&#37327; y &#20043;&#24460;&#65292;&#23416;&#32722;&#36879;&#36942;&#20272;&#35336; p(y | x) &#24478;&#32780;&#36948;&#25104;&#30001; x &#38928;&#28204; y&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p(y | x) = \\frac{p(x, y)}{\\sum_{y^{\\prime}}p(x, y^{\\prime})}&quot;,&quot;id&quot;:&quot;MPZROSSOSI&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#20659;&#32113;&#19978;&#65292;&#27231;&#22120;&#23416;&#32722;&#38936;&#22495;&#30340;&#20154;&#20497;&#23559;&#36852;&#27512;&#12289;&#20998;&#39006;&#33287;&#32080;&#27083;&#21270;&#36664;&#20986;&#27512;&#32013;&#28858;&#30435;&#30563;&#24335;&#23416;&#32722;&#65307;&#23559;&#23494;&#24230;&#20272;&#35336;&#25110;&#27231;&#29575;&#36074;&#37327;&#20989;&#25976;&#20272;&#35336;&#27512;&#32013;&#28858;&#38750;&#30435;&#30563;&#24335;&#23416;&#32722;&#12290;&#27492;&#22806;&#65292;&#20063;&#26377;&#20854;&#20182;&#35722;&#30064;&#22411;&#30340;&#23416;&#32722;&#28436;&#31639;&#27861;&#65292;&#20363;&#22914;&#22312;&#21322;&#30435;&#30563;&#24335;&#23416;&#32722;&#65288;Semi-supervised learning&#65289;&#26576;&#20123;&#27171;&#26412;&#28085;&#33995;&#30446;&#27161;&#12289;&#20854;&#20182;&#27171;&#26412;&#21063;&#27794;&#26377;&#28085;&#33995;&#12290;</p><p>&#31532;&#22235;&#21313;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#27231;&#22120;&#23416;&#32722;&#22522;&#30990;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-fourty-getting-started-with-machinelearning?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-fourty-getting-started-with-machinelearning?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-fourty-getting-started-with-machinelearning/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-fourty-getting-started-with-machinelearning/comments"><span>Leave a comment</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#21487;&#20197;&#40670;&#36984;&#19979;&#21015;&#36899;&#32080;&#23559;&#26412;&#31687;&#25991;&#31456;&#23436;&#25972;&#30340; Google Colab &#35079;&#35069;&#21040;&#33258;&#24049;&#30340; Google Drive &#20043;&#20013;&#12290;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/week-fourty-getting-started-with-machinelearning">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：中選會選舉資料正規化]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#20061;&#36913;]]></description><link>https://datainpoint.substack.com/p/ae3</link><guid isPermaLink="false">https://datainpoint.substack.com/p/ae3</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Fri, 23 Feb 2024 09:00:38 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!LtRq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LtRq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LtRq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png 424w, https://substackcdn.com/image/fetch/$s_!LtRq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png 848w, https://substackcdn.com/image/fetch/$s_!LtRq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png 1272w, https://substackcdn.com/image/fetch/$s_!LtRq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LtRq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png" width="695" height="717" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c3521302-d744-4529-afea-8d051524a324_695x717.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:717,&quot;width&quot;:695,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:88025,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LtRq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png 424w, https://substackcdn.com/image/fetch/$s_!LtRq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png 848w, https://substackcdn.com/image/fetch/$s_!LtRq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png 1272w, https://substackcdn.com/image/fetch/$s_!LtRq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3521302-d744-4529-afea-8d051524a324_695x717.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;MySQL Workbench Reverse Engineer</figcaption></figure></div><h2>&#20013;&#36984;&#26371;&#36984;&#33289;&#36039;&#26009;</h2><p>&#32147;&#27511;&#31532;&#19977;&#21313;&#20843;&#36913;&#30340;<a href="https://datainpoint.substack.com/p/week-thirty-eight-tidy-taiwan-election-2024-data">&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#20013;&#36984;&#26371;&#36984;&#33289;&#36039;&#26009;&#25805;&#20316;&#34389;&#29702;</a>&#65292;&#25105;&#20497;&#25163;&#37002;&#24050;&#32147;&#21462;&#24471;&#25972;&#40778;&#26684;&#24335;&#65288;Tidy format&#65289;&#36039;&#26009;&#65306;</p><ul><li><p>president.csv</p></li><li><p>legislator.csv</p></li><li><p>party_legislator.csv</p></li><li><p>polling_place.csv</p></li></ul><p>&#22312;&#36889;&#36913;&#25105;&#20497;&#23559;&#36939;&#29992;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#30340;&#37325;&#35201;&#35264;&#24565;&#65306;&#27491;&#35215;&#21270;&#65288;Normalization&#65289;&#36914;&#19968;&#27493;&#23559;&#25972;&#40778;&#26684;&#24335;&#36039;&#26009;&#36681;&#25563;&#28858;&#27491;&#35215;&#21270;&#30340;&#36039;&#26009;&#26684;&#24335;&#12290;</p><h2>&#20309;&#35586;&#27491;&#35215;&#21270;</h2><p>&#36039;&#26009;&#24235;&#30340;&#36039;&#26009;&#20786;&#23384;&#27169;&#24335;&#38750;&#24120;&#22810;&#20803;&#65292;&#21253;&#21547;&#38364;&#32879;&#24335;&#12289;&#25991;&#20214;&#24335;&#12289;&#32178;&#32097;&#24335;&#25110;&#32773;&#37749;&#20540;&#24335;&#31561;&#65292;&#20854;&#20013;&#22522;&#26044;&#38364;&#32879;&#24335;&#27169;&#22411;&#65288;Relation model&#65289;&#25152;&#24314;&#31435;&#30340;&#23601;&#31281;&#28858;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#12290;&#24314;&#31435;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#30340;&#36942;&#31243;&#20013;&#24517;&#38920;&#35201;&#20208;&#36084;&#30340;&#20854;&#20013;&#19968;&#20491;&#25216;&#24039;&#33287;&#35264;&#24565;&#26159;&#27491;&#35215;&#21270;&#65288;Normalization&#65289;&#12290;</p><p>&#31777;&#32780;&#35328;&#20043;&#65292;&#27491;&#35215;&#21270;&#23601;&#26159;&#23559;&#21407;&#22987;&#36039;&#26009;&#36681;&#25563;&#28858;&#31526;&#21512;&#27491;&#35215;&#21270;&#26684;&#24335;&#65288;Normal Form, NF&#65289;&#30340;&#36942;&#31243;&#12290;&#27491;&#35215;&#21270;&#26684;&#24335;&#26159;&#19968;&#31278;&#26377;&#38918;&#24207;&#24615;&#30340;&#36039;&#26009;&#25551;&#36848;&#27171;&#24907;&#65292;&#25152;&#20197;&#22312;&#27491;&#35215;&#21270;&#26684;&#24335;&#21069;&#38754;&#36996;&#26371;&#20877;&#21152;&#19978;&#30001; 1 &#36215;&#22987;&#30340;&#25972;&#25976;&#20316;&#28858;&#21069;&#32180;&#23383;&#12290;</p><h2>&#27491;&#35215;&#21270;&#26684;&#24335;</h2><p>&#30446;&#21069;&#20027;&#27969;&#30340;&#27491;&#35215;&#21270;&#26684;&#24335;&#21069;&#32180;&#25972;&#25976;&#24478; 1 &#36215;&#22987;&#33267; 3&#65292;&#23601;&#31281;&#28858;&#31532;&#19968;&#27491;&#35215;&#21270;&#65288;First Normal Form, 1NF&#65289;&#12289;&#31532;&#20108;&#27491;&#35215;&#21270;&#65288;Second Normal Form, 2NF&#65289;&#20197;&#21450;&#31532;&#19977;&#27491;&#35215;&#21270;&#65288;Third Normal Form, 3NF&#65289;&#12290;</p><p>&#35201;&#27714;&#26356;&#22810;&#12289;&#26356;&#28858;&#36914;&#38542;&#33287;&#22196;&#35641;&#30340;&#27491;&#35215;&#21270;&#26684;&#24335;&#20854;&#21629;&#21517;&#21069;&#32180;&#23383;&#28310;&#21063;&#23601;&#26377;&#25152;&#35519;&#25972;&#65292;&#20363;&#22914;&#20171;&#26044;&#31532;&#19977;&#21644;&#31532;&#22235;&#27491;&#35215;&#21270;&#26684;&#24335;&#20043;&#38291;&#26377; Elementary Key Normal Form, EKNF&#12289;Boyce&#8211;Codd Normal Form, BCNF&#65307;&#20171;&#26044;&#31532;&#22235;&#21644;&#31532;&#20116;&#27491;&#35215;&#21270;&#26684;&#24335;&#20043;&#38291;&#26377; Essential Tuple Normal Form&#65307;&#20171;&#26044;&#31532;&#20116;&#21644;&#31532;&#20845;&#27491;&#35215;&#21270;&#26684;&#24335;&#20043;&#38291;&#26377; Domain-Key Normal Form&#12290;</p><p>&#25509;&#33879;&#25105;&#20497;&#35299;&#37323;&#20027;&#27969;&#30340;&#27491;&#35215;&#21270;&#26684;&#24335;&#65292;&#21363;&#31532;&#19968;&#27491;&#35215;&#21270;&#26684;&#24335;&#33267;&#31532;&#19977;&#27491;&#35215;&#21270;&#26684;&#24335;&#20854;&#23450;&#32681;&#33287;&#35201;&#20214;&#65306;</p><p>&#31532;&#19968;&#27491;&#35215;&#21270;&#65288;First Normal Form, 1NF&#65289;&#65306;&#27599;&#19968;&#20491;&#30001;&#21015;&#27396;&#23565;&#25033;&#30340;&#20786;&#23384;&#26684;&#20013;&#37117;&#35201;&#26377;&#36039;&#26009;&#65292;&#20063;&#21482;&#33021;&#26377;&#19968;&#20221;&#36039;&#26009;&#65307;&#27599;&#19968;&#21015;&#36039;&#26009;&#24517;&#38920;&#35201;&#23565;&#25033;&#29544;&#19968;&#19988;&#19981;&#37325;&#35079;&#30340;&#35672;&#21029;&#25972;&#25976;&#65292;&#21363;&#27969;&#27700;&#32232;&#34399;&#25110;&#31281;&#20027;&#37749;&#12290;&#20363;&#22914;&#22312;&#25972;&#40778;&#26684;&#24335;&#36039;&#26009;&#20013;&#65292;&#27599;&#19968;&#31558;&#36039;&#26009;&#37117;&#26159;&#20505;&#36984;&#20154;&#22312;&#19968;&#20491;&#34892;&#25919;&#21312;&#30340;&#19968;&#20491;&#25237;&#31080;&#25152;&#30340;&#24471;&#31080;&#25976;&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!L-L4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!L-L4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png 424w, https://substackcdn.com/image/fetch/$s_!L-L4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png 848w, https://substackcdn.com/image/fetch/$s_!L-L4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png 1272w, https://substackcdn.com/image/fetch/$s_!L-L4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!L-L4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png" width="1456" height="789" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:789,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:239905,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!L-L4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png 424w, https://substackcdn.com/image/fetch/$s_!L-L4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png 848w, https://substackcdn.com/image/fetch/$s_!L-L4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png 1272w, https://substackcdn.com/image/fetch/$s_!L-L4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F821db75d-fe75-4b00-94b7-b18541f77939_1728x936.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">president.csv</figcaption></figure></div><p>&#31532;&#20108;&#27491;&#35215;&#21270;&#65288;Second Normal Form, 2NF&#65289;&#65306;&#36039;&#26009;&#24517;&#38920;&#20808;&#31526;&#21512;&#31532;&#19968;&#27491;&#35215;&#21270;&#26684;&#24335;&#65292;&#20006;&#36914;&#19968;&#27493;&#28040;&#38500;&#37096;&#20998;&#30456;&#20381;&#24615;&#65288;Functionally dependent&#65289;&#12290;&#37096;&#20998;&#30456;&#20381;&#24615;&#32893;&#36215;&#20358;&#38750;&#24120;&#25277;&#35937;&#65292;&#25105;&#20497;&#24517;&#38920;&#33289;&#20363;&#35498;&#26126;&#65292;&#20363;&#22914;&#22312;&#25972;&#40778;&#26684;&#24335;&#36039;&#26009;&#20013;&#65292;&#25105;&#20497;&#23559; county&#12289;town&#12289;village &#33287; polling_place &#25552;&#21462;&#20986;&#20358;&#25104;&#28858; districts &#36039;&#26009;&#34920;&#65307;&#25110;&#32773;&#23559; party &#25552;&#21462;&#20986;&#20358;&#25104;&#28858; parties &#36039;&#26009;&#34920;&#65292;&#20197;&#21450;&#23559; candidate &#25552;&#21462;&#20986;&#20358;&#25104;&#28858; candidates &#36039;&#26009;&#34920;&#65292;&#31777;&#32780;&#35328;&#20043;&#65292;&#28040;&#38500;&#37096;&#20998;&#30456;&#20381;&#24615;&#23601;&#26159;&#23559;&#36039;&#26009;&#20491;&#39636;&#29544;&#31435;&#20986;&#20358;&#65292;&#36914;&#32780;&#25104;&#28858;&#20027;&#35201;&#30340;&#29238;&#27597;&#36039;&#26009;&#34920;&#65288;Parent Tables&#65289;&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-vyc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-vyc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png 424w, https://substackcdn.com/image/fetch/$s_!-vyc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png 848w, https://substackcdn.com/image/fetch/$s_!-vyc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png 1272w, https://substackcdn.com/image/fetch/$s_!-vyc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-vyc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png" width="840" height="930" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2f545674-b04b-48e1-ba5e-53f797896746_840x930.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:930,&quot;width&quot;:840,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:124711,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-vyc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png 424w, https://substackcdn.com/image/fetch/$s_!-vyc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png 848w, https://substackcdn.com/image/fetch/$s_!-vyc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png 1272w, https://substackcdn.com/image/fetch/$s_!-vyc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f545674-b04b-48e1-ba5e-53f797896746_840x930.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">districts</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ASW-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ASW-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png 424w, https://substackcdn.com/image/fetch/$s_!ASW-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png 848w, https://substackcdn.com/image/fetch/$s_!ASW-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png 1272w, https://substackcdn.com/image/fetch/$s_!ASW-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ASW-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png" width="446" height="794" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:794,&quot;width&quot;:446,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60991,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ASW-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png 424w, https://substackcdn.com/image/fetch/$s_!ASW-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png 848w, https://substackcdn.com/image/fetch/$s_!ASW-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png 1272w, https://substackcdn.com/image/fetch/$s_!ASW-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd56d80c-f348-4f19-a955-bcb19ce50a24_446x794.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">parties</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!D9Ou!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D9Ou!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png 424w, https://substackcdn.com/image/fetch/$s_!D9Ou!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png 848w, https://substackcdn.com/image/fetch/$s_!D9Ou!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png 1272w, https://substackcdn.com/image/fetch/$s_!D9Ou!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!D9Ou!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png" width="702" height="952" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:952,&quot;width&quot;:702,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:79146,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D9Ou!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png 424w, https://substackcdn.com/image/fetch/$s_!D9Ou!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png 848w, https://substackcdn.com/image/fetch/$s_!D9Ou!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png 1272w, https://substackcdn.com/image/fetch/$s_!D9Ou!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3ba3a4f-958e-4bcf-88d0-59222533aba2_702x952.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">candidates</figcaption></figure></div><p>&#31532;&#19977;&#27491;&#35215;&#21270;&#65288;Third Normal Form, 3NF&#65289;&#65306;&#36039;&#26009;&#24517;&#38920;&#20808;&#31526;&#21512;&#31532;&#20108;&#27491;&#35215;&#21270;&#26684;&#24335;&#65292;&#20006;&#36914;&#19968;&#27493;&#28040;&#38500;&#36958;&#31227;&#30456;&#20381;&#24615;&#65288;Transitive dependency&#65289;&#12290;&#36958;&#31227;&#30456;&#20381;&#24615;&#21516;&#27171;&#32893;&#36215;&#20358;&#38750;&#24120;&#25277;&#35937;&#65292;&#25105;&#20497;&#24517;&#38920;&#33289;&#20363;&#35498;&#26126;&#65292;&#20363;&#22914;&#22312; polling_places &#36039;&#26009;&#34920;&#20013;&#65292;&#25105;&#20497;&#23559;&#21407;&#26412;&#36039;&#26009;&#20013;&#30340;&#12300;&#25237;&#31080;&#25976;&#12301;&#27396;&#20301;&#31227;&#38500;&#65292;&#22240;&#28858;&#25237;&#31080;&#25976;&#21487;&#20197;&#36879;&#36942;&#26377;&#25928;&#31080;&#25976;&#21152;&#19978;&#28961;&#25928;&#31080;&#25976;&#35336;&#31639;&#32780;&#24471;&#65307;&#21448;&#25110;&#32773;&#25105;&#20497;&#23559;&#21407;&#26412;&#36039;&#26009;&#20013;&#30340;&#12300;&#24050;&#38936;&#26410;&#25237;&#31080;&#25976;&#12301;&#27396;&#20301;&#31227;&#38500;&#65292;&#22240;&#28858;&#24050;&#38936;&#26410;&#25237;&#31080;&#25976;&#21487;&#20197;&#36879;&#36942;&#30332;&#20986;&#31080;&#25976;&#28187;&#21435;&#38957;&#31080;&#25976;&#35336;&#31639;&#32780;&#24471;&#12290;&#31777;&#32780;&#35328;&#20043;&#65292;&#28040;&#38500;&#36958;&#31227;&#30456;&#20381;&#24615;&#23601;&#26159;&#23559;&#21487;&#20197;&#36879;&#36942;&#34893;&#29983;&#35336;&#31639;&#32780;&#24471;&#30340;&#27396;&#20301;&#31227;&#38500;&#65292;&#36914;&#32780;&#35731;&#36039;&#26009;&#34920;&#26356;&#28858;&#31934;&#29001;&#31777;&#28500;&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6V5D!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6V5D!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png 424w, https://substackcdn.com/image/fetch/$s_!6V5D!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png 848w, https://substackcdn.com/image/fetch/$s_!6V5D!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png 1272w, https://substackcdn.com/image/fetch/$s_!6V5D!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6V5D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png" width="1456" height="696" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:696,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:133246,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6V5D!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png 424w, https://substackcdn.com/image/fetch/$s_!6V5D!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png 848w, https://substackcdn.com/image/fetch/$s_!6V5D!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png 1272w, https://substackcdn.com/image/fetch/$s_!6V5D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff057385b-d2a9-410a-a844-26137f3b52e4_1844x882.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">polling_places</figcaption></figure></div><p>&#23436;&#25104;&#20013;&#36984;&#26371;&#36984;&#33289;&#36039;&#26009;&#27491;&#35215;&#21270;&#20043;&#24460;&#65292;&#31532;&#19977;&#21313;&#20061;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#20013;&#36984;&#26371;&#36984;&#33289;&#36039;&#26009;&#27491;&#35215;&#21270;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/ae3/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/ae3/comments"><span>Leave a comment</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/ae3?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/ae3?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#21487;&#20197;&#40670;&#36984;&#19979;&#21015;&#36899;&#32080;&#21462;&#24471;&#26412;&#31687;&#25991;&#31456;&#30340;&#27491;&#35215;&#21270;&#26684;&#24335;&#36039;&#26009;&#12290;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/ae3">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：中選會選舉資料操作處理]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#20843;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-thirty-eight-tidy-taiwan-election-2024-data</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-thirty-eight-tidy-taiwan-election-2024-data</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Sat, 03 Feb 2024 04:00:46 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!wMe8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wMe8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wMe8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif 424w, https://substackcdn.com/image/fetch/$s_!wMe8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif 848w, https://substackcdn.com/image/fetch/$s_!wMe8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif 1272w, https://substackcdn.com/image/fetch/$s_!wMe8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wMe8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif" width="480" height="360" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:360,&quot;width&quot;:480,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:434179,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wMe8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif 424w, https://substackcdn.com/image/fetch/$s_!wMe8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif 848w, https://substackcdn.com/image/fetch/$s_!wMe8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif 1272w, https://substackcdn.com/image/fetch/$s_!wMe8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfa1c63f-5067-42bd-9c9b-7a1f59c55e52_480x360.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;giphy.com</figcaption></figure></div><h2>&#20013;&#36984;&#26371;&#36984;&#33289;&#36039;&#26009;</h2><p>&#32147;&#27511;<a href="https://datainpoint.substack.com/p/basic-data-wrangling">&#31532;&#19977;&#21313;&#20845;&#36913;&#30340;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#22522;&#30990;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;</a>&#20197;&#21450;<a href="https://datainpoint.substack.com/p/week-thirty-seven-advanced-data-wrangling">&#31532;&#19977;&#21313;&#19971;&#36913;&#30340;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#36914;&#38542;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;</a>&#20043;&#24460;&#65292;&#22312;&#36889;&#36913;&#25105;&#20497;&#23559;&#32156;&#21512;&#20351;&#29992;&#36889;&#20123;&#22522;&#30990;&#33287;&#36914;&#38542;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;&#65292;&#20358;&#38754;&#23565;&#30495;&#23526;&#19990;&#30028;&#30340;&#36039;&#26009;&#65306;2024-01-13 &#30340;&#21488;&#28771;&#32317;&#32113;&#12289;&#31435;&#27861;&#22996;&#21729;&#25237;&#31080;&#25152;&#26126;&#32048;&#36039;&#26009;&#65292;&#24478;&#20013;&#36984;&#26371;&#30340;&#23448;&#32178;&#21487;&#20197;&#19979;&#36617;&#31532; 16 &#20219;&#32317;&#32113;&#21103;&#32317;&#32113;&#36984;&#33289;&#20197;&#31532; 11 &#23622;&#31435;&#27861;&#22996;&#21729;&#36984;&#33289;&#30340;&#12300;&#21508;&#25237;&#31080;&#25152;&#24471;&#31080;&#26126;&#32048;&#21450;&#27010;&#27841;&#12301;&#12290;</p><ul><li><p><a href="https://db.cec.gov.tw/ElecTable/Election/ElecTickets?dataType=tickets&amp;typeId=ELC&amp;subjectId=P0&amp;legisId=00&amp;themeId=4d83db17c1707e3defae5dc4d4e9c800&amp;dataLevel=N&amp;prvCode=00&amp;cityCode=000&amp;areaCode=00&amp;deptCode=000&amp;liCode=0000">&#31532; 16 &#20219;&#32317;&#32113;&#21103;&#32317;&#32113;&#36984;&#33289;</a></p></li><li><p><a href="https://db.cec.gov.tw/ElecTable/Election/ElecTickets?dataType=areas&amp;typeId=ELC&amp;subjectId=L0&amp;legisId=L1&amp;themeId=9c96a2080bfc199c590ec54f3a2bda7b&amp;dataLevel=C&amp;prvCode=00&amp;cityCode=000&amp;areaCode=00&amp;deptCode=000&amp;liCode=0000">&#31532; 11 &#23622;&#31435;&#27861;&#22996;&#21729;&#36984;&#33289;</a></p></li></ul><p>&#25105;&#20497;&#25152;&#19979;&#36617;&#30340;&#21407;&#22987;&#36039;&#26009;&#26159;&#12300;&#19979;&#36617;&#21508;&#38917;&#32113;&#35336;&#34920;&#12301;&#20013;&#30340;&#12300;&#21508;&#25237;&#31080;&#25152;&#24471;&#31080;&#26126;&#32048;&#21450;&#27010;&#27841;&#65288;Excel &#27284;&#65292;ZIP &#22739;&#32302;&#65289;&#12301;&#65292;&#35299;&#22739;&#32302;&#20043;&#24460;&#21487;&#20197;&#30475;&#21040;&#35041;&#38754;&#30340; Excel &#27963;&#38913;&#31807;&#27284;&#26696;&#22823;&#33268;&#26159;&#36889;&#27171;&#30340;&#22806;&#35264;&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RFtc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RFtc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png 424w, https://substackcdn.com/image/fetch/$s_!RFtc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png 848w, https://substackcdn.com/image/fetch/$s_!RFtc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png 1272w, https://substackcdn.com/image/fetch/$s_!RFtc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RFtc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png" width="1456" height="483" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:483,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:263776,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RFtc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png 424w, https://substackcdn.com/image/fetch/$s_!RFtc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png 848w, https://substackcdn.com/image/fetch/$s_!RFtc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png 1272w, https://substackcdn.com/image/fetch/$s_!RFtc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b0c7f55-068f-4021-a8b4-a3ba9bee3efc_2518x836.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;&#32317;&#32113;-A05-4-&#20505;&#36984;&#20154;&#24471;&#31080;&#25976;&#19968;&#35261;&#34920;-&#21508;&#25237;&#38283;&#31080;&#25152;(&#21335;&#25237;&#32291;).xlsx</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7kug!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7kug!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png 424w, https://substackcdn.com/image/fetch/$s_!7kug!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png 848w, https://substackcdn.com/image/fetch/$s_!7kug!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png 1272w, https://substackcdn.com/image/fetch/$s_!7kug!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7kug!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png" width="1456" height="448" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:448,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:299147,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7kug!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png 424w, https://substackcdn.com/image/fetch/$s_!7kug!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png 848w, https://substackcdn.com/image/fetch/$s_!7kug!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png 1272w, https://substackcdn.com/image/fetch/$s_!7kug!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93c59e9-599e-424c-a935-842fc6d9df30_2872x884.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;&#21312;&#22495;&#31435;&#22996;-A05-2-&#24471;&#31080;&#25976;&#19968;&#35261;&#34920;(&#21335;&#25237;&#32291;).xlsx</figcaption></figure></div><h2>&#24453;&#34389;&#29702;&#30340;&#37096;&#20998;</h2><p>&#24478; Excel &#27963;&#38913;&#31807;&#27284;&#26696;&#20013;&#25105;&#20497;&#21487;&#20197;&#30475;&#21040;&#21407;&#22987;&#36039;&#26009;&#20013;&#23384;&#22312;&#19979;&#21015;&#21839;&#38988;&#65306;</p><ul><li><p>&#21512;&#20341;&#20786;&#23384;&#26684;&#33287;&#31354;&#30333;&#20786;&#23384;&#26684;&#65292;&#26371;&#23566;&#33268;&#36617;&#20837;&#24460;&#26377;&#36986;&#28431;&#20540;&#12290;</p></li><li><p>&#32317;&#35336;&#12289;&#23567;&#35336;&#33287;&#26126;&#32048;&#20849;&#23384;&#65292;&#26371;&#23566;&#33268;&#22312;&#25033;&#29992;&#26178;&#26377;&#37325;&#35079;&#35336;&#31639;&#20043;&#34398;&#12290;</p></li><li><p>&#20505;&#36984;&#20154;&#34399;&#27425;&#12289;&#20505;&#36984;&#20154;&#22995;&#21517;&#33287;&#25919;&#40680;&#36039;&#26009;&#20786;&#23384;&#22312;&#27396;&#20301;&#21517;&#31281;&#20043;&#20013;&#65292;&#19981;&#26041;&#20415;&#20351;&#29992;&#12290;</p></li></ul><p>&#22312;&#36617;&#20837;&#27963;&#38913;&#31807;&#27284;&#26696;&#20013;&#30340;&#27599;&#19968;&#24373;&#35430;&#31639;&#34920;&#26178;&#65292;&#25105;&#20497;&#21487;&#20197;&#36879;&#36942;&#30456;&#21516;&#30340;&#34389;&#29702;&#27493;&#39519;&#20358;&#20351;&#24471;&#36039;&#26009;&#25104;&#28858;&#25972;&#40778;&#30340;&#26684;&#24335;&#65306;</p><ol><li><p>&#23559;&#20301;&#26044;&#20498;&#25976;&#20843;&#27396;&#30340;&#25237;&#31080;&#25152;&#36039;&#26009;&#29544;&#31435;&#20986;&#20358;&#25972;&#29702;&#12290;</p></li><li><p>&#36617;&#20837;&#26178;&#20197; skiprows &#21443;&#25976;&#30053;&#36942;&#29305;&#23450;&#30340;&#21015;&#25976;&#35299;&#27770;&#21512;&#20341;&#20786;&#23384;&#26684;&#30340;&#21839;&#38988;&#12290;</p></li><li><p>&#21033;&#29992; Series &#30340; fillna() &#26041;&#27861;&#22635;&#35036;&#36986;&#28431;&#20540;&#12290;</p></li><li><p>&#21033;&#29992; DataFrame &#30340; dropna() &#26041;&#27861;&#21034;&#38500;&#32317;&#35336;&#33287;&#23567;&#35336;&#30340;&#21015;&#25976;&#12290;</p></li><li><p>&#21033;&#29992; pd.melt() &#20989;&#25976;&#23559;&#20505;&#36984;&#20154;&#34399;&#27425;&#12289;&#20505;&#36984;&#20154;&#22995;&#21517;&#33287;&#25919;&#40680;&#36039;&#26009;&#36681;&#32622;&#21040;&#36039;&#26009;&#21015;&#20013;&#12290;</p></li></ol><p>&#30001;&#26044;&#36889;&#20123;&#34389;&#29702;&#27493;&#39519;&#26371;&#25033;&#29992;&#21040;&#27599;&#19968;&#20491;&#36617;&#20837;&#30340;&#35430;&#31639;&#34920;&#65292;&#25152;&#20197;&#25105;&#20497;&#25033;&#35442;&#35201;&#23531;&#20316;&#26041;&#20415;&#37325;&#35079;&#20351;&#29992;&#30340;&#20989;&#25976;&#32068;&#32340;&#31243;&#24335;&#30908;&#12290;</p><h2>&#20989;&#25976;&#30340;&#35215;&#21123;&#33287;&#22519;&#34892;&#27969;&#31243;</h2><p>&#25972;&#40778;&#26684;&#24335;&#30340;&#36039;&#26009;&#26371;&#37341;&#23565;&#19981;&#21516;&#30340;&#36984;&#33289;&#39006;&#22411;&#32780;&#26377;&#25152;&#24046;&#30064;&#65292;&#22240;&#27492;&#26371;&#26377;&#19977;&#20491;&#20989;&#25976;&#65306;</p><ol><li><p>&#32317;&#32113;&#21103;&#32317;&#32113;&#36984;&#33289;&#65306;tidy_president_dataframes() &#20989;&#25976;&#12290;</p></li><li><p>&#21312;&#22495;&#31435;&#27861;&#22996;&#21729;&#36984;&#33289;&#65306;tidy_legislator_dataframes() &#20989;&#25976;&#12290;</p></li><li><p>&#19981;&#20998;&#21312;&#31435;&#27861;&#22996;&#21729;&#36984;&#33289;&#65306;tidy_party_legislator_dataframes() &#20989;&#25976;&#12290;</p></li></ol><p>&#20013;&#36984;&#26371;&#23559;&#27599;&#20491;&#36984;&#33289;&#39006;&#22411;&#30340;&#36039;&#26009;&#37117;&#25552;&#20379;&#33267;&#25237;&#31080;&#25152;&#23652;&#32026;&#65292;&#25237;&#31080;&#25152;&#30340;&#36039;&#26009;&#21152;&#32317;&#24460;&#28858;&#26449;&#37168;&#37324;&#65292;&#26449;&#37168;&#37324;&#30340;&#36039;&#26009;&#21152;&#32317;&#24460;&#28858;&#37129;&#37806;&#34892;&#25919;&#21312;&#65292;&#37129;&#37806;&#34892;&#25919;&#21312;&#30340;&#36039;&#26009;&#21152;&#32317;&#24460;&#28858;&#32291;&#24066;&#65292;&#22240;&#27492;&#22312;&#36039;&#26009;&#30340;&#24409;&#25972;&#37096;&#20998;&#23601;&#26159;&#23559;&#21488;&#28771; 22 &#20491;&#32291;&#24066;&#22402;&#30452;&#21512;&#20341;&#65292;&#23565;&#25033;&#36984;&#33289;&#39006;&#22411;&#21516;&#27171;&#26377;&#19977;&#20491;&#20989;&#25976;&#65306;</p><ol><li><p>&#32317;&#32113;&#21103;&#32317;&#32113;&#36984;&#33289;&#65306;concat_president_dataframes() &#20989;&#25976;&#12290;</p></li><li><p>&#31435;&#27861;&#22996;&#21729;&#36984;&#33289;&#65306;concat_legislator_dataframes() &#20989;&#25976;&#12290;</p></li><li><p>&#25237;&#31080;&#25152;&#36039;&#35338;&#65306;concat_office_dataframes() &#20989;&#25976;&#12290;</p></li></ol><p>&#22312;&#22519;&#34892;&#27969;&#31243;&#30340;&#35215;&#21123;&#19978;&#65292;&#26371;&#30001;&#22402;&#30452;&#21512;&#20341;&#30340;&#20989;&#25976;&#65288;&#26377; concat_ &#21069;&#32180;&#23383;&#65289;&#21435;&#22519;&#34892;&#21407;&#22987;&#36039;&#26009;&#30340;&#36617;&#20837;&#65292;&#20006;&#21628;&#21483;&#34389;&#29702;&#36039;&#26009;&#30340;&#20989;&#25976;&#65288;&#26377; tidy_ &#21069;&#32180;&#23383;&#65289;&#23559;&#36039;&#26009;&#28165;&#29702;&#25104;&#28858;&#25972;&#40778;&#26684;&#24335;&#12290;</p><pre><code>def tidy_president_dataframes():
    ...
    return candidate_df, office_df

def tidy_legislator_dataframes():
    ...
    return candidate_df, office_df

def tidy_party_legislator_dataframes():
    ...
    return candidate_df, office_df

def concat_president_dataframes():
    ...
    return concatenated_president_df, concatenated_office_df

def concat_legislator_dataframes():
    ...
    return concatenated_legislator_df, concatenated_party_legislator_df, concatenated_office_df

def concat_office_dataframes():
    ...
    return concatenated_office_df

president_df, president_office_df = concat_president_dataframes()
legislator_df, party_legislator_df, legislator_office_df = concat_legislator_dataframes()
office_df = concat_office_dataframes(president_office_df, legislator_office_df)</code></pre><h2>&#20989;&#25976;&#22519;&#34892;&#24460;&#30340;&#25104;&#26524;</h2><p>&#22402;&#30452;&#21512;&#20341;&#30340;&#20989;&#25976;&#65288;&#26377; concat_ &#21069;&#32180;&#23383;&#65289;&#22519;&#34892;&#23436;&#30050;&#24460;&#65292;&#25105;&#20497;&#21487;&#20197;&#27298;&#35222;&#22235;&#20491;&#25972;&#40778;&#26684;&#24335;&#30340;&#36039;&#26009;&#26694;&#65292;&#20998;&#21029;&#26159;&#32317;&#32113;&#21103;&#32317;&#32113;&#65306;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wvnr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wvnr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png 424w, https://substackcdn.com/image/fetch/$s_!wvnr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png 848w, https://substackcdn.com/image/fetch/$s_!wvnr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png 1272w, https://substackcdn.com/image/fetch/$s_!wvnr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wvnr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png" width="1456" height="820" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:820,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:269395,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wvnr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png 424w, https://substackcdn.com/image/fetch/$s_!wvnr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png 848w, https://substackcdn.com/image/fetch/$s_!wvnr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png 1272w, https://substackcdn.com/image/fetch/$s_!wvnr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e2aecdc-0b09-422d-9dd4-debaf577e235_1922x1082.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>&#31435;&#27861;&#22996;&#21729;&#65288;&#21547;&#21312;&#22495;&#12289;&#23665;&#22320;&#33287;&#24179;&#22320;&#65289;&#65306;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!463r!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!463r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png 424w, https://substackcdn.com/image/fetch/$s_!463r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png 848w, https://substackcdn.com/image/fetch/$s_!463r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png 1272w, https://substackcdn.com/image/fetch/$s_!463r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!463r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png" width="1456" height="643" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:643,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:306863,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!463r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png 424w, https://substackcdn.com/image/fetch/$s_!463r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png 848w, https://substackcdn.com/image/fetch/$s_!463r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png 1272w, https://substackcdn.com/image/fetch/$s_!463r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f1b0533-d7a4-4d83-ad35-910a30e0feea_2436x1076.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>&#19981;&#20998;&#21312;&#31435;&#27861;&#22996;&#21729;&#65288;&#21363;&#25919;&#40680;&#31080;&#65289;&#65306;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TjGS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TjGS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png 424w, https://substackcdn.com/image/fetch/$s_!TjGS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png 848w, https://substackcdn.com/image/fetch/$s_!TjGS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png 1272w, https://substackcdn.com/image/fetch/$s_!TjGS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TjGS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png" width="1456" height="760" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:760,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:284648,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TjGS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png 424w, https://substackcdn.com/image/fetch/$s_!TjGS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png 848w, https://substackcdn.com/image/fetch/$s_!TjGS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png 1272w, https://substackcdn.com/image/fetch/$s_!TjGS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb350b44c-6526-4a06-82e9-b1795227b5c1_2076x1084.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>&#25237;&#31080;&#25152;&#36039;&#35338;&#65288;&#21547;&#32317;&#32113;&#21103;&#32317;&#32113;&#12289;&#31435;&#27861;&#22996;&#21729;&#33287;&#19981;&#20998;&#21312;&#31435;&#27861;&#22996;&#21729;&#65289;&#65306;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!t3dh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!t3dh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png 424w, https://substackcdn.com/image/fetch/$s_!t3dh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png 848w, https://substackcdn.com/image/fetch/$s_!t3dh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png 1272w, https://substackcdn.com/image/fetch/$s_!t3dh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!t3dh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png" width="1456" height="973" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:973,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:333649,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!t3dh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png 424w, https://substackcdn.com/image/fetch/$s_!t3dh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png 848w, https://substackcdn.com/image/fetch/$s_!t3dh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png 1272w, https://substackcdn.com/image/fetch/$s_!t3dh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6d90616-e99a-4856-93ae-bdef1452b3da_2642x1766.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>&#39006;&#21029;&#30340;&#35215;&#21123;</h2><p>&#30906;&#35469;&#20989;&#25976;&#30340;&#35215;&#21123;&#12289;&#22519;&#34892;&#27969;&#31243;&#20197;&#21450;&#25104;&#26524;&#28961;&#35492;&#20043;&#24460;&#65292;&#25105;&#20497;&#21487;&#20197;&#26356;&#36914;&#19968;&#27493;&#23559;&#31243;&#24335;&#30908;&#32068;&#32340;&#25104;&#28858;&#39006;&#21029; TidyTaiwanElection2024Data&#65292;&#25226;&#21069;&#36848;&#20989;&#25976;&#25972;&#29702;&#28858;&#29289;&#20214;&#26041;&#27861;&#12290;</p><pre><code>class TidyTaiwanElection2024Data:
    def __init__(self):
        ...
    def tidy_president_dataframes(self):
        ...
    def tidy_legislator_dataframes(self):
        ...
    def tidy_party_legislator_dataframes(self):
        ...
    def concat_president_dataframes(self):
        ...
    def concat_legislator_dataframes(self):
        ...
    def get_tidy_dataframes(self):
        ...
    def get_tidy_csv_files(self):
        ...</code></pre><p>&#20316;&#28858;&#39006;&#21029;&#20043;&#24460;&#65292;&#23601;&#21487;&#20197;&#20877;&#29992;&#19968;&#20491;&#29544;&#31435;&#30340;&#27169;&#32068;&#23553;&#35037;&#65292;&#26410;&#20358;&#25171;&#31639;&#37325;&#26032;&#36939;&#34892;&#30340;&#26178;&#20505;&#65292;&#23601;&#21487;&#20197;&#23559;&#39006;&#21029;&#30001;&#27169;&#32068;&#36617;&#20837;&#21040;&#24037;&#20316;&#29872;&#22659;&#65292;&#30452;&#25509;&#21628;&#21483;&#29289;&#20214;&#26041;&#27861;&#21363;&#21487;&#24471;&#21040;&#25972;&#40778;&#26684;&#24335;&#30340;&#36039;&#26009;&#26694;&#33287; CSV &#27284;&#26696;&#12290;</p><pre><code>from tidy_taiwan_election_2024_data import TidyTaiwanElection2024Data

tidy_twn_election_2024_data = TidyTaiwanElection2024Data()
tidy_dataframes = tidy_twn_election_2024_data.get_tidy_dataframes()
tidy_twn_election_2024_data.get_tidy_csv_files()
tidy_dataframes["president"]
tidy_dataframes["legislator"]
tidy_dataframes["party_legislator"]
tidy_dataframes["polling_place"]</code></pre><p>&#23436;&#25104;&#20013;&#36984;&#26371;&#36984;&#33289;&#36039;&#26009;&#25805;&#20316;&#34389;&#29702;&#20043;&#24460;&#65292;&#25105;&#20497;&#23601;&#33021;&#22816;&#22312;&#19979;&#27425;&#30340;&#38651;&#23376;&#22577;&#20013;&#20171;&#32057;&#22914;&#20309;&#25972;&#21512;&#27491;&#35215;&#21270;&#21040;&#25972;&#38598;&#26684;&#24335;&#36039;&#26009;&#20043;&#19978;&#12290;&#31532;&#19977;&#21313;&#20843;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#20013;&#36984;&#26371;&#36984;&#33289;&#36039;&#26009;&#25805;&#20316;&#34389;&#29702;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-thirty-eight-tidy-taiwan-election-2024-data/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-thirty-eight-tidy-taiwan-election-2024-data/comments"><span>Leave a comment</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-thirty-eight-tidy-taiwan-election-2024-data?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-thirty-eight-tidy-taiwan-election-2024-data?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#21487;&#20197;&#40670;&#36984;&#19979;&#21015;&#36899;&#32080;&#21462;&#24471;&#26412;&#31687;&#25991;&#31456;&#23436;&#25972;&#30340;&#31243;&#24335;&#30908;&#33287;&#25972;&#40778;&#26684;&#24335;&#36039;&#26009;&#12290;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/week-thirty-eight-tidy-taiwan-election-2024-data">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：進階的資料處理技法 ]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#19971;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-thirty-seven-advanced-data-wrangling</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-thirty-seven-advanced-data-wrangling</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Fri, 26 Jan 2024 09:30:14 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/97a15a7c-707d-4c32-9bc6-d7a1bb06a18f_400x220.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XN4Y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XN4Y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif 424w, https://substackcdn.com/image/fetch/$s_!XN4Y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif 848w, https://substackcdn.com/image/fetch/$s_!XN4Y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif 1272w, https://substackcdn.com/image/fetch/$s_!XN4Y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XN4Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif" width="400" height="220" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:220,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:487922,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XN4Y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif 424w, https://substackcdn.com/image/fetch/$s_!XN4Y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif 848w, https://substackcdn.com/image/fetch/$s_!XN4Y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif 1272w, https://substackcdn.com/image/fetch/$s_!XN4Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15228e82-3d63-4cab-9fc1-1b58e15b3b5c_400x220.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;giphy.com</figcaption></figure></div><h2>&#36914;&#38542;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;&#19968;&#35261;</h2><p>&#32380;<a href="https://datainpoint.substack.com/p/basic-data-wrangling">&#31532;&#19977;&#21313;&#20845;&#36913;&#30340;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#22522;&#30990;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;</a>&#20043;&#24460;&#65292;&#25509;&#33879;&#35201;&#24478;&#22522;&#30990;&#36993;&#21521;&#36914;&#38542;&#65292;&#20855;&#39636;&#20358;&#35498;&#65292;&#25105;&#20497;&#23559;&#20845;&#31278;&#34389;&#29702;&#26041;&#27861;&#27512;&#39006;&#22312;&#12300;&#36914;&#38542;&#12301;&#37096;&#20998;&#65292;&#20998;&#21029;&#26159;&#65306;</p><ol><li><p>&#23450;&#20301;&#36039;&#26009;&#12290;</p></li><li><p>&#34893;&#29983;&#35336;&#31639;&#27396;&#20301;&#12290;</p></li><li><p>&#34389;&#29702;&#36986;&#28431;&#20540;&#12290;</p></li><li><p>&#34389;&#29702;&#25991;&#23383;&#27396;&#20301;&#12290;</p></li><li><p>&#36681;&#32622;&#36039;&#26009;&#12290;</p></li><li><p>&#21512;&#20341;&#36039;&#26009;&#12290;</p></li></ol><p>&#25509;&#33879;&#25105;&#20497;&#26371;&#20998;&#20845;&#20491;&#23567;&#27573;&#33853;&#31034;&#31684;&#19978;&#36848;&#25216;&#27861;&#65292;&#28858;&#20102;&#33021;&#22816;&#31034;&#31684;&#19978;&#36848;&#36889;&#20123;&#36914;&#38542;&#36039;&#26009;&#34389;&#29702;&#65292;&#25105;&#20497;&#20808;&#36617;&#20837;&#20841;&#20491;&#20786;&#23384;&#22312;&#24037;&#20316;&#30446;&#37636;&#20013;&#30340;&#36887;&#34399;&#20998;&#38548;&#20540;&#27284;&#26696; UID_ISO_FIPS_LookUp_Table.csv &#33287; time_series_covid19_confirmed_global.csv&#12290;</p><pre><code>lookup_table = pd.read_csv("UID_ISO_FIPS_LookUp_Table.csv")
time_series_confirmed = pd.read_csv("time_series_covid19_confirmed_global.csv")
print(lookup_table)
print(time_series_confirmed)</code></pre><h2>&#23450;&#20301;&#36039;&#26009;</h2><p>&#23450;&#20301;&#36039;&#26009;&#30340;&#26041;&#24335;&#26377;&#20841;&#31278;&#65292;&#31532;&#19968;&#31278;&#26159;&#36879;&#36942;&#36039;&#26009;&#30340;&#21015;&#32034;&#24341;&#12289;&#27396;&#32034;&#24341;&#21517;&#31281;&#20358;&#21462;&#24471;&#36039;&#26009;&#65292;&#20351;&#29992; df.loc[row_index, column_index] &#35486;&#27861;&#65288;loc &#26159; location &#30340;&#32302;&#23531;&#65289;&#12290;</p><pre><code>lookup_table.set_index("Combined_Key").loc["Taiwan*", ["Lat", "Long_", "Population"]]</code></pre><p>&#31532;&#20108;&#31278;&#26159;&#36879;&#36942;&#36039;&#26009;&#30340;&#21015;&#30456;&#23565;&#20301;&#32622;&#12289;&#27396;&#30456;&#23565;&#20301;&#32622;&#20358;&#21462;&#24471;&#36039;&#26009;&#65292;&#20351;&#29992; df.iloc[row_number, column_number] &#35486;&#27861;&#65288;iloc &#26159; integer location &#30340;&#32302;&#23531;&#65289;&#12290;</p><pre><code>lookup_table.iloc[782, [8, 9, 11]] </code></pre><h2>&#34893;&#29983;&#35336;&#31639;&#27396;&#20301;</h2><p>&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; Series &#30340; map() &#26041;&#27861;&#20358;&#34893;&#29983;&#35336;&#31639;&#27396;&#20301;&#65292;map() &#26041;&#27861;&#25509;&#21463;&#20841;&#31278;&#36664;&#20837;&#24418;&#24335;&#65292;&#31532;&#19968;&#31278;&#26159;&#36664;&#20837;&#36039;&#26009;&#32080;&#27083; dict&#65292;&#34893;&#29983;&#35336;&#31639;&#30340;&#37007;&#36655;&#23601;&#26159;&#24478; dict &#20013;&#30340; key &#23565;&#25033;&#25104; value&#12290;</p><pre><code>map_dict = {
    "Taiwan*": "Taiwan"
}
time_series_confirmed["Country/Region"].map(map_dict)[249]</code></pre><p>&#31532;&#20108;&#31278;&#26159;&#36664;&#20837;&#20989;&#25976;&#65292;&#36890;&#24120;&#26371;&#20197; lambda &#21311;&#21517;&#20989;&#25976;&#30340;&#24418;&#24335;&#23531;&#20316;&#65292;&#34893;&#29983;&#35336;&#31639;&#30340;&#37007;&#36655;&#23601;&#26159;&#24478; lambda &#25944;&#36848;&#30340;&#36664;&#20837;&#23565;&#25033;&#25104;&#36664;&#20986;&#12290;</p><pre><code>lookup_table["Combined_Key"] = lookup_table["Combined_Key"].map(lambda x: x.replace("*", "") if "*" in x else x)
lookup_table["Country_Region"] = lookup_table["Country_Region"].map(lambda x: x.replace("*", "") if "*" in x else x)
time_series_confirmed["Country/Region"] = time_series_confirmed["Country/Region"].map(lambda x: x.replace("*", "") if "*" in x else x)
lookup_table[lookup_table["Combined_Key"] == "Taiwan"]</code></pre><h2>&#34389;&#29702;&#36986;&#28431;&#20540;</h2><p>&#38754;&#23565;&#36039;&#26009;&#20013;&#30340;&#36986;&#28431;&#20540;&#65292;&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; Series &#30340; isnull() &#26041;&#27861;&#20358;&#21028;&#26039;&#35442;&#36039;&#26009;&#20540;&#26159;&#21542;&#28858;&#36986;&#28431;&#20540;&#65292;&#36664;&#20986;&#30340; Series &#30001;&#24067;&#26519;&#32068;&#25104;&#65292;&#38263;&#24230;&#21644;&#21407;&#22987;&#36664;&#20837;&#30340; Series &#30456;&#21516;&#65292;&#20006;&#33021;&#22816;&#36914;&#19968;&#27493;&#21033;&#29992;&#24067;&#26519;&#30340;&#22825;&#24615;&#65288;False &#28858;&#25972;&#25976; 0&#12289;True &#28858;&#25972;&#25976; 1&#65289;&#21152;&#32317;&#36664;&#20986;&#30340; Series&#65292;&#34249;&#27492;&#26296;&#35299;&#21407;&#22987;&#36664;&#20837;&#30340; Series &#20849;&#26377;&#24190;&#20491;&#36986;&#28431;&#20540;&#12290;</p><pre><code>print(lookup_table["Province_State"].isnull())
print(lookup_table["Province_State"].isnull().sum())</code></pre><p>&#33509;&#26159;&#24076;&#26395;&#21028;&#26039;&#12300;&#38750;&#36986;&#28431;&#20540;&#12301;&#25913;&#25505;&#36000;&#38754;&#34920;&#21015;&#65292;Series &#20134;&#26377;&#23565;&#25033;&#30340; notnull() &#26041;&#27861;&#65292;&#25110;&#32773;&#21487;&#20197;&#20351;&#29992; Series &#30340; NOT &#36939;&#31639;&#31526;&#12300;~&#12301;&#23559;&#36039;&#26009;&#20013;&#30340;&#24067;&#26519;&#21453;&#36681;&#65288;Negate&#65289;&#12290;</p><pre><code>print(lookup_table["Province_State"].notnull())
print(~lookup_table["Province_State"].isnull())</code></pre><p>&#21028;&#26039;&#36986;&#28431;&#20540;&#30340;&#23384;&#22312;&#33287;&#21542;&#20043;&#24460;&#65292;&#25105;&#20497;&#21487;&#20197;&#24478;&#19977;&#31278;&#24460;&#32396;&#34389;&#29702;&#26041;&#24335;&#36984;&#25799;&#65292;&#19968;&#26159;&#19981;&#23565;&#36986;&#28431;&#20540;&#20570;&#34389;&#29702;&#65292;&#27794;&#37679;&#20320;&#20006;&#27794;&#26377;&#30475;&#37679;&#65292;&#30693;&#36947;&#36986;&#28431;&#20540;&#23384;&#22312;&#26044;&#36039;&#26009;&#20043;&#20013;&#20006;&#22312;&#23560;&#26696;&#20013;&#33287;&#23427;&#20849;&#23384;&#19981;&#26159;&#32597;&#35211;&#30340;&#20570;&#27861;&#65307;&#20108;&#26159;&#20351;&#29992; Series &#33287; DataFrame &#30340; dropna() &#26041;&#27861;&#20358;&#21034;&#38500;&#36986;&#28431;&#20540;&#25110;&#32773;&#36986;&#28431;&#20540;&#23384;&#22312;&#30340;&#21015;&#12289;&#36986;&#28431;&#20540;&#23384;&#22312;&#30340;&#27396;&#12290;</p><pre><code>print(lookup_table["Province_State"].dropna())
print(lookup_table.dropna())</code></pre><p>&#19977;&#26159;&#20351;&#29992; Series &#33287; DataFrame &#30340; fillna() &#26041;&#27861;&#23559;&#36986;&#28431;&#20540;&#20197;&#25351;&#23450;&#30340;&#24120;&#25976;&#25110;&#21443;&#25976;&#21462;&#20195;&#12290;</p><pre><code>lookup_table["Province_State"].fillna("No Province State Data")</code></pre><h2>&#34389;&#29702;&#25991;&#23383;&#27396;&#20301;</h2><p>&#38754;&#23565;&#36039;&#26009;&#20013;&#30340;&#25991;&#23383;&#27396;&#20301;&#65292;&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; Series &#24213;&#19979;&#30340; str &#23567;&#27169;&#32068;&#20013;&#30340;&#21508;&#31278;&#25991;&#23383;&#34389;&#29702;&#26041;&#27861;&#65292;&#20363;&#22914; str.capitalize() &#33021;&#22816;&#23559;&#33521;&#25991;&#36681;&#25563;&#28858;&#22823;&#23531;&#38283;&#38957;&#30340;&#26684;&#24335;&#12290;</p><pre><code>lookup_table["Country_Region"].str.capitalize()</code></pre><p>&#32780; str.casefold() &#21063;&#33021;&#22816;&#23559;&#33521;&#25991;&#36681;&#25563;&#28858;&#20840;&#23567;&#23531;&#30340;&#26684;&#24335;&#12290;</p><pre><code>lookup_table["Country_Region"].str.casefold()</code></pre><p>Series &#24213;&#19979;&#30340; str &#23567;&#27169;&#32068;&#26377;&#30526;&#22810;&#30340;&#26041;&#27861;&#21487;&#20197;&#20351;&#29992;&#65292;&#26063;&#32321;&#19981;&#21450;&#20633;&#36617;&#65292;&#30452;&#25509;&#26597;&#25214; Series &#30340;&#26041;&#27861;&#25991;&#20214;&#26159;&#26368;&#23436;&#25972;&#20415;&#25463;&#30340;&#65306;<a href="https://pandas.pydata.org/docs/reference/series.html#string-handling">https://pandas.pydata.org/docs/reference/series.html#string-handling</a></p><h2>&#36681;&#32622;&#36039;&#26009;</h2><p>&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; Pandas &#27169;&#32068;&#30340; melt() &#20989;&#25976;&#23559;&#23532;&#26684;&#24335;&#30340;&#36039;&#26009;&#36681;&#25563;&#28858;&#38263;&#26684;&#24335;&#12290;</p><pre><code>id_variables = ["Province/State", "Country/Region", "Lat", "Long"]
time_series_confirmed_long = pd.melt(time_series_confirmed, 
                                     id_vars=id_variables,
                                     var_name="date",
                                     value_name="cumulative_confirmed"
                                    )
time_series_confirmed_long</code></pre><p>&#20063;&#21487;&#20197;&#20351;&#29992;&#36039;&#26009;&#26694;&#30340; pivot() &#26041;&#27861;&#23559;&#38263;&#26684;&#24335;&#30340;&#36039;&#26009;&#36681;&#25563;&#28858;&#23532;&#26684;&#24335;&#12290;</p><pre><code>time_series_confirmed_wide = time_series_confirmed_long.pivot(columns="date",
                                 index=id_variables,
                                 values="cumulative_confirmed"
                                ).reset_index()
time_series_confirmed_wide = time_series_confirmed_wide.rename_axis(None, axis=1)
time_series_confirmed_wide</code></pre><p>&#38364;&#26044;&#36039;&#26009;&#30340;&#23532;&#26684;&#24335;&#33287;&#38263;&#26684;&#24335;&#32972;&#26223;&#30693;&#35672;&#65292;&#25512;&#34214;&#21487;&#20197;&#38321;&#35712;&#32173;&#22522;&#30334;&#31185;&#30340;&#38913;&#38754;&#65306;https://en.wikipedia.org/wiki/Wide_and_narrow_data</p><h2>&#21512;&#20341;&#36039;&#26009;</h2><p>&#21512;&#20341;&#36039;&#26009;&#30340;&#26041;&#24335;&#20998;&#28858;&#20841;&#31278;&#65292;&#31532;&#19968;&#31278;&#26159;&#21934;&#32020;&#30340;&#22402;&#30452;&#33287;&#27700;&#24179;&#21512;&#20341;&#65292;&#31532;&#20108;&#31278;&#21063;&#26159;&#26681;&#25818;&#30456;&#21516;&#30340;&#27396;&#20301;&#25110;&#21015;&#32034;&#24341;&#27700;&#24179;&#21512;&#20341;&#12290;&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; Pandas &#27169;&#32068;&#30340; concat() &#20989;&#25976;&#36914;&#34892;&#21934;&#32020;&#30340;&#22402;&#30452;&#33287;&#27700;&#24179;&#21512;&#20341;&#12290;</p><pre><code>print(pd.concat((lookup_table["iso2"], lookup_table["iso3"]), axis=0))
print(pd.concat((lookup_table[["iso2"]], lookup_table[["iso3"]]), axis=1))</code></pre><p>&#22914;&#26524;&#35201;&#26681;&#25818;&#30456;&#21516;&#30340;&#27396;&#20301;&#36914;&#34892;&#27700;&#24179;&#21512;&#20341;&#65292;&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; Pandas &#27169;&#32068;&#30340; merge() &#20989;&#25976;&#25351;&#23450;&#23565;&#25033;&#30340;&#27396;&#20301;&#33287;&#21512;&#20341;&#21443;&#25976;&#65292;&#38928;&#35373;&#21512;&#20341;&#21443;&#25976;&#28858;&#20839;&#37096;&#36899;&#32080;&#65288;Inner join&#65289;&#12290;</p><pre><code>time_series_confirmed_long = time_series_confirmed_long[time_series_confirmed_long["Province/State"].isna()]
lookup_table = lookup_table[["iso2", "iso3", "Country_Region"]]
pd.merge(time_series_confirmed_long, lookup_table,
         left_on="Country/Region", right_on="Country_Region")</code></pre><p>&#22914;&#26524;&#35201;&#26681;&#25818;&#30456;&#21516;&#30340;&#21015;&#32034;&#24341;&#36914;&#34892;&#27700;&#24179;&#21512;&#20341;&#65292;&#25105;&#20497;&#21487;&#20197;&#20351;&#29992;&#36039;&#26009;&#26694;&#29289;&#20214;&#30340; join() &#26041;&#27861;&#25351;&#23450;&#21512;&#20341;&#21443;&#25976;&#65292;&#38928;&#35373;&#21512;&#20341;&#21443;&#25976;&#28858;&#24038;&#22806;&#37096;&#36899;&#32080;&#65288; Left outer-join&#65289;&#12290;</p><pre><code>time_series_confirmed_long = time_series_confirmed_long.set_index("Country/Region")
lookup_table = lookup_table.set_index("Country_Region")
time_series_confirmed_long.join(lookup_table)</code></pre><p>&#38364;&#26044;&#36039;&#26009;&#30340;&#36899;&#32080;&#32972;&#26223;&#30693;&#35672;&#65292;&#25512;&#34214;&#21487;&#20197;&#38321;&#35712;&#65306;</p><ol><li><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;<a href="https://datainpoint.substack.com/p/week-ten-advanced-sql">SQL &#30340;&#36914;&#38542;&#26597;&#35426;&#65288;&#31532;&#21313;&#36913;&#65289;</a></p></li><li><p>&#32173;&#22522;&#30334;&#31185;&#30340;&#38913;&#38754;&#65306;<a href="https://en.wikipedia.org/wiki/Join_(SQL)">https://en.wikipedia.org/wiki/Join_(SQL)</a></p></li></ol><p>&#25484;&#25569;&#36914;&#38542;&#30340;&#36039;&#26009;&#25805;&#20316;&#25216;&#24039;&#20043;&#24460;&#65292;&#25105;&#20497;&#23601;&#33021;&#22816;&#22312;&#19979;&#27425;&#30340;&#38651;&#23376;&#22577;&#20013;&#20171;&#32057;&#22914;&#20309;&#25033;&#29992;&#36039;&#26009;&#25805;&#20316;&#25216;&#24039;&#24409;&#25972;&#20013;&#36984;&#26371;&#36984;&#33289;&#36039;&#26009;&#24235;&#12290;&#31532;&#19977;&#21313;&#19971;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#36914;&#38542;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-thirty-seven-advanced-data-wrangling?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-thirty-seven-advanced-data-wrangling?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-thirty-seven-advanced-data-wrangling/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-thirty-seven-advanced-data-wrangling/comments"><span>Leave a comment</span></a></p><div><hr></div><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#21487;&#20197;&#40670;&#36984;&#19979;&#21015;&#36899;&#32080;&#23559;&#26412;&#31687;&#25991;&#31456;&#23436;&#25972;&#30340; Google Colab &#35079;&#35069;&#21040;&#33258;&#24049;&#30340; Google Drive &#20043;&#20013;&#65306;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/week-thirty-seven-advanced-data-wrangling">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：基礎的資料處理技法 ]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#20845;&#36913;]]></description><link>https://datainpoint.substack.com/p/basic-data-wrangling</link><guid isPermaLink="false">https://datainpoint.substack.com/p/basic-data-wrangling</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Thu, 28 Dec 2023 09:30:03 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/438b2bdb-9781-48a6-8aee-72cdb1d9dcf7_480x200.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FZTk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FZTk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png 424w, https://substackcdn.com/image/fetch/$s_!FZTk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png 848w, https://substackcdn.com/image/fetch/$s_!FZTk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png 1272w, https://substackcdn.com/image/fetch/$s_!FZTk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FZTk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png" width="566" height="163" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:163,&quot;width&quot;:566,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16952,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FZTk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png 424w, https://substackcdn.com/image/fetch/$s_!FZTk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png 848w, https://substackcdn.com/image/fetch/$s_!FZTk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png 1272w, https://substackcdn.com/image/fetch/$s_!FZTk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2adc8ae-59aa-463a-8cfd-8495bad6416d_566x163.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://r4ds.had.co.nz/wrangle-intro.html">https://r4ds.had.co.nz/wrangle-intro.html</a></figcaption></figure></div><h2>&#36039;&#26009;&#31185;&#23416;&#30340;&#25033;&#29992;&#22580;&#26223;</h2><p>&#26681;&#25818; Grolemund, G., &amp; Wickham, H. (2017). R for Data Science. O&#8217;Reilly Media. &#36039;&#26009;&#31185;&#23416;&#30340;&#25033;&#29992;&#22580;&#26223;&#33287;&#24037;&#20855;&#38656;&#27714;&#21253;&#21547;&#20845;&#20491;&#38917;&#30446;&#65292;&#20998;&#21029;&#26159;&#65306;</p><ol><li><p>Import &#36039;&#26009;&#36617;&#20837;&#12290;</p></li><li><p>Tidy &#36039;&#26009;&#28165;&#29702;&#12290;</p></li><li><p>Transform &#36039;&#26009;&#36681;&#25563;&#12290;</p></li><li><p>Visualize &#35222;&#35258;&#21270;&#12290;</p></li><li><p>Model &#27169;&#22411;&#12290;</p></li><li><p>Communicate &#28317;&#36890;&#12290;</p></li></ol><p>&#20854;&#20013; Import &#36039;&#26009;&#36617;&#20837;&#12289;Tidy &#36039;&#26009;&#28165;&#29702;&#21152;&#19978; Transform &#36039;&#26009;&#36681;&#25563;&#21448;&#34987;&#21512;&#31281;&#28858; Data Wrangling&#65292;&#33267;&#26044;&#20309;&#35586; Wrangling&#65311;&#36889;&#26159;&#19968;&#31278;&#28304;&#33258;&#32654;&#22283;&#25299;&#33618;&#26178;&#26399;&#65292;&#26044;&#32654;&#22283;&#20013;&#35199;&#37096;&#29983;&#27963;&#30340;&#29275;&#20180;&#22312;&#22280;&#36245;&#29275;&#32650;&#39340;&#26178;&#20505;&#25152;&#20351;&#29992;&#30340;&#32361;&#32034;&#25216;&#24039;&#65292;&#36889;&#20063;&#26159;&#26377;&#19968;&#20491;&#29275;&#20180;&#35122;&#21697;&#29260;&#21483;&#20570; Wrangler &#30340;&#36215;&#28304;&#65292;&#29694;&#20170;&#22810;&#25976;&#30340;&#35712;&#32773;&#21487;&#33021;&#24050;&#32147;&#27794;&#26377;&#20877;&#30475;&#36942;&#20197;&#29275;&#20180;&#29983;&#27963;&#28858;&#20027;&#38988;&#30340;&#22909;&#33802;&#22626;&#38651;&#24433;&#65292;&#19981;&#36942;&#24517;&#23450;&#30475;&#36942; DC Comics &#26997;&#21463;&#27489;&#36814;&#30340;&#31070;&#21147;&#22899;&#36229;&#20154;&#65288;Wonder Woman&#65289;&#20351;&#29992;&#30495;&#29702;&#20043;&#32034;&#65288;The Lasso of Truth&#65289;&#30340;&#33521;&#23039;&#65292;&#36889;&#20491;&#21205;&#20316;&#23601;&#26159; Wrangle&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DSwY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DSwY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif 424w, https://substackcdn.com/image/fetch/$s_!DSwY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif 848w, https://substackcdn.com/image/fetch/$s_!DSwY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif 1272w, https://substackcdn.com/image/fetch/$s_!DSwY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DSwY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif" width="480" height="200" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:200,&quot;width&quot;:480,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:888179,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DSwY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif 424w, https://substackcdn.com/image/fetch/$s_!DSwY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif 848w, https://substackcdn.com/image/fetch/$s_!DSwY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif 1272w, https://substackcdn.com/image/fetch/$s_!DSwY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4486c07e-d743-442b-a01b-79834c34f9d8_480x200.gif 1456w" sizes="100vw"></picture><div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://giphy.com">giphy.com</a></figcaption></figure></div><h2>&#22522;&#30990;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;&#19968;&#35261;</h2><p>&#22522;&#30990;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;&#23601;&#22914;&#21516;&#32080;&#27083;&#21270;&#26597;&#35426;&#35486;&#35328; SQL &#23565;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#36039;&#26009;&#34920;&#30340;&#36039;&#26009;&#25805;&#20316;&#20445;&#30041;&#23383;&#65292;&#20687;&#26159;&#65306;</p><ul><li><p>&#27298;&#35222;&#36039;&#26009;&#12290;</p></li><li><p>SELECT &#36984;&#25799;&#27396;&#20301;&#12290;</p></li><li><p>WHERE &#31721;&#36984;&#35264;&#28204;&#20540;&#12290;</p></li><li><p>ORDER BY &#25490;&#24207;&#36039;&#26009;&#12290;</p></li><li><p>GROUP BY &#20998;&#32068;&#32858;&#21512;&#12290;</p></li></ul><p>&#28858;&#20102;&#33021;&#22816;&#31034;&#31684;&#19978;&#36848;&#36889;&#24190;&#38917;&#22522;&#30990;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861;&#65292;&#25105;&#20497;&#20808;&#36617;&#20837;&#19968;&#20491;&#20786;&#23384;&#22312;&#24037;&#20316;&#30446;&#37636;&#20013;&#36887;&#34399;&#20998;&#38548;&#20540;&#27284;&#26696; movies.csv&#12290;</p><pre><code>movies = pd.read_csv("movies.csv")</code></pre><h2>&#27298;&#35222;&#36039;&#26009;</h2><p>&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; DataFrame &#39006;&#21029;&#25152;&#24314;&#31435;&#23526;&#20363;&#30340;&#22235;&#20491;&#23660;&#24615;&#27298;&#35222;&#36039;&#26009;&#65306;</p><ol><li><p>shape &#23660;&#24615;&#65306;&#27298;&#35222;&#22806;&#22411;&#12290;</p></li><li><p>dtypes &#23660;&#24615;&#65306;&#27298;&#35222;&#21508;&#27396;&#20301;&#30340;&#36039;&#26009;&#39006;&#21029;&#12290;</p></li><li><p>index &#23660;&#24615;&#65306;&#27298;&#35222;&#27599;&#20491;&#35264;&#28204;&#20540;&#23565;&#25033;&#30340;&#21015;&#32034;&#24341;&#65288;Row-index&#65289;&#12290;</p></li><li><p>columns &#23660;&#24615;&#65306;&#27298;&#35222;&#27599;&#20491;&#35722;&#25976;&#23565;&#25033;&#30340;&#27396;&#32034;&#24341;&#65288;Column-index&#65289;&#12290;</p></li></ol><pre><code>print(movies.shape)
print(movies.dtypes)
print(movies.index)
print(movies.columns)</code></pre><p>&#38500;&#20102;&#20197;&#19978;&#36848;&#22235;&#20491;&#23660;&#24615;&#27298;&#35222;&#36039;&#26009;&#65292; &#20063;&#33021;&#22816;&#20351;&#29992; DataFrame &#39006;&#21029;&#25152;&#24314;&#31435;&#23526;&#20363;&#30340;&#22235;&#20491;&#26041;&#27861;&#27298;&#35222;&#36039;&#26009;&#65306;</p><ol><li><p>head() &#26041;&#27861;&#65306;&#22238;&#20659;&#21069; n &#21015;&#35264;&#28204;&#20540;&#12290;</p></li><li><p>tail() &#26041;&#27861;&#65306;&#22238;&#20659;&#24460; n &#21015;&#35264;&#28204;&#20540;&#12290;</p></li><li><p>describe() &#26041;&#27861;&#65306;&#22238;&#20659;&#25976;&#20540;&#39006;&#21029;&#27396;&#20301;&#30340;&#25551;&#36848;&#24615;&#32113;&#35336;&#65292;&#21253;&#21547;&#35336;&#25976;&#12289;&#26368;&#23567;&#20540;&#12289;25 &#20998;&#20301;&#25976;&#12289;&#20013;&#20301;&#25976;&#12289;&#24179;&#22343;&#25976;&#12289;75 &#20998;&#20301;&#25976;&#33287;&#26368;&#22823;&#20540;&#12290;</p></li><li><p>info() &#26041;&#27861;&#65306;&#22238;&#20659;&#36039;&#26009;&#30340;&#35443;&#32048;&#36039;&#35338;&#65292;&#21253;&#21547;&#22806;&#22411;&#12289;&#36039;&#26009;&#39006;&#21029;&#33287;&#27396;&#20301;&#21517;&#31281;&#31561;&#12290;</p></li></ol><pre><code>print(movies.head())
print(movies.tail())
print(movies.describe())
print(movies.info())</code></pre><h2>&#36984;&#25799;&#27396;&#20301;</h2><p>&#36879;&#36942;&#25351;&#23450;&#27396;&#20301;&#21517;&#31281;&#24478;&#36039;&#26009;&#20013;&#36984;&#25799;&#27396;&#20301;&#25104;&#28858;&#19968;&#20491; Series&#12290;</p><pre><code>print(type(movies["title"]))
print(movies["title"])</code></pre><p>&#36879;&#36942;&#20197; list &#21253;&#35037;&#22810;&#20491;&#27396;&#20301;&#21517;&#31281;&#24478;&#36039;&#26009;&#20013;&#36984;&#25799;&#27396;&#20301;&#25104;&#28858;&#19968;&#20491; DataFrame&#12290;</p><pre><code>print(type(movies[["title", "release_year", "rating"]]))
print(movies[["title", "release_year", "rating"]])</code></pre><h2>&#31721;&#36984;&#35264;&#28204;&#20540;</h2><p>&#36879;&#36942;&#38364;&#20418;&#36939;&#31639;&#31526;&#29983;&#25104;&#19968;&#20491;&#30001;&#24067;&#26519;&#20540;&#32068;&#21512;&#32780;&#25104;&#30340; Series&#12290;</p><pre><code>print(movies["release_year"] &gt;= 2020)</code></pre><p>&#20877;&#34249;&#30001;&#21069;&#38754;&#29983;&#25104;&#30340; Series &#24478;&#36039;&#26009;&#20013;&#31721;&#36984;&#20986;&#23565;&#25033;&#24067;&#26519;&#20540;&#28858; True &#30340;&#21015;&#25976;&#12290;</p><pre><code>print(movies[movies["release_year"] &gt;= 2020])</code></pre><h2>&#25490;&#24207;&#36039;&#26009;</h2><p>&#20351;&#29992; DataFrame &#39006;&#21029;&#25152;&#24314;&#31435;&#23526;&#20363;&#30340; sort_values() &#26041;&#27861;&#20381;&#25818;&#27396;&#20301;&#30340;&#22823;&#23567;&#36958;&#22686;&#12289;&#36958;&#28187;&#25490;&#24207;&#12290;</p><pre><code>print(movies.sort_values("release_year"))
print(movies.sort_values("release_year", ascending=False))</code></pre><p>&#20351;&#29992; DataFrame &#39006;&#21029;&#25152;&#24314;&#31435;&#23526;&#20363;&#30340; sort_index() &#26041;&#27861;&#20381;&#25818;&#21015;&#32034;&#24341;&#65288;Row-index&#65289;&#36958;&#22686;&#12289;&#36958;&#28187;&#25490;&#24207;&#12290;</p><pre><code>print(movies.sort_index())
print(movies.sort_index(ascending=False))</code></pre><h2>&#20998;&#32068;&#32858;&#21512;</h2><p>&#36984;&#25799;&#27396;&#20301;&#20006;&#30452;&#25509;&#20351;&#29992; Series &#39006;&#21029;&#25152;&#24314;&#31435;&#23526;&#20363;&#30340;&#32858;&#21512;&#26041;&#27861;&#65292;&#20363;&#22914; sum()&#12289;min()&#12289;mean()&#12289;max() &#25110; count() &#31561;&#29554;&#24471;&#25351;&#23450;&#27396;&#20301;&#30340;&#32858;&#21512;&#20989;&#25976;&#35336;&#31639;&#32080;&#26524;&#12290;</p><pre><code>print(movies["rating"].mean())</code></pre><p>&#20351;&#29992; DataFrame &#39006;&#21029;&#25152;&#24314;&#31435;&#23526;&#20363;&#30340; groupby() &#26041;&#27861;&#23565;&#25351;&#23450;&#27396;&#20301;&#21462;&#29544;&#19968;&#20540;&#19988;&#25490;&#24207;&#65292;&#28982;&#24460;&#36984;&#25799;&#27396;&#20301;&#20006;&#20351;&#29992;&#32858;&#21512;&#26041;&#27861;&#65292;&#29554;&#24471;&#25351;&#23450;&#27396;&#20301;&#30340;&#20998;&#32068;&#32858;&#21512;&#35336;&#31639;&#32080;&#26524;&#12290;</p><pre><code>print(movies.groupby("release_year")["rating"].mean())</code></pre><p>&#25484;&#25569;&#22522;&#30990;&#30340;&#36039;&#26009;&#25805;&#20316;&#25216;&#24039;&#20043;&#24460;&#65292;&#25105;&#20497;&#23601;&#33021;&#22816;&#22312;&#19979;&#27425;&#30340;&#38651;&#23376;&#22577;&#20013;&#20171;&#32057;&#36914;&#38542;&#30340;&#36039;&#26009;&#25805;&#20316;&#25216;&#24039;&#12290;&#31532;&#19977;&#21313;&#20845;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#22522;&#30990;&#30340;&#36039;&#26009;&#34389;&#29702;&#25216;&#27861; &#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#12289;&#35330;&#38321;&#128232;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/basic-data-wrangling/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/basic-data-wrangling/comments"><span>Leave a comment</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/basic-data-wrangling?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/basic-data-wrangling?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><div><hr></div><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2><p>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#21487;&#20197;&#40670;&#36984;&#19979;&#21015;&#36899;&#32080;&#23559;&#26412;&#31687;&#25991;&#31456;&#23436;&#25972;&#30340; Google Colab &#35079;&#35069;&#21040;&#33258;&#24049;&#30340; Google Drive &#20043;&#20013;&#65306;</p>
      <p>
          <a href="https://datainpoint.substack.com/p/basic-data-wrangling">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：Pandas]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#20116;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-thirty-five-pandas</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-thirty-five-pandas</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Thu, 14 Dec 2023 09:00:36 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!O3vU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!O3vU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!O3vU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg 424w, https://substackcdn.com/image/fetch/$s_!O3vU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg 848w, https://substackcdn.com/image/fetch/$s_!O3vU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!O3vU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!O3vU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg" width="1080" height="358" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:358,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12187,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!O3vU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg 424w, https://substackcdn.com/image/fetch/$s_!O3vU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg 848w, https://substackcdn.com/image/fetch/$s_!O3vU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!O3vU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f50cb6-7cae-4b78-90e9-b7a567dc0c77_1080x358.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://pandas.pydata.org/about/citing.html">https://pandas.pydata.org/about/citing.html</a></figcaption></figure></div><h2>Pandas &#33287;&#29066;&#35987;&#30340;&#38364;&#20418;</h2><p>&#22312; Pandas &#27169;&#32068;&#21839;&#19990;&#20197;&#21069;&#65292;Python &#32570;&#23569;&#19968;&#20491;&#33287; Excel &#35430;&#31639;&#34920;&#12289;R data.frame&#12289;SAS Datasets &#25110; Matlab table &#21151;&#33021;&#30456;&#20284;&#30340;&#36039;&#26009;&#32080;&#27083;&#65292;Pandas &#20316;&#32773; Wes McKinney &#35469;&#28858;&#34920;&#26684;&#24335;&#36039;&#26009;&#65288;&#25110;&#31281;&#26377;&#27161;&#31844;&#30340;&#20108;&#32173;&#38499;&#21015; Labeled two-dimensional arrays&#65289;&#26159; Python &#22312;&#36039;&#26009;&#31185;&#23416;&#19978;&#30340;&#26368;&#24460;&#19968;&#22602;&#25340;&#22294;&#65292;&#22240;&#27492;&#20182;&#32080;&#21512;&#20102; Python &#21407;&#29983;&#36039;&#26009;&#32080;&#27083; tuple &#33287; set &#30340;&#29305;&#24615;&#65292;&#21109;&#36896;&#20986; Index &#39006;&#21029;&#65292;&#20006;&#36914;&#19968;&#27493;&#23559; Index &#39006;&#21029;&#25972;&#21512;&#20102; NumPy &#27169;&#32068;&#30340; ndarray &#39006;&#21029;&#65292;&#21109;&#36896;&#20986; Series &#39006;&#21029;&#33287; DataFrame &#39006;&#21029;&#65292;&#20854;&#20013; Series &#39006;&#21029;&#26159;&#22312;&#19968;&#32173;&#38499;&#21015;&#21152;&#19978;&#19968;&#32068;&#27161;&#31844;&#12289;DataFrame &#39006;&#21029;&#26159;&#22312;&#20108;&#32173;&#38499;&#21015;&#21152;&#19978;&#20841;&#32068;&#27161;&#31844;&#12290;</p><p>&#65288;&#27794;&#20160;&#40636;&#29992;&#30340;&#20919;&#30693;&#35672;&#65289;&#22312;&#26356;&#26089;&#26399;&#30340; Pandas &#29256;&#26412;&#20013;&#65292;&#36996;&#26377; Panel &#39006;&#21029;&#26159;&#22312;&#19977;&#32173;&#38499;&#21015;&#21152;&#19978;&#19977;&#32068;&#27161;&#31844;&#65292;&#22240;&#27492; Panel&#12289;DataFrame &#33287; Series &#21462;&#38283;&#38957;&#30340;&#25976;&#20491;&#33521;&#25991;&#23383;&#27597;&#32080;&#21512;&#65292;&#24688;&#24039;&#23601;&#26159; Pandas&#65292;&#26377;&#27492;&#19968;&#35498;&#36889;&#26159;&#27169;&#32068;&#21629;&#21517;&#32227;&#30001;&#65292;&#22240;&#27492; <strong>Pandas &#33287;&#29066;&#35987;&#30340;&#38364;&#20418;&#21487;&#20197;&#35498;&#26159;&#20843;&#31487;&#23376;&#25171;&#19981;&#33879;</strong>&#65292;&#19981;&#36942; Panel &#39006;&#21029;&#24456;&#24555;&#22320;&#34987;&#26820;&#29992;&#65288;Deprecated&#65289;&#65292;&#22240;&#27492;&#29694;&#20170; Pandas &#20027;&#35201;&#30340;&#19977;&#20491;&#39006;&#21029;&#28858; Index&#12289;Series &#33287; DataFrame&#12290;</p><h2>&#23433;&#35037;&#33287;&#36617;&#20837; Pandas</h2><p>Pandas &#30340;&#23433;&#35037;&#21487;&#20197;&#36879;&#36942; pip &#25110;&#32773; conda&#65292;&#22914;&#26524;&#35712;&#32773;&#30340; Python &#26159;&#24478; Python.org &#19979;&#36617;&#30340;&#23601;&#30452;&#25509;&#36879;&#36942; pip &#23433;&#35037;&#65292;&#20551;&#22914;&#26159;&#32004;&#32173;&#23433;&#35336;&#30059;&#30340;&#25104;&#21729;&#65292;Python &#25033;&#35442;&#26159; Miniconda &#29256;&#26412;&#65292;&#37027;&#40636;&#24314;&#35696;&#21487;&#20197;&#36879;&#36942; conda &#23433;&#35037;<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>&#12290;</p><pre><code><code>$ pip install pandas==MAJOR.MINOR.PATCH
$ conda install pandas==MAJOR.MINOR.PATCH</code></code></pre><p>&#22914;&#26524;&#24076;&#26395;&#24478;&#26082;&#26377;&#30340; Pandas &#29256;&#26412;&#26356;&#26032;&#21319;&#32026;&#65292;&#21487;&#20197;&#22312; <code>install</code> &#25351;&#20196;&#20043;&#24460;&#21152;&#19978; <code>-U</code> &#25110; <code>--update-deps</code> &#21443;&#25976;&#12290;</p><pre><code><code>$ pip install -U pandas==MAJOR.MINOR.PATCH
$ conda install -c conda-forge --update-deps pandas==MAJOR.MINOR.PATCH</code></code></pre><p>&#23448;&#26041;&#25991;&#20214;&#24314;&#35696;&#36617;&#20837;&#27169;&#32068;&#30340;&#25152;&#26377;&#21151;&#33021;&#20006;&#19988;&#32302;&#23531;&#28858; <code>pd</code>&#12290;</p><pre><code><code>import pandas as pd</code></code></pre><p>&#21033;&#29992;&#20841;&#20491;&#27169;&#32068;&#20839;&#24314;&#23660;&#24615;&#27298;&#35222; Pandas &#30340;&#23433;&#35037;&#29256;&#26412;&#33287;&#36335;&#24465;&#12290;</p><pre><code><code>print(pd.__version__)
print(pd.__file__)</code></code></pre><h2>&#24590;&#27171;&#23416;&#22909; Pandas</h2><p>&#23416;&#22909; Pandas &#30340;&#38364;&#37749;&#26159;&#29702;&#35299;&#20854;&#26680;&#24515;&#30340;&#19977;&#20491;&#20027;&#35201;&#39006;&#21029;&#20197;&#21450;&#23427;&#30340;&#26681;&#22522;&#39006;&#21029; ndarray&#65292;&#30637;&#35299;&#22235;&#20491;&#39006;&#21029;&#24444;&#27492;&#20043;&#38291;&#30340;&#38364;&#20418;&#65292;&#23601;&#33021;&#25484;&#25569; Pandas &#20837;&#38272;&#33287;&#36914;&#38542;&#30340;&#25216;&#24039;&#12290;</p><ul><li><p>NumPy &#30340; ndarray &#39006;&#21029;&#26159;&#19968;&#31278;&#21487;&#20197;&#36914;&#34892;&#21521;&#37327;&#21270;&#36939;&#31639;&#30340;&#22810;&#32173;&#24230;&#38499;&#21015;&#12290;</p></li><li><p>Pandas &#30340; Index &#39006;&#21029;&#26159;&#19968;&#31278;&#32080;&#21512;&#20102; Python &#21407;&#29983;&#36039;&#26009;&#32080;&#27083; tuple &#33287; set &#29305;&#24615;&#30340;&#19968;&#32173;&#36039;&#26009;&#32080;&#27083;&#12290;</p></li><li><p>Pandas &#30340; Series &#39006;&#21029;&#26159;&#22312;&#19968;&#32173; ndarray &#19978;&#28155;&#21152;&#19968;&#32068; Index &#39006;&#21029;&#30340;&#36039;&#26009;&#32080;&#27083;&#12290;</p></li><li><p>Pandas &#30340; DataFrame &#39006;&#21029;&#26159;&#22312;&#20108;&#32173; ndarray &#19978;&#28155;&#21152;&#20841;&#32068; Index &#39006;&#21029;&#30340;&#36039;&#26009;&#32080;&#27083;&#65292;&#20063;&#21487;&#20197;&#24819;&#25104;&#25976;&#20491; Series &#39006;&#21029;&#20849;&#20139;&#30456;&#21516;&#30340; Index &#39006;&#21029;&#12290;</p></li></ul><h2>&#22914;&#20309;&#21109;&#36896; Index</h2><p>&#20197; Index &#39006;&#21029;&#36681;&#25563;&#19968;&#32173;&#36039;&#26009;&#32080;&#27083;&#21109;&#36896; Index&#12290;</p><pre><code>primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
prime_indices = pd.Index(primes)
print(prime_indices)
print(type(prime_indices))</code></pre><p>Index &#39006;&#21029;&#20855;&#20633;&#20102; Python &#21407;&#29983;&#36039;&#26009;&#32080;&#27083; tuple &#33287; set &#29305;&#24615;&#65292;&#25105;&#20497;&#39318;&#20808;&#35264;&#23519;&#23427;&#30340; tuple &#29305;&#24615;&#65306;&#19981;&#21487;&#26356;&#21205;&#65288;Immutable&#65289;&#12290;</p><pre><code>try:
    prime_indices[-1] = 31
except TypeError as e:
    print(e)</code></pre><p>&#25509;&#33879;&#25105;&#20497;&#20877;&#35264;&#23519;&#23427;&#30340; set &#29305;&#24615;&#65306;&#38598;&#21512;&#36939;&#31639;&#65288;Set operation&#65289;&#12290;</p><pre><code>odds = range(1, 30, 2)
odd_indices = pd.Index(odds)
print(prime_indices.intersection(odd_indices))
print(prime_indices.union(odd_indices))
print(prime_indices.symmetric_difference(odd_indices))
print(prime_indices.difference(odd_indices))
print(odd_indices.difference(prime_indices))</code></pre><h2>&#22914;&#20309;&#21109;&#36896; Series</h2><p>&#20197; Series &#39006;&#21029;&#36681;&#25563;&#19968;&#32173;&#36039;&#26009;&#32080;&#27083;&#21109;&#36896; Series&#12290;</p><pre><code>prime_series = pd.Series(primes)
print(prime_series)
print(type(prime_series))</code></pre><p>&#25105;&#20497;&#39318;&#20808;&#35264;&#23519; Series &#26159;&#22312;&#19968;&#32173; ndarray &#19978;&#28155;&#21152;&#19968;&#32068; Index &#39006;&#21029;&#30340;&#29305;&#24615;&#12290;</p><pre><code>print(type(prime_series.index))
print(type(prime_series.values))</code></pre><p>&#24314;&#31435; Series &#30340;&#26178;&#20505;&#65292;&#25105;&#20497;&#21487;&#20197;&#36984;&#25799;&#33258;&#35330;&#20854;&#28155;&#21152;&#30340; Index &#39006;&#21029;&#65292;&#38928;&#35373;&#26159;&#20351;&#29992;&#24478;&#38646;&#38283;&#22987;&#30340;&#25976;&#21015;&#12290;</p><pre><code>prime_series = pd.Series(primes, index=range(1, 11))
print(prime_series)
print(prime_series.index)</code></pre><p>&#30001;&#26044; Series &#30340;&#32068;&#25104;&#20013;&#26377;&#19968;&#20491; ndarray&#65292;&#22312;&#25805;&#20316;&#19978;&#20855;&#20633;&#20102;&#25152;&#26377; ndarray &#29305;&#24615;&#65292;&#21253;&#21547;&#21521;&#37327;&#21270;&#36939;&#31639;&#12289;&#33775;&#40599;&#32034;&#24341;&#65288;Fancy indexing&#65289;&#20197;&#21450;&#24067;&#26519;&#32034;&#24341;&#65288;Boolean indexing&#65289;&#12290;</p><pre><code>print(prime_series**2) # Vectorization
print(prime_series[[0, 1, 9]]) # Fancy indexing
print(prime_series[prime_series &gt;= 10]) # Boolean indexing</code></pre><h2>&#22914;&#20309;&#21109;&#36896; DataFrame</h2><p>&#20197; DataFrame &#39006;&#21029;&#36681;&#25563;&#20108;&#32173;&#36039;&#26009;&#32080;&#27083;&#25104;&#28858; DataFrame&#65292;&#30001;&#26044; DataFrame &#26159;&#22312;&#20108;&#32173; ndarray &#19978;&#28155;&#21152;&#20841;&#32068; Index &#39006;&#21029;&#30340;&#36039;&#26009;&#32080;&#27083;&#65292;&#22312;&#24314;&#31435;&#30340;&#26178;&#20505;&#25105;&#20497;&#33021;&#22816;&#36984;&#25799;&#20197;&#27396;&#28858;&#21934;&#20301;&#65288;Column-wise&#65289;&#25110;&#32773;&#20197;&#21015;&#28858;&#21934;&#20301;&#65288;Row-wise&#65289;&#20841;&#31278;&#36664;&#20837;&#36039;&#26009;&#30340;&#26041;&#24335;&#12290;</p><p>&#39318;&#20808;&#20197;&#27396;&#28858;&#21934;&#20301;&#36664;&#20837;&#36039;&#26009;&#24314;&#31435; DataFrame&#12290;</p><pre><code>movie_df = pd.DataFrame()
movie_df["title"] = ["The Shawshank Redemption", "The Dark Knight", "Schindler's List", "Forrest Gump", "Inception"]
movie_df["imdb_rating"] = [9.3, 9.0, 8.9, 8.8, 8.7]
print(type(movie_df))
movie_df</code></pre><p>&#20134;&#21487;&#20197;&#21015;&#28858;&#21934;&#20301;&#36664;&#20837;&#36039;&#26009;&#24314;&#31435; DataFrame&#65292;&#21033;&#29992; Python &#21407;&#29983;&#36039;&#26009;&#32080;&#27083; list &#21435;&#32080;&#21512;&#22810;&#32068;&#37749;&#65288;Key&#65289;&#37117;&#30456;&#21516;&#30340; dict&#12290;</p><pre><code>movie_list = [
    {"title": "The Shawshank Redemption", "imdb_rating": 9.3},
    {"title": "The Dark Knight", "imdb_rating": 9.0},
    {"title": "Schindler's List", "imdb_rating": 8.9},
    {"title": "Forrest Gump", "imdb_rating": 8.8},
    {"title": "Inception", "imdb_rating": 8.7}
]
movie_df = pd.DataFrame(movie_list)
print(type(movie_df))
movie_df</code></pre><p>&#25105;&#20497;&#21487;&#20197;&#35264;&#23519;&#21040; DataFrame &#26159;&#22312;&#20108;&#32173; ndarray &#19978;&#28155;&#21152;&#20841;&#32068; Index &#39006;&#21029;&#30340;&#29305;&#24615;&#12290;</p><pre><code>print(type(movie_df.values))
print(type(movie_df.index))
print(type(movie_df.columns))</code></pre><div><hr></div><p>&#20837;&#38272; Pandas &#20043;&#24460;&#65292;&#25105;&#20497;&#23601;&#33021;&#22816;&#22312;&#19979;&#27425;&#30340;&#38651;&#23376;&#22577;&#20013;&#22522;&#30990;&#30340;&#36039;&#26009;&#26694;&#25805;&#20316;&#25216;&#24039;&#12290;&#31532;&#19977;&#21313;&#20116;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;Pandas &#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-thirty-five-pandas/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-thirty-five-pandas/comments"><span>Leave a comment</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-thirty-five-pandas?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-thirty-five-pandas?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2>
      <p>
          <a href="https://datainpoint.substack.com/p/week-thirty-five-pandas">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：NumPy 與矩陣運算 ]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#22235;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-thirty-four-matrix-operation</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-thirty-four-matrix-operation</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Mon, 29 May 2023 08:00:52 GMT</pubDate><enclosure url="https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080 424w, https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080 848w, https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080 1272w, https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080 1456w" sizes="100vw"><img src="https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080" width="1080" height="720" data-attrs="{&quot;src&quot;:&quot;https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;black and white checkered illustration&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="black and white checkered illustration" title="black and white checkered illustration" srcset="https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080 424w, https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080 848w, https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080 1272w, https://images.unsplash.com/photo-1613645695025-20e3f38de4a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0OHx8bWF0cml4JTIwYWxnZWJyYXxlbnwwfHx8fDE2ODUzNDIyMzR8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=1080 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@vlado">Vlado Paunovic</a> on <a href="https://unsplash.com">Unsplash</a></figcaption></figure></div><h2>&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#30340;&#23450;&#32681;</h2><p>&#22312;&#12300;<a href="https://open.substack.com/pub/datainpoint/p/week-thirty-three-numpy?r=8zju4&amp;utm_campaign=post&amp;utm_medium=web">&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;NumPy</a>&#12301;&#25105;&#20497;&#35469;&#35672;&#20102; NumPy &#27169;&#32068;&#32102;&#20104;&#30340; <code>ndarray</code> &#36039;&#26009;&#32080;&#27083;&#65292;&#20786;&#23384;&#21516;&#36074;&#36039;&#26009;&#30340; n &#32173;&#25976;&#20540;&#38499;&#21015;&#25552;&#20379;&#20102;&#33287; Python &#20839;&#24314;&#36039;&#26009;&#32080;&#27083;&#25130;&#28982;&#19981;&#21516;&#30340;&#21151;&#33021;&#38754;&#21521;&#65292;&#21069;&#32773;&#23560;&#27880;&#26044;&#35336;&#31639;&#25928;&#29575;&#12289;&#24460;&#32773;&#21063;&#33879;&#37325;&#26044;&#20786;&#23384;&#24392;&#24615;&#12290;&#20107;&#23526;&#19978; NumPy &#27169;&#32068;&#34987;&#21629;&#21517;&#28858; Numeric Python(or Numerical Python) &#23601;&#24847;&#21619;&#33879;&#36889;&#26159;&#19968;&#20491;&#20301; Python &#23526;&#36368;&#25976;&#20540;&#35336;&#31639;&#30340;&#27169;&#32068;&#65292;&#20063;&#26159;&#31185;&#23416;&#35336;&#31639;&#30340;&#20837;&#38272;&#30938;&#65292;&#31777;&#32780;&#35328;&#20043;&#65292;&#20551;&#20351;&#25105;&#20497;&#25552;&#20986;&#19968;&#20491;&#21839;&#38988;&#65306;&#31350;&#31455;&#26159;&#20160;&#40636;&#21407;&#22240;&#33021;&#22816;&#35731; Python &#24478;&#12300;&#27867;&#29992;&#31243;&#24335;&#35486;&#35328;&#12301;&#25622;&#36523;&#19968;&#35722;&#28858;&#12300;&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#12301;&#21602;&#65311;&#31572;&#26696;&#21628;&#20043;&#27442;&#20986;&#65306;NumPy &#27169;&#32068;&#12290;</p><p>&#30475;&#21040;&#36889;&#35041;&#35712;&#32773;&#19981;&#20813;&#24863;&#21040;&#32013;&#24758;&#65292;&#24590;&#40636;&#35498; Python &#19981;&#26159;&#12300;&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#12301;&#21602;&#65311;Python &#19981;&#26159;&#25976;&#25818;&#20998;&#26512;&#12289;&#36039;&#26009;&#31185;&#23416;&#33287;&#27231;&#22120;&#23416;&#32722;&#30340;&#39318;&#36984;&#31243;&#24335;&#35486;&#35328;&#21966;&#65311;&#36889;&#26178;&#25105;&#20497;&#25033;&#35442;&#35201;&#25506;&#31350;&#12300;&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#12301;&#30340;&#24291;&#32681;&#25110;&#22196;&#26684;&#23450;&#32681;&#65306;</p><blockquote><p>&#24291;&#32681;&#32780;&#35328;&#65292;&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#25351;&#30340;&#26159;&#34987;&#22810;&#25976;&#31185;&#23416;&#30740;&#31350;&#32773;&#29992;&#26044;&#35336;&#31639;&#12289;&#25976;&#23416;&#25110;&#31185;&#23416;&#31243;&#24335;&#35486;&#35328;&#65292;&#22240;&#27492;&#65292;C/C++ &#21644; Python &#21487;&#20197;&#34987;&#35469;&#28858;&#26159;&#24291;&#32681;&#30340;&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#12290;</p><p>&#22196;&#26684;&#23450;&#32681;&#32780;&#35328;&#65292;&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#26159;&#28858;&#25976;&#23416;&#20844;&#24335;&#35336;&#31639;&#20197;&#21450;&#30697;&#38499;&#35336;&#31639;&#32780;&#35373;&#35336;&#12289;&#20778;&#21270;&#30340;&#31243;&#24335;&#35486;&#35328;&#65292;&#36889;&#39006;&#22411;&#30340;&#35486;&#35328;&#19981;&#20677;&#35201;&#20855;&#20633;&#33021;&#22816;&#30456;&#38364;&#30340;&#27169;&#32068;&#33287;&#22871;&#20214;&#65292;&#36996;&#35201;&#20855;&#20633;&#25976;&#23416;&#33287;&#31185;&#23416;&#35336;&#31639;&#30340;&#35486;&#27861;&#65292;&#20363;&#22914;&#65292;C/C++ &#21644; Python &#37117;&#27794;&#26377;&#20839;&#24314;&#30340;&#30697;&#38499;&#36039;&#26009;&#32080;&#27083;&#39006;&#21029;&#65292;&#20134;&#27794;&#26377;&#20839;&#24314;&#30340;&#30697;&#38499;&#36939;&#31639;&#20989;&#25976;&#12289;&#36939;&#31639;&#31526;&#34399;&#65292;&#36889;&#20123;&#21151;&#33021;&#24517;&#38920;&#20208;&#36084;&#27161;&#28310;&#25110;&#32773;&#31532;&#19977;&#26041;&#27169;&#32068;&#33287;&#22871;&#20214;&#25552;&#20379;&#12290;&#22240;&#27492;&#22312;&#22196;&#26684;&#23450;&#32681;&#19979; C/C++ &#21644; Python &#20006;&#19981;&#26159;&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#65292;&#31526;&#21512;&#22196;&#26684;&#23450;&#32681;&#30340;&#31185;&#23416;&#35336;&#31639;&#35486;&#35328;&#21253;&#25324; ALGOL&#12289;APL&#12289;Fortran&#12289;J&#12289;Julia&#12289;Maple&#12289;MATLAB &#21644; R&#12290;</p><p>&#20358;&#28304;&#65306;<a href="https://en.wikipedia.org/wiki/Scientific_programming_language">https://en.wikipedia.org/wiki/Scientific_programming_language</a></p></blockquote><h2>&#22914;&#20309;&#38364;&#32879; ndarray &#33287;&#25976;&#23416;</h2><p><code>ndarray</code> &#36039;&#26009;&#32080;&#27083;&#39006;&#22411;&#30340;&#35373;&#35336;&#21644;&#25976;&#23416;&#23565;&#24453;&#36039;&#26009;&#32173;&#24230;&#30340;&#27010;&#24565;&#19968;&#33268;&#65292;&#22312;&#25976;&#23416;&#19978;&#25105;&#20497;&#26377;&#32020;&#37327;&#12289;&#21521;&#37327;&#12289;&#30697;&#38499;&#33287;&#24373;&#37327;&#20998;&#21029;&#21435;&#25551;&#36848;&#38646;&#32173;&#12289;&#19968;&#32173;&#12289;&#20108;&#32173;&#33287; n &#32173;&#30340;&#36039;&#26009;&#65292;&#22312; <code>ndarray</code> &#30340;&#24314;&#31435;&#19978;&#65292;&#21516;&#27171;&#20063;&#26377;&#38646;&#32173;&#38499;&#21015;&#12289;&#19968;&#32173;&#38499;&#21015;&#12289;&#20108;&#32173;&#38499;&#21015;&#33287; n &#32173;&#38499;&#21015;&#65292;&#25105;&#20497;&#21487;&#20197;&#29992;&#19968;&#24373;&#31034;&#24847;&#22294;&#20358;&#26296;&#35299;&#36039;&#26009;&#32173;&#24230;&#65306;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6vaW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6vaW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6vaW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6vaW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6vaW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6vaW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg" width="880" height="287" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:287,&quot;width&quot;:880,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31873,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6vaW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6vaW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6vaW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6vaW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11bd2846-b7ca-42a2-8ab5-d3688bc5f2b5_880x287.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://dev.to/juancarlospaco/tensors-for-busy-people-315k">https://dev.to/juancarlospaco/tensors-for-busy-people-315k</a></figcaption></figure></div><h2>&#30697;&#38499;&#36939;&#31639;</h2><p>&#30697;&#38499;&#26159;&#19968;&#20491;&#30001;&nbsp;m&nbsp;&#21015;&#65288;row&#65289;n&nbsp;&#27396;&#65288;column&#65289;&#20803;&#32032;&#25152;&#32068;&#25104;&#30340;&#20108;&#32173;&#38499;&#21015;&#65292;&#20854;&#20013;&#19968;&#20491;&#37325;&#35201;&#29992;&#36884;&#26159;&#35299;&#32218;&#24615;&#26041;&#31243;&#32068;&#65292;&#20063;&#24120;&#35211;&#26044;&#25976;&#20540;&#35336;&#31639;&#12289;&#32113;&#35336;&#20998;&#26512;&#33287;&#38651;&#33126;&#31185;&#23416;&#31561;&#65292;&#22312; NumPy &#27169;&#32068;&#20013;&#25105;&#20497;&#23601;&#29992;&#20108;&#32173;&#30340; ndarray &#20358;&#24314;&#31435;&#33287;&#25805;&#20316;&#30697;&#38499;&#65292;&#22240;&#27492;&#20687;&#26159;&#21015;&#21521;&#37327;&#65288;row-vector&#65289;&#25110;&#32773;&#27396;&#21521;&#37327;&#65288;column-vector&#65289;&#38614;&#28982;&#22312;&#21629;&#21517;&#20013;&#26159;&#21521;&#37327;&#65292;&#25105;&#20497;&#20173;&#26371;&#20197;&#22806;&#22411; <code>(1, n)</code> &#25110;&#32773; <code>(m, 1)</code> &#30340;&#20108;&#32173;&#38499;&#21015;&#20358;&#23565;&#25033;&#65292;&#34249;&#27492;&#30906;&#20445;&#32173;&#24230;&#30340;&#19968;&#33268;&#24615;&#12290;</p><pre><code>u = np.array([5, 6, 7, 8]).reshape(-1, 1)
v = np.array([5, 6, 7, 8]).reshape(-1, 1)</code></pre><p><code>ndarray</code> &#33287; <code>list</code> &#30340;&#20854;&#20013;&#19968;&#20491;&#24046;&#30064;&#34389;&#23601;&#22312;&#26044;&#20803;&#32032;&#23565;&#25033;&#36939;&#31639;&#65288;Element-wise&#65289;&#65292;&#26377;&#26178;&#20134;&#31281;&#28858;&#21521;&#37327;&#21270;&#36939;&#31639;&#65288;Vectorization&#65289;&#65292;&#25105;&#20497;&#21487;&#20197;&#35731; <code>ndarray</code> &#21644;&#19968;&#20491;&#32020;&#37327;&#30452;&#25509;&#36939;&#31639;&#12290;</p><pre><code>print(u * 5)
print(v * 6)</code></pre><p>&#24120;&#35211;&#30340;&#30697;&#38499;&#34389;&#29702;&#25216;&#24039;&#28858;&#36681;&#32622;&#65288;Transpose&#65289;&#65292;&#33021;&#22816;&#23559;&#22806;&#22411; <code>(m, n)</code> &#30340;&#30697;&#38499;&#36681;&#25563;&#28858;&#22806;&#22411; <code>(n, m)</code>&#65292;&#36889;&#27171;&#33021;&#20351;&#24471;&#20301;&#26044; m &#21015; n &#27396;&#30340;&#20803;&#32032;&#65292;&#26356;&#21205;&#21040; n &#21015; m &#27396;&#30340;&#20301;&#32622;&#12290;&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; <code>np.transpose()</code> &#20989;&#25976;&#25110;&#32773; <code>ndarray</code> &#30340; <code>T</code> &#23660;&#24615;&#12290;</p><pre><code><code>A = np.arange(1, 7).reshape(2, 3)
transpose_A = np.transpose(A)
A_T = A.T
print(A)
print(transpose_A)
print(A_T)</code></code></pre><p>&#21015;&#21521;&#37327;&#25110;&#27396;&#21521;&#37327;&#30340;&#12300;&#30456;&#20056;&#36939;&#31639;&#12301;&#38500;&#20102;&#20803;&#32032;&#23565;&#25033;&#36939;&#31639;&#22806;&#36996;&#26377;&#30697;&#38499;&#30456;&#20056;&#65292;&#20063;&#23601;&#26159;&#25152;&#35586;&#30340;&#20056;&#31309;&#36939;&#31639;&#65288;Dot product&#65289;&#65292;&#30456;&#20056;&#30340;&#21069;&#25552;&#26159;&#24038;&#20596;&#21521;&#37327;&#30340;&#27396;&#25976;&#21644;&#21491;&#20596;&#21521;&#37327;&#30340;&#21015;&#25976;&#24517;&#38920;&#30456;&#31561;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\vec{u} \\cdot \\vec{v} = \\vec{u}^T \\cdot \\vec{v} \\\\\n= u_1v_1 + \\dots +u_nv_n&quot;,&quot;id&quot;:&quot;OKJMEGWNUE&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\vec{u} \\cdot \\vec{v} = \\vec{u} \\cdot \\vec{v}^T = \\begin{bmatrix} u_1v_1 &amp; \\dots &amp; u_1v_n           \\\\\n       \\vdots &amp; \\ddots           &amp; \\vdots \\\\\n       u_nv_1           &amp; \\dots &amp; u_nv_n \\end{bmatrix}&quot;,&quot;id&quot;:&quot;ECEQVUAWOZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; <code>np.dot()</code> &#20989;&#25976;&#25110;&#32773; <code>ndarray</code> &#30340; <code>dot()</code> &#26041;&#27861;&#20358;&#36914;&#34892;&#27396;&#21521;&#37327;&#30456;&#20056;&#12290;</p><pre><code>print(np.dot(u.T, v))
print(u.dot(v.T))</code></pre><p>&#21516;&#27171;&#30340;&#36947;&#29702;&#65292;&#30697;&#38499;&#30456;&#20056;&#30340;&#21069;&#25552;&#20063;&#26159;&#24038;&#20596;&#30697;&#38499;&#30340;&#27396;&#25976;&#21644;&#21491;&#20596;&#30697;&#38499;&#30340;&#21015;&#25976;&#24517;&#38920;&#30456;&#31561;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;AB = \\begin{bmatrix} a_{11}b_{11} + \\dots + a_{1n}b_{n1} &amp; \\dots &amp; a_{11}b_{1m} + \\dots + a_{1n}b_{nm}           \\\\\n       \\vdots &amp; \\ddots           &amp; \\vdots \\\\\n       a_{m1}b_{11} + \\dots +  a_{mn}b_{n1}          &amp; \\dots &amp; \na_{m1}b_{1m} + \\dots + a_{mn}b_{nm} \\end{bmatrix}&quot;,&quot;id&quot;:&quot;SDKQWSOTQN&quot;}" data-component-name="LatexBlockToDOM"></div><pre><code>A = np.arange(1, 7).reshape(2, 3)
B = np.arange(1, 7).reshape(3, 2)
print(A.dot(B))</code></pre><p>&#21033;&#29992; <code>np.eye()</code> &#20989;&#25976;&#24314;&#31435;&#21934;&#20301;&#30697;&#38499;&#65288;Identity matrix&#65289;&#65292;&#21934;&#20301;&#30697;&#38499;&#26159;&#19968;&#20491;&#26041;&#30697;&#38499;&#65288;&#24847;&#21363;&#21015;&#25976;&#33287;&#27396;&#25976;&#30456;&#31561;&#65289;&#65292;&#20854;&#23565;&#35282;&#32218;&#19978;&#30340;&#20803;&#32032;&#37117;&#26159; 1&#12290;</p><pre><code>I_22 = np.eye(2)
I_33 = np.eye(3)
I_44 = np.eye(4)
print(I_22)
print(I_33)
print(I_44)</code></pre><p>&#21934;&#20301;&#30697;&#38499;&#22312;&#30697;&#38499;&#36939;&#31639;&#20013;&#30340;&#20316;&#29992;&#33287;&#24120;&#25976; 1 &#22312;&#20195;&#25976;&#36939;&#31639;&#20013;&#30340;&#20316;&#29992;&#30456;&#20284;&#65292;&#22312;&#20195;&#25976;&#20013;&#35722;&#25976;&#33287;&#20854;&#20498;&#25976;&#30456;&#20056;&#21487;&#20197;&#24471;&#21040;&#24120;&#25976; 1&#65292;&#35299;&#27492;&#20358;&#27714;&#35299;&#26041;&#31243;&#24335;&#65292;&#20363;&#22914;&#22312;&#35299;&#19979;&#21015;&#20195;&#25976;&#26041;&#31243;&#24335;&#30340;&#26178;&#20505;&#25105;&#20497;&#26371;&#23559;&#31561;&#34399;&#20841;&#37002;&#20056;&#19978; a &#30340;&#20498;&#25976;&#20358;&#27714;&#35299;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;ax = b &quot;,&quot;id&quot;:&quot;YYXQVFAAYV&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x = \\frac{b}{a}&quot;,&quot;id&quot;:&quot;VJFEIFPELY&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#38754;&#23565;&#30697;&#38499;&#20195;&#25976;&#30340;&#26178;&#20505;&#65292;&#30697;&#38499;&#33287;&#20854;&#21453;&#30697;&#38499;&#30456;&#20056;&#21487;&#20197;&#24471;&#21040;&#21934;&#20301;&#30697;&#38499;&#65292;&#22240;&#27492;&#22312;&#35299;&#19979;&#21015;&#30697;&#38499;&#20195;&#25976;&#26041;&#31243;&#24335;&#30340;&#26178;&#20505;&#65292;&#26159;&#23559;&#31561;&#34399;&#20841;&#37002;&#20056;&#19978; A &#30340;&#21453;&#30697;&#38499;&#20358;&#27714;&#35299;&#65292;&#25105;&#20497;&#21487;&#20197;&#20351;&#29992; <code>np.linalg.inv()</code> &#20989;&#25976;&#35336;&#31639; A &#30340;&#21453;&#30697;&#38499;&#12290;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;Ax = B &quot;,&quot;id&quot;:&quot;FJRWTDKJZD&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A^{-1}Ax = A^{-1}B&quot;,&quot;id&quot;:&quot;OBEEOYJEGL&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x = A^{-1}B&quot;,&quot;id&quot;:&quot;XTAEQGSBHX&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#20197;&#19979;&#21015;&#30340;&#32218;&#24615;&#26041;&#31243;&#32068;&#28858;&#20363;&#65306;</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{cases}\n    x + 3y = 5      \\\\\n    x + 2y = 3\n\\end{cases}&quot;,&quot;id&quot;:&quot;ZTTKMGIQSZ&quot;}" data-component-name="LatexBlockToDOM"></div><pre><code>A = np.array([1, 3, 1, 2]).reshape(2, 2)
B = np.array([5, 3]).reshape(2, 1)
inv_A = np.linalg.inv(A)
x = inv_A.dot(B)
print(x)</code></pre><p>&#20837;&#38272;&#30697;&#38499;&#36939;&#31639;&#20043;&#24460;&#65292;&#25105;&#20497;&#23601;&#33021;&#22816;&#22312;&#26410;&#20358;&#30340;&#38651;&#23376;&#22577;&#20013;&#36879;&#36942; <code>ndarray</code> &#36939;&#31639;&#35469;&#35672;&#27231;&#22120;&#23416;&#32722;&#30340;&#36039;&#26009;&#38928;&#34389;&#29702;&#33287;&#27169;&#22411;&#35347;&#32244;&#65292;&#36889;&#36913;&#20063;&#26159;&#25105;&#31532;&#19968;&#27425;&#20351;&#29992;&#20102; Substack &#30340; LaTex &#21151;&#33021;&#65292;&#38750;&#24120;&#38283;&#24515;&#65281;&#22312;&#35469;&#35672;&#20102; NumPy &#33287;&#30697;&#38499;&#36939;&#31639;&#20043;&#24460;&#65292;&#31532;&#19977;&#21313;&#22235;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;</p><p>&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2>
      <p>
          <a href="https://datainpoint.substack.com/p/week-thirty-four-matrix-operation">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：NumPy]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#19977;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-thirty-three-numpy</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-thirty-three-numpy</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Mon, 15 May 2023 07:01:17 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EWSB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EWSB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EWSB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png 424w, https://substackcdn.com/image/fetch/$s_!EWSB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png 848w, https://substackcdn.com/image/fetch/$s_!EWSB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png 1272w, https://substackcdn.com/image/fetch/$s_!EWSB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EWSB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png" width="1445" height="650" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:650,&quot;width&quot;:1445,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:18911,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EWSB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png 424w, https://substackcdn.com/image/fetch/$s_!EWSB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png 848w, https://substackcdn.com/image/fetch/$s_!EWSB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png 1272w, https://substackcdn.com/image/fetch/$s_!EWSB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3fb4c07-cc32-40b7-8238-ef5932b642a9_1445x650.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://github.com/numpy/numpy/tree/main/branding/logo">https://github.com/numpy/numpy/tree/main/branding/logo</a></figcaption></figure></div><h2>&#20160;&#40636;&#26159; NumPy</h2><p>NumPy &#26159; Numeric Python(or Numerical Python)&#30340;&#31777;&#31281;&#65292;&#26159; Python &#26368;&#37325;&#35201;&#30340;&#36039;&#26009;&#31185;&#23416;&#27169;&#32068;&#20043;&#19968;&#12290;NumPy &#21109;&#36896;&#20102;&nbsp;<code>ndarray</code>&nbsp;&#30340;&#36039;&#26009;&#32080;&#27083;&#39006;&#21029;&#20197;&#21450;&#22823;&#37327;&#30340;&#36890;&#29992;&#20989;&#25976;&#33287;&#32858;&#21512;&#20989;&#25976;&#65292;&#35731; Python &#20351;&#29992;&#32773;&#33021;&#22816;&#23565;&#25976;&#21015;&#36914;&#34892;&#24555;&#36895;&#30340;&#25976;&#20540;&#35336;&#31639;&#12289;&#23565;&#25976;&#21015;&#20351;&#29992;&#32113;&#35336;&#20989;&#25976;&#12289;&#36914;&#34892;&#32218;&#24615;&#20195;&#25976;&#36939;&#31639;&#20197;&#21450;&#25805;&#20316;&#38568;&#27231;&#30340;&#27169;&#25836;&#20219;&#21209;&#31561;&#12290;NumPy &#30340;&#21069;&#36523;&#28858;&#20841;&#20491;&#27169;&#32068;&#65292;&#37117;&#26159;&#22312; 1990 &#24180;&#20195;&#20013;&#26399;&#25152;&#35477;&#29983;&#30340; <code>Numeric</code>&nbsp;&#33287;&nbsp;<code>Numarray</code>&nbsp;&#27169;&#32068;&#65292;NumPy &#26044; 2005 &#24180;&#38598;&#20841;&#32773;&#20043;&#22823;&#25104;&#21839;&#19990;&#12290;&#23565; NumPy &#27169;&#32068;&#30340;&#30332;&#23637;&#27511;&#21490;&#26377;&#33288;&#36259;&#30340;&#35712;&#32773;&#21487;&#20197;&#36914;&#19968;&#27493;&#21443;&#32771; Array Programming with NumPy<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> &#20197;&#21450; NumPy - Wikipedia<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>&#12290;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><h2>&#23433;&#35037;&#33287;&#36617;&#20837; NumPy</h2><p>NumPy &#30340;&#23433;&#35037;&#21487;&#20197;&#36879;&#36942; pip &#25110;&#32773; conda&#65292;&#22914;&#26524;&#35712;&#32773;&#30340; Python &#26159;&#24478; Python.org &#19979;&#36617;&#30340;&#23601;&#30452;&#25509;&#36879;&#36942; pip &#23433;&#35037;&#65292;&#20551;&#22914;&#26159;&#32004;&#32173;&#23433;&#35336;&#30059;&#30340;&#25104;&#21729;&#65292;Python &#25033;&#35442;&#26159; Miniconda &#29256;&#26412;&#65292;&#37027;&#40636;&#24314;&#35696;&#21487;&#20197;&#36879;&#36942; conda &#23433;&#35037;<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>&#12290;</p><pre><code>$ pip install numpy==MAJOR.MINOR.PATCH
$ conda install numpy==MAJOR.MINOR.PATCH</code></pre><p>&#22914;&#26524;&#24076;&#26395;&#24478;&#26082;&#26377;&#30340; NumPy &#29256;&#26412;&#26356;&#26032;&#21319;&#32026;&#65292;&#21487;&#20197;&#22312; <code>install</code> &#25351;&#20196;&#20043;&#24460;&#21152;&#19978; <code>-U</code> &#25110; <code>--update-deps</code> &#21443;&#25976;&#12290;</p><pre><code>$ pip install -U numpy==MAJOR.MINOR.PATCH
$ conda install -c conda-forge --update-deps numpy==MAJOR.MINOR.PATCH</code></pre><p>&#23448;&#26041;&#25991;&#20214;&#24314;&#35696;&#36617;&#20837;&#27169;&#32068;&#30340;&#25152;&#26377;&#21151;&#33021;&#20006;&#19988;&#32302;&#23531;&#28858; <code>np</code>&#12290;</p><pre><code>import numpy as np</code></pre><p>&#21033;&#29992;&#20841;&#20491;&#27169;&#32068;&#20839;&#24314;&#23660;&#24615;&#27298;&#35222; NumPy &#30340;&#23433;&#35037;&#29256;&#26412;&#33287;&#36335;&#24465;&#12290;</p><pre><code>print(np.__version__)
print(np.__file__)</code></pre><h2>&#24590;&#27171;&#23416;&#22909; NumPy</h2><p>&#23416;&#22909; NumPy &#30340;&#38364;&#37749;&#26159;&#29702;&#35299;&#20854;&#26680;&#24515;&#21151;&#33021;&#20197;&#21450;&#20027;&#35201;&#25033;&#29992;&#22580;&#26223;&#65306;</p><ul><li><p>&#22914;&#20309;&#20351;&#29992;&nbsp;<code>ndarray</code>&nbsp;&#20358;&#36914;&#34892;&#25976;&#20540;&#25805;&#20316;&#12290;</p></li><li><p>&#22914;&#20309;&#20351;&#29992; NumPy &#23450;&#32681;&#30340;&#20989;&#25976;&#23565;&nbsp;<code>ndarray</code>&nbsp;&#36914;&#34892;&#25976;&#20540;&#36939;&#31639;&#12290;</p></li><li><p>&#22914;&#20309;&#25033;&#29992; <code>ndarray </code>&#26044;&#21521;&#37327;&#12289;&#30697;&#38499;&#20197;&#21450;&#24373;&#37327;&#30340;&#25805;&#20316;&#21450;&#36939;&#31639;&#12290;</p></li><li><p><code>ndarray</code>&nbsp;&#26159;&#20854;&#20182;&#36039;&#26009;&#31185;&#23416;&#27169;&#32068; Pandas&#12289;Matplotlib &#33287; Scikit-Learn &#30340;&#22522;&#30707;&#12290;</p></li></ul><h2>&#22914;&#20309;&#21109;&#36896; ndarray</h2><p>&#24120;&#35211;&#20841;&#31278;&#21109;&#36896; <code>ndarray</code> &#30340;&#26041;&#24335;&#26377;&#65306;&#24478;&#26082;&#26377;&#30340; <code>list</code> &#21109;&#36896;&#25110;&#32773;&#21033;&#29992;&#20989;&#25976;&#21109;&#36896;&#12290;</p><pre><code># Create ndarray from a list
prime_list = [2, 3, 5, 7, 11]
prime_array = np.array(prime_list)
print(prime_array)
print(type(prime_array))</code></pre><p>&#21033;&#29992; NumPy &#23450;&#32681;&#30340;&#20989;&#25976;&#21487;&#20197;&#21109;&#36896;&#20986;&#20839;&#23481;&#20803;&#32032;&#30456;&#21516;&#12289;&#25976;&#21015;&#22411;&#24907;&#20197;&#21450;&#20855;&#20633;&#29305;&#23450;&#20998;&#37197;&#30340; <code>ndarray</code>&#12290;</p><pre><code># Create ndarray with identical elements
print(np.zeros(5, dtype=int))
print(np.ones(5, dtype=float))
print(np.full(5, 6))
# Create ndarray as a sequence
print(np.arange(1, 11, 2))
print(np.linspace(1, 9, 5, dtype=int))
# Create ndarray with a specific distribution
m = 10000
uniform_array = np.random.random(m)
normal_array = np.random.normal(0, 1, m)
randint_array = np.random.randint(1, 7, size=m)
print(uniform_array)
print(normal_array)
print(randint_array)</code></pre><h2>&#24120;&#29992;&#30340; ndarray &#23660;&#24615;</h2><p>&#24120;&#29992;&#30340; <code>ndarray</code> &#23660;&#24615;&#26377;&#22235;&#20491;&#65292;&#20998;&#21029;&#26159;&#65306;</p><ol><li><p><code>ndarray.ndim</code>&nbsp;&#32173;&#24230;&#25976;&#12290;</p></li><li><p><code>ndarray.shape</code>&nbsp;&#22806;&#22411;&#12290;</p></li><li><p><code>ndarray.size</code>&nbsp;&#20803;&#32032;&#20491;&#25976;&#12290;</p></li><li><p><code>ndarray.dtype</code>&nbsp;&#36039;&#26009;&#39006;&#21029;&#12290;</p></li></ol><pre><code>print(prime_array.ndim)
print(prime_array.shape)
print(prime_array.size)
print(prime_array.dtype)</code></pre><h2>&#24478; ndarray &#20013;&#25847;&#21462;&#20803;&#32032;&#12289;&#29255;&#27573;&#30340;&#26041;&#24335;</h2><p>&#21033;&#29992;&#33287; <code>list</code> &#30456;&#21516;&#30340; indexing/slicing &#35486;&#27861;&#12290;</p><pre><code>print(prime_array[0]) # indexing
print(prime_array[0:3:1]) # slicing</code></pre><p>&#21033;&#29992; <code>ndarray</code> &#30340;&#29305;&#24615;&#65292;&#22312;&#20013;&#25324;&#34399;&#20351;&#29992;&#22810;&#20491;&#32034;&#24341;&#21462;&#24471;&#25351;&#23450;&#20301;&#32622;&#30340;&#20803;&#32032;&#12290;</p><pre><code>matrix = np.array([[5, 5],
                   [6, 6],
                   [55, 66]])
print(matrix[2, 1])</code></pre><p>&#21033;&#29992; <code>ndarray</code> &#30340;&#29305;&#24615;&#65292;&#33021;&#22816;&#20197; Fancy indexing &#25110; Boolean indexing &#30340;&#26041;&#24335;&#21462;&#24471;&#25351;&#23450;&#20301;&#32622;&#12289;&#31526;&#21512;&#25351;&#23450;&#26781;&#20214;&#30340;&#20803;&#32032;&#12290;Fancy indexing&#65288;&#33775;&#40599;&#32034;&#24341;&#65311;&#65289;&#25351;&#30340;&#26159;&#20197;&#19968;&#20491; <code>list</code> &#27770;&#23450;&#35201;&#21462;&#24471;&#21738;&#20123;&#20301;&#32622;&#30340;&#20803;&#32032;&#65292;Boolean indexing &#25351;&#30340;&#26159;&#20197;&#19968;&#20491;&#22806;&#22411;&#30456;&#21516;&#12289;&#20805;&#28415;&#24067;&#26519;&#20540;&#30340; <code>ndarray</code> &#20358;&#21462;&#24471;&#23565;&#25033;&#20301;&#32622;&#28858; <code>True</code> &#30340;&#20803;&#32032;&#12290;</p><pre><code># Fancy indexing
print(prime_array[[0, 1, 4]])
# Boolean indexing
print(prime_array % 2 == 1)
print(prime_array[prime_array % 2 == 1])</code></pre><h2>&#24120;&#29992;&#30340; ndarray &#25805;&#20316;</h2><p>&#25105;&#20497;&#24120;&#23565; <code>ndarray</code> &#36914;&#34892;&#30340;&#25805;&#20316;&#26377;&#35519;&#25972;&#22806;&#22411;&#12289;&#21512;&#20341;&#20197;&#21450;&#20998;&#21106;&#12290;&#20351;&#29992; <code>ndarray</code> &#30340; <code>reshape()</code> &#26041;&#27861;&#35519;&#25972;&#25104;&#25351;&#23450;&#22806;&#22411;&#65292;&#22312;&#20854;&#20182;&#32173;&#24230;&#24050;&#32147;&#27770;&#23450;&#26178;&#21487;&#20197;&#26041;&#20415;&#22320;&#25351;&#23450;&nbsp;<code>-1</code>&nbsp;&#32102;&#26368;&#24460;&#19968;&#20491;&#32173;&#24230;&#65307;&#20351;&#29992; <code>ndarray</code> &#30340; <code>ravel()</code> &#26041;&#27861;&#25171;&#24179;&#25104;&#19968;&#32173;&#12290;</p><pre><code>array_range = np.arange(1, 13)
print(array_range) # (12,)
print(array_range.reshape(3, 4))  # (3, 4)
print(array_range.reshape(3, -1)) # (3, 4)
print(array_range.reshape(-1, 4)) # (3, 4)
print(array_range.reshape(3, 4).ravel()) # (12,)</code></pre><p>&#21512;&#20341;&#25805;&#20316;&#33021;&#22816;&#36879;&#36942; <code>np.concatenate()</code> &#20989;&#25976;&#36948;&#25104;&#65292;&#38928;&#35373;&#28858;&#22402;&#30452;&#26041;&#21521;&#30340;&#21512;&#20341;&#65288;&#22686;&#21152;&#21015;&#25976;&#65289;&#65292;&#25351;&#23450;&#21443;&#25976; <code>axis=1</code> &#21063;&#33021;&#22816;&#35519;&#25972;&#28858;&#27700;&#24179;&#26041;&#21521;&#30340;&#21512;&#20341;&#65288;&#22686;&#21152;&#27396;&#20301;&#65289;&#12290;</p><pre><code>array_a = np.arange(1, 5).reshape(2, 2)
array_b = np.arange(5, 9).reshape(2, 2)
print(np.concatenate((array_a, array_b)))
print(np.concatenate((array_a, array_b), axis=1))</code></pre><p>&#20998;&#21106;&#25805;&#20316;&#33021;&#22816;&#36879;&#36942; <code>np.split()</code> &#20989;&#25976;&#36948;&#25104;&#65292;&#38928;&#35373;&#28858;&#22402;&#30452;&#26041;&#21521;&#30340;&#20998;&#21106;&#65292;&#25351;&#23450;&#21443;&#25976; <code>axis=1</code> &#21063;&#33021;&#22816;&#35519;&#25972;&#28858;&#27700;&#24179;&#26041;&#21521;&#30340;&#20998;&#21106;&#12290;</p><pre><code>array_range = np.arange(20).reshape(-1, 2)
upper_array, lower_array = np.split(array_range, 2)
left_array, right_array = np.split(array_range, 2, axis=1)
print(upper_array)
print(lower_array)
print(left_array)
print(right_array)</code></pre><h2>NumPy &#30340;&#25976;&#20540;&#36939;&#31639;&#20989;&#25976;</h2><p>NumPy &#25552;&#20379;&#38750;&#24120;&#35920;&#23500;&#12289;&#33021;&#22816;&#37341;&#23565; <code>ndarray</code> &#36914;&#34892;&#36939;&#31639;&#30340;&#36890;&#29992;&#20989;&#25976;&#12289;&#32858;&#21512;&#20989;&#25976;&#12290;&#36890;&#29992;&#20989;&#25976;&#26159;&#20855;&#20633;&#21521;&#37327;&#21270;&#65288;Vectorized&#65289;&#29305;&#24615;&#30340;&#20989;&#25976;&#65292;&#25509;&#21463;&#22266;&#23450;&#25976;&#37327;&#12289;&#22806;&#22411;&#30340;&#36664;&#20837;&#20006;&#23565;&#25033;&#30456;&#21516;&#25976;&#37327;&#12289;&#22806;&#22411;&#30340;&#36664;&#20986;&#12290;</p><pre><code>array_range = np.arange(10)
print(np.power(array_range, 2))
print(np.exp(array_range))</code></pre><p>&#22914;&#26524;&#38656;&#35201;&#33258;&#34892;&#23450;&#32681;&#33021;&#22816;&#23565; <code>ndarray</code> &#36939;&#31639;&#25033;&#29992;&#30340;&#36890;&#29992;&#20989;&#25976;&#65292;&#21487;&#20197;&#20351;&#29992; <code>np.vectorize()</code> &#20989;&#25976;&#23559;&#21482;&#33021;&#20316;&#29992;&#26044;&#32020;&#37327;&#30340;&#20989;&#25976;&#36681;&#25563;&#28858;&#33021;&#20316;&#29992;&#26044; <code>ndarray</code> &#30340;&#36890;&#29992;&#20989;&#25976;&#12290;</p><pre><code>def is_prime(x):
    number_of_divisors = 0
    for integer in range(1, x + 1):
        if x % integer == 0:
            number_of_divisors += 1
    return number_of_divisors == 2
vectorized_is_prime = np.vectorize(is_prime)
vectorized_is_prime(np.arange(10))</code></pre><p>&#32858;&#21512;&#20989;&#25976;&#21063;&#26159;&#33021;&#22816;&#23559;&#22810;&#20491;&#36039;&#26009;&#20540;&#36664;&#20837;&#25688;&#35201;&#28858;&#21934;&#19968;&#20540;&#36664;&#20986;&#30340;&#20989;&#25976;&#65292;&#22312;&#20351;&#29992; NumPy &#30340;&#32858;&#21512;&#20989;&#25976;&#26178;&#26377;&#20841;&#20491;&#20540;&#24471;&#27880;&#24847;&#30340;&#29305;&#24615;&#65306;&#21487;&#20197;&#27839;&#25351;&#23450;&#30340;&#36600;&#65288;axis&#65289;&#36914;&#34892;&#32858;&#21512;&#12289;&#37341;&#23565;&#21547;&#26377;&nbsp;<code>np.nan</code>&#65288;Not a Number&#65289;&#30340;&nbsp;<code>ndarray</code>&nbsp;&#26377;&#30456;&#23565;&#25033;&#21517;&#31281;&#30340;&#32858;&#21512;&#20989;&#25976;&#21487;&#20197;&#36939;&#31639;&#12290;</p><pre><code># Aggregate along specific axis
array_range = np.arange(1, 16, dtype=float).reshape(3, 5)
print(np.sum(array_range))
print(np.sum(array_range, axis=0))
print(np.sum(array_range, axis=1))
# Similar function names for array with np.nan
array_range[2, 4] = np.nan
print(array_range)
print(np.sum(array_range))
print(np.nansum(array_range))</code></pre><p>&#20837;&#38272; NumPy &#20043;&#24460;&#65292;&#25105;&#20497;&#23601;&#33021;&#22816;&#22312;&#19979;&#27425;&#30340;&#38651;&#23376;&#22577;&#20013;&#36879;&#36942; ndarray &#35469;&#35672;&#32218;&#24615;&#20195;&#25976;&#26368;&#37325;&#35201;&#30340;&#20839;&#23481;&#65306;&#30697;&#38499;&#36939;&#31639;&#12290;</p><p>&#22312;&#35469;&#35672;&#20102; NumPy &#30340;&#26680;&#24515;&#21151;&#33021;&#20197;&#21450;&#20027;&#35201;&#25033;&#29992;&#22580;&#26223;&#20043;&#24460;&#65292;&#31532;&#19977;&#21313;&#19977;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;NumPy &#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;</p><p>&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/subscribe?"><span>Subscribe now</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2>
      <p>
          <a href="https://datainpoint.substack.com/p/week-thirty-three-numpy">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：使用 R 語言載入資料 ]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#20108;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-thirty-two-import-with-r</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-thirty-two-import-with-r</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Thu, 01 Sep 2022 12:01:39 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!r7uh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!r7uh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!r7uh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png 424w, https://substackcdn.com/image/fetch/$s_!r7uh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png 848w, https://substackcdn.com/image/fetch/$s_!r7uh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png 1272w, https://substackcdn.com/image/fetch/$s_!r7uh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!r7uh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png" width="1000" height="620" data-attrs="{&quot;src&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:620,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:77319,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!r7uh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png 424w, https://substackcdn.com/image/fetch/$s_!r7uh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png 848w, https://substackcdn.com/image/fetch/$s_!r7uh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png 1272w, https://substackcdn.com/image/fetch/$s_!r7uh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F342bf5f8-0a40-4b31-aed0-726999a68c7f_1000x620.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://hahow.in/cr/rfiftyplus">R &#35486;&#35328;&#30340; 50+ &#32244;&#32722;</a></figcaption></figure></div><h2>&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#30340;&#30332;&#36215;&#40670;</h2><p>&#36039;&#26009;&#31185;&#23416;&#23478;&#38754;&#23565;&#30340;&#23560;&#26696;&#21487;&#33021;&#26371;&#21253;&#21547;&#19979;&#21015;&#36889;&#20123;&#24037;&#20316;&#20839;&#23481;&#65306;&#20351;&#29992;&#32773;&#30340;&#38656;&#27714;&#30332;&#24819;&#12289;&#33287;&#20351;&#29992;&#32773;&#35342;&#35542;&#38656;&#27714;&#35215;&#26684;&#65292;&#21462;&#24471;&#28204;&#35430;&#36039;&#26009;&#12289;&#36617;&#20837;&#29872;&#22659;&#12289;&#25972;&#29702;&#36039;&#26009;&#12289;&#20351;&#29992;&#22294;&#24418;&#25506;&#32034;&#36039;&#26009;&#12289;&#21033;&#29992;&#27169;&#22411;&#38928;&#28204;&#12289;&#37096;&#32626;&#23560;&#26696;&#21040;&#27491;&#24335;&#29872;&#22659;&#26368;&#24460;&#26159;&#23559;&#23560;&#26696;&#30340;&#20839;&#23481;&#20197;&#28154;&#39023;&#26131;&#25026;&#30340;&#26041;&#24335;&#33287;&#32068;&#32340;&#20839;&#37096;&#20854;&#20182;&#30340;&#22296;&#38538;&#28317;&#36890;&#21450;&#20998;&#20139;&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!04Xz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!04Xz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 424w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 848w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 1272w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!04Xz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png" width="517" height="190" data-attrs="{&quot;src&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:517,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13579,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!04Xz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 424w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 848w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 1272w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 1456w" sizes="100vw"></picture><div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://r4ds.had.co.nz/introduction.html">https://r4ds.had.co.nz/introduction.html</a></figcaption></figure></div><p>&#36617;&#20837;&#36039;&#26009;&#22312;&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#20013;&#25198;&#28436;&#30332;&#36215;&#40670;&#65292;&#22914;&#26524;&#36889;&#20491;&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#30446;&#30340;&#26159;&#21332;&#21161;&#25105;&#20497;&#21046;&#23450;&#36039;&#26009;&#39493;&#21205;&#30340;&#31574;&#30053;&#65288;Data-driven strategy&#65289;&#65292;&#32780;&#38750;&#20506;&#36084;&#30452;&#35258;&#65292;&#37027;&#40636;&#28858;&#23560;&#26696;&#32048;&#24515;&#30436;&#40670;&#36039;&#26009;&#20358;&#28304;&#33287;&#25972;&#29702;&#29554;&#21462;&#26041;&#27861;&#65292;&#21487;&#20197;&#28858;&#23559;&#20358;&#30340;&#27770;&#31574;&#22880;&#22522;&#31337;&#22266;&#30340;&#22522;&#30990;&#12290;&#36039;&#26009;&#24120;&#35211;&#20358;&#28304;&#21253;&#21547;&#65306;</p><ul><li><p>&#32020;&#25991;&#23383;&#27284;&#26696;</p><ul><li><p>&#38750;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;</p></li><li><p>&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;</p><ul><li><p>CSV</p></li><li><p>JSON</p></li><li><p>HTML</p></li></ul></li></ul></li><li><p>&#35430;&#31639;&#34920;</p></li><li><p>&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#31649;&#29702;&#31995;&#32113;&#20013;&#30340;&#36039;&#26009;&#34920;</p></li></ul><h2>&#20351;&#29992; R &#35486;&#35328;&#36617;&#20837;&#32020;&#25991;&#23383;&#27284;&#26696;</h2><p>&#32020;&#25991;&#23383;&#27284;&#26696;&#25351;&#30340;&#26159;&#21482;&#26377;&#25991;&#23383;&#25152;&#27083;&#25104;&#30340;&#38651;&#33126;&#27284;&#26696;&#65292;&#36889;&#20195;&#34920;&#20854;&#20013;&#19981;&#21253;&#21547;&#23383;&#22411;&#30340;&#27171;&#24335;&#25110;&#27573;&#33853;&#27161;&#35352;&#31561;&#65292;&#36889;&#39006;&#22411;&#27284;&#26696;&#26368;&#26126;&#39023;&#30340;&#29305;&#24615;&#23601;&#26159;&#33021;&#22816;&#20351;&#29992;&#26368;&#31777;&#21934;&#30340;&#25991;&#23383;&#32232;&#36655;&#22120;&#65288;&#20363;&#22914; Windows &#30340;&#12300;&#35352;&#20107;&#26412;&#12301;&#12289;macOS &#30340; TextEdit&#65289;&#30452;&#25509;&#38283;&#21855;&#27298;&#35222;&#12290;</p><p>&#32020;&#25991;&#23383;&#27284;&#26696;&#28085;&#33995;&#30340;&#31684;&#22285;&#30456;&#30070;&#24291;&#27867;&#65292;&#33021;&#22816;&#20877;&#21312;&#20998;&#28858;&#38750;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#33287;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#20841;&#22823;&#39006;&#65307;&#32780;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#20134;&#33021;&#20877;&#32048;&#20998;&#20986; JSON&#12289;CSV &#33287; HTML &#31561;&#12290;</p><h3>&#38750;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;</h3><p>&#38750;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#24120;&#29992;&#20358;&#20786;&#23384;&#20687;&#26159;&#25991;&#31456;&#12289;&#21127;&#26412;&#25110;&#31995;&#32113;&#26085;&#35468;&#65288;System logs&#65289;&#31561;&#65292;&#20363;&#22914;&#20786;&#23384;&#22312;&#24037;&#20316;&#30446;&#37636;&#30340;&#32147;&#20856;&#38651;&#24433;&#12300;&#21050;&#28608; 1995&#12301;&#31777;&#20171; the_shawshank_redemption_summaries.txt&#65292;&#25105;&#20497;&#20351;&#29992;&#20839;&#24314;&#30340;&nbsp;<code>readLines()</code>&nbsp;&#20989;&#25976;&#23559;&#27284;&#26696;&#20839;&#23481;&#19968;&#21015;&#19968;&#21015;&#36617;&#20837;&#21040;&#25991;&#23383;&#21521;&#37327;&#20043;&#20013;&#12290;</p><pre><code>text_file_path &lt;- "the_shawshank_redemption_summaries.txt"
the_shawshank_redemption_summaries &lt;- readLines(text_file_path)
print(class(the_shawshank_redemption_summaries))
print(length(the_shawshank_redemption_summaries))
print(the_shawshank_redemption_summaries)</code></pre><h3>&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;</h3><p>&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#25351;&#30340;&#26159;&#36879;&#36942;&#29305;&#23450;&#31526;&#34399;&#35731;&#36039;&#26009;&#33021;&#22816;&#31995;&#32113;&#24615;&#22320;&#20786;&#23384;&#12289;&#35712;&#21462;&#21450;&#34389;&#29702;&#65292;&#20363;&#22914; JSON(JavaScript Object Notation) &#21487;&#20197;&#36879;&#36942;&#22823;&#25324;&#34399; <code>{}</code> &#20786;&#23384;&#37749;&#20540;&#23565;&#25033;&#30340;&#36039;&#26009;&#12289;CSV(Comma Separated Values) &#21487;&#20197;&#36879;&#36942;&#36887;&#34399; <code>,</code> &#20998;&#38548;&#19981;&#21516;&#27396;&#20301;&#12289;HTML(Hyper Text Markup Language) &#21487;&#20197;&#36879;&#36942;&#27161;&#35352; <code>&lt;&gt;&lt;/&gt;</code> &#39023;&#31034;&#19981;&#21516;&#22806;&#22411;&#33287;&#21151;&#33021;&#30340;&#36039;&#26009;&#12290;</p><p>JSON &#26159;&#19968;&#31278;&#36629;&#37327;&#30340;&#36039;&#26009;&#20132;&#25563;&#26684;&#24335;&#65292;&#23565;&#26044;&#20154;&#39006;&#32780;&#35328;&#26159;&#23481;&#26131;&#38321;&#35712;&#21644;&#23531;&#20316;&#30340;&#26684;&#24335;&#65292;&#23565;&#26044;&#38651;&#33126;&#32780;&#35328;&#26159;&#23481;&#26131;&#35299;&#26512;&#21644;&#24314;&#31435;&#30340;&#26684;&#24335;&#65292;&#31777;&#35328;&#20043;&#65292;&#26159;&#19968;&#31278;&#23565;&#20154;&#39006;&#33287;&#38651;&#33126;&#37117;&#21451;&#21892;&#30340;&#32020;&#25991;&#23383;&#26684;&#24335;&#65292;JSON &#38614;&#28982;&#28304;&#26044; JavaScript&#65292;&#20294;&#21371;&#26159;&#29544;&#31435;&#26044;&#35442;&#31243;&#24335;&#35486;&#35328;&#20043;&#22806;&#65292;&#33021;&#22816;&#34987;&#30526;&#22810;&#31243;&#24335;&#35486;&#35328;&#36629;&#39686;&#35299;&#26512;&#21644;&#24314;&#31435;&#30340;&#19968;&#31278;&#29702;&#24819;&#36039;&#26009;&#20132;&#25563;&#26684;&#24335;&#12290;JSON &#21487;&#33021;&#30001;&#20841;&#31278;&#36039;&#26009;&#32080;&#27083;&#32068;&#25104;&#65306;&#37749;&#20540;&#23565;&#25033;&#38364;&#20418;&#33287;&#26377;&#24207;&#21015;&#34920;&#65292;&#21487;&#20197;&#29992; R &#35486;&#35328;&#30340;&nbsp;<code>list</code>&nbsp;&#20358;&#29702;&#35299;&#12290;</p><p>&#25105;&#20497;&#20351;&#29992;&nbsp;<code>rjson</code>&nbsp;&#22871;&#20214;&#20013;&#30340;&nbsp;<code>fromJSON()</code>&nbsp;&#20989;&#25976;&#25351;&#23450;&#21443;&#25976;&nbsp;<code>file</code>&nbsp;&#36617;&#20837;&nbsp;<code>teams_rowbased.json</code>&#12290;</p><pre><code>json_file_path &lt;- "teams_rowbased.json"
teams_json &lt;- rjson::fromJSON(file = json_file_path)
print(class(teams_json))
print(length(teams_json))
print(teams_json[[1]])</code></pre><p>CSV &#26159;&#26368;&#24291;&#27867;&#34987;&#20351;&#29992;&#30340;&#19968;&#31278;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#26684;&#24335;&#65292;&#22240;&#27492;&#36996;&#26377;&#29305;&#23450;&#30340;&#21103;&#27284;&#21517;&nbsp;<code>.csv</code>&#65292;&#25105;&#20497;&#20351;&#29992;&#20839;&#24314;&#30340;&nbsp;<code>read.csv()</code>&nbsp;&#20989;&#25976;&#36617;&#20837;&#12290;</p><pre><code>movies_csv &lt;- read.csv("movies.csv")
print(class(movies_csv))
head(movies_csv)</code></pre><p>HTML &#26159;&#19968;&#31278;&#29992;&#26044;&#24314;&#31435;&#32178;&#38913;&#30340;&#27161;&#28310;&#27161;&#35352;&#35486;&#35328;&#65292;&#24120;&#33287; CSS&#12289;JavaScript &#19968;&#36215;&#34987;&#29992;&#26044;&#35373;&#35336;&#32178;&#38913;&#12289;&#32178;&#38913;&#25033;&#29992;&#31243;&#24335;&#20197;&#21450;&#34892;&#21205;&#25033;&#29992;&#31243;&#24335;&#30340;&#20351;&#29992;&#32773;&#20171;&#38754;&#65292;&#28687;&#35261;&#22120;&#21487;&#20197;&#35712;&#21462; HTML &#27284;&#26696;&#65292;&#20006;&#23559;&#20854;&#28210;&#26579;&#25104;&#35222;&#35258;&#21270;&#32178;&#38913;&#65292;HTML &#25551;&#36848;&#20102;&#19968;&#20491;&#32178;&#31449;&#30340;&#32080;&#27083;&#35486;&#24847;&#38568;&#33879;&#32218;&#32034;&#30340;&#21576;&#29694;&#65292;&#20351;&#20043;&#25104;&#28858;&#19968;&#31278;&#27161;&#35352;&#35486;&#35328;&#32780;&#38750;&#31243;&#24335;&#35486;&#35328;&#12290;&#36617;&#20837; HTML &#26178;&#20351;&#29992;&nbsp;<code>httr</code>&nbsp;&#25645;&#37197;&nbsp;<code>rvest</code>&nbsp;&#22871;&#20214;&#65292;&#21069;&#32773;&#29992;&#26044;&#23565;&#32178;&#38913;&#20282;&#26381;&#22120;&#30332;&#36865;&#35531;&#27714;&#65292;&#24460;&#32773;&#29992;&#26044;&#35299;&#26512; HTML &#30340;&#20839;&#23481;&#12290;</p><p>&#39318;&#20808;&#25105;&#20497;&#36879;&#36942; <code>httr</code> &#22871;&#20214;&#30340; <code>GET()</code> &#20989;&#25976;&#21521; https://www.imdb.com/chart/top &#36889;&#20491;&#32178;&#22336;&#30332;&#36865;&#20102; GET &#35531;&#27714;&#65292;&#20006;&#19988;&#24118;&#33879; Headers &#20351;&#24471;&#22238;&#25033;&#21487;&#20197;&#26159;&#33521;&#25991;&#30340;&#12290;&#28982;&#24460;&#36879;&#36942; <code>rvest</code> &#22871;&#20214;&#30340; <code>read_html()</code> &#20989;&#25976;&#35299;&#26512;&#22238;&#25033;&#30340;&#25991;&#23383;&#65292;&#20006;&#19988;&#21033;&#29992; CSS &#36984;&#25799;&#22120;&#21462;&#24471;&#24819;&#35201;&#30340;&#36039;&#35338;&#65292;&#20363;&#22914;&#35413;&#20998;&#26368;&#39640;&#30340;&#21069; 250 &#37096;&#38651;&#24433;&#21517;&#31281;&#12290;</p><pre><code>r &lt;- httr::GET("https://www.imdb.com/chart/top", add_headers("accept-language" = "en,en-US;q=1"))
imdb_top &lt;- rvest::read_html(r[["content"]])
imdb_top_movie_titles &lt;- imdb_top |&gt; 
  rvest::html_elements(".titleColumn a") |&gt;
  rvest::html_text2()
print(imdb_top_movie_titles)</code></pre><p>&#26377;&#26178;&#20505;&#25105;&#20497;&#24819;&#35201;&#25847;&#21462;&#30340;&#36039;&#35338;&#26159; HTML &#27161;&#35352;&#20013;&#30340;&#23660;&#24615;&#65292;&#20063;&#33021;&#22816;&#25913;&#25505; <code>rvest</code> &#22871;&#20214;&#30340; <code>html_attr()</code> &#20989;&#25976;&#21462;&#24471;&#65292;&#20363;&#22914;&#35413;&#20998;&#26368;&#39640;&#30340;&#21069; 250 &#37096;&#38651;&#24433;&#38913;&#38754;&#36899;&#32080;&#12290;</p><pre><code>imdb_top_movie_links &lt;- imdb_top |&gt; 
  rvest::html_elements(".titleColumn a") |&gt;
  rvest::html_attr("href")
split_movie_links &lt;- strsplit(imdb_top_movie_links, split = "/?", fixed = TRUE)
movie_link_routes &lt;- vector()
for (item in split_movie_links){
  movie_link_routes &lt;- c(movie_link_routes, item[1])
}
imdb_top_movie_links &lt;- paste0("https://www.imdb.com", movie_link_routes)
print(imdb_top_movie_links)</code></pre><h2>&#20351;&#29992; R &#35486;&#35328;&#36617;&#20837;&#35430;&#31639;&#34920;</h2><p>&#35430;&#31639;&#34920;&#26159;&#39006;&#27604;&#32025;&#26412;&#35336;&#31639;&#34920;&#26684;&#30340;&#38651;&#33126;&#36575;&#39636;&#65292;&#30001;&#35377;&#22810;&#21015;&#33287;&#27396;&#25152;&#27083;&#25104;&#30340;&#20786;&#23384;&#26684;&#65292;&#20854;&#20013;&#21487;&#20197;&#23384;&#25918;&#25976;&#20540;&#12289;&#31639;&#24335;&#25110;&#25991;&#23383;&#65292;&#24120;&#35211;&#30340;&#35430;&#31639;&#34920;&#36575;&#39636;&#26377; Microsoft Excel&#12289;macOS Numbers &#33287; Google Sheets&#12290;&#35430;&#31639;&#34920;&#30340;&#27284;&#26696;&#28858;&#19968;&#20491;&#27963;&#38913;&#31807;&#65288;Workbook&#65289;&#12289;&#27963;&#38913;&#31807;&#20013;&#21487;&#20197;&#26377;&#22810;&#20491;&#35430;&#31639;&#34920;&#65288;Spreadsheets&#65289;&#65292;&#25105;&#20497;&#20351;&#29992;&nbsp;<code>readxl</code>&nbsp;&#22871;&#20214;&#30340;&nbsp;<code>read_excel()</code>&nbsp;&#20989;&#25976;&#38928;&#35373;&#35712;&#21462;&#31532;&#19968;&#24373;&#35430;&#31639;&#34920;&#12290;</p><pre><code>excel_file_path &lt;- "imdb.xlsx"
movies_xlsx &lt;- readxl::read_excel(excel_file_path)
print(class(movies_xlsx))
head(movies_xlsx)</code></pre><p>&#30001;&#26044;&#27963;&#38913;&#31807;&#20013;&#21487;&#20197;&#26377;&#22810;&#20491;&#35430;&#31639;&#34920;&#30340;&#35373;&#35336;&#65292;&#36617;&#20837;&#20043;&#21069;&#24314;&#35696;&#20808;&#20351;&#29992;&nbsp;<code>readxl</code>&nbsp;&#22871;&#20214;&#30340;&nbsp;<code>excel_sheets()</code>&nbsp;&#20989;&#25976;&#27298;&#35222;&#27963;&#38913;&#31807;&#20013;&#26377;&#24190;&#20491;&#35430;&#31639;&#34920;&#12290;</p><pre><code>excel_sheets &lt;- readxl::excel_sheets(excel_file_path)
print(excel_sheets)</code></pre><p>&#22312;&nbsp;<code>readxl</code>&nbsp;&#22871;&#20214;&#30340;&nbsp;<code>read_excel()</code>&nbsp;&#20989;&#25976;&#25351;&#23450;&#21443;&#25976;&nbsp;<code>sheet</code>&nbsp;&#36617;&#20837;&#29305;&#23450;&#35430;&#31639;&#34920;&#65292;&#21487;&#20197;&#25509;&#21463;&#35430;&#31639;&#34920;&#21517;&#31281;&#12289;&#20134;&#33021;&#36664;&#20837;&#25972;&#25976;&#65288;&#30001;&#24038;&#37002;&#24478;&#19968;&#38283;&#22987;&#25976;&#20358;&#31532;&#24190;&#24373;&#35430;&#31639;&#34920;&#65289;&#12290;</p><pre><code>casting_xlsx &lt;- readxl::read_excel(excel_file_path, sheet = "casting")
actors_xlsx &lt;- readxl::read_excel(excel_file_path, sheet = 3)
head(casting_xlsx)
head(actors_xlsx)</code></pre><h2>&#20351;&#29992; R &#35486;&#35328;&#36617;&#20837;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#31649;&#29702;&#31995;&#32113;&#20013;&#30340;&#36039;&#26009;&#34920;</h2><p>&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#65288;Relational database&#65289;&#26159;&#22522;&#26044;&#38364;&#32879;&#27169;&#22411;&#25152;&#24314;&#27083;&#30340;&#36039;&#26009;&#24235;&#65292;&#26159;&#20786;&#23384;&#22312;&#38651;&#33126;&#20013;&#30340;&#36039;&#26009;&#38598;&#21512;&#12290;&#19968;&#20491;&#36039;&#26009;&#24235;&#20013;&#36890;&#24120;&#26371;&#26377;&#22810;&#20491;&#36039;&#26009;&#34920;&#65288;Table&#65289;&#33021;&#22816;&#34249;&#21161;&#38598;&#21512;&#36939;&#31639;&#65288;Set operation&#65289;&#31561;&#25976;&#23416;&#26041;&#27861;&#20358;&#34389;&#29702;&#36039;&#26009;&#34920;&#20043;&#38291;&#30340;&#25805;&#20316;&#21644;&#38364;&#32879;&#65292;&#20063;&#33021;&#22816;&#29992;&#20358;&#34920;&#31034;&#29694;&#23526;&#19990;&#30028;&#20013;&#30340;&#21830;&#26989;&#37007;&#36655;&#65292;&#20006;&#33021;&#22816;&#25509;&#21463;&#32080;&#27083;&#21270;&#26597;&#35426;&#35486;&#35328; SQL &#20358;&#36914;&#34892;&#27298;&#32034;&#21644;&#25805;&#20316;&#12290;</p><p>&#25105;&#20497;&#20351;&#29992;&nbsp;<code>DBI</code>&nbsp;&#22871;&#20214;&#30340;&nbsp;<code>dbConnect()</code>&nbsp;&#20989;&#25976;&#24314;&#31435;&#33287;&#36039;&#26009;&#24235;&#30340;&#36899;&#32218;&#65292;&#20006;&#19988;&#36939;&#29992;&nbsp;<code>RSQLite</code>&nbsp;&#22871;&#20214;&#30340;&nbsp;<code>SQLite()</code>&nbsp;&#20989;&#25976;&#20659;&#20837;&#36899;&#32218;&#24341;&#25806;&#65292;&#20877;&#36939;&#29992;&#32080;&#27083;&#21270;&#26597;&#35426;&#35486;&#35328; SQL &#25645;&#37197;&nbsp;<code>DBI</code>&nbsp;&#22871;&#20214;&#30340;&nbsp;<code>dbReadTable()</code>&nbsp;&#20989;&#25976;&#36617;&#20837;&#65292;&#36039;&#26009;&#24235;&#20351;&#29992;&#23436;&#30050;&#20043;&#24460;&#29992;&nbsp;<code>dbDisconnect()</code>&nbsp;&#20989;&#25976;&#23559;&#36899;&#32218;&#38364;&#38281;&#12290;</p><pre><code>connection &lt;- DBI::dbConnect(RSQLite::SQLite(),
                             dbname = "imdb.db")
movies_db &lt;- DBI::dbReadTable(connection, name = "movies")
casting_db &lt;- DBI::dbReadTable(connection, name = "casting")
actors_db &lt;- DBI::dbReadTable(connection, name = "actors")
head(movies_db)
head(casting_db)
head(actors_db)
dbDisconnect(connection)</code></pre><p>&#22312;&#35469;&#35672;&#20102;&#22914;&#20309;&#20351;&#29992; R &#35486;&#35328;&#36617;&#20837;&#32020;&#25991;&#23383;&#27284;&#26696;&#12289;&#35430;&#31639;&#34920;&#33287;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#20013;&#30340;&#36039;&#26009;&#34920;&#20043;&#24460;&#65292;&#31532;&#19977;&#21313;&#20108;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#20351;&#29992; R &#35486;&#35328;&#36617;&#20837;&#36039;&#26009;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;</p><p>&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-thirty-two-import-with-r/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-thirty-two-import-with-r/comments"><span>Leave a comment</span></a></p><h2>&#32004;&#32173;&#23433;&#35336;&#30059;&#23416;&#21729;&#23560;&#21312;</h2>
      <p>
          <a href="https://datainpoint.substack.com/p/week-thirty-two-import-with-r">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[約維安計畫：使用 Python 載入資料]]></title><description><![CDATA[&#31532;&#19977;&#21313;&#19968;&#36913;]]></description><link>https://datainpoint.substack.com/p/week-thirty-one-import-with-python</link><guid isPermaLink="false">https://datainpoint.substack.com/p/week-thirty-one-import-with-python</guid><dc:creator><![CDATA[Yao-Jen Kuo]]></dc:creator><pubDate>Wed, 13 Jul 2022 12:01:26 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!BaYW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BaYW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BaYW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png 424w, https://substackcdn.com/image/fetch/$s_!BaYW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png 848w, https://substackcdn.com/image/fetch/$s_!BaYW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png 1272w, https://substackcdn.com/image/fetch/$s_!BaYW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BaYW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png" width="1456" height="1449" data-attrs="{&quot;src&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/b726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1449,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4416497,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BaYW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png 424w, https://substackcdn.com/image/fetch/$s_!BaYW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png 848w, https://substackcdn.com/image/fetch/$s_!BaYW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png 1272w, https://substackcdn.com/image/fetch/$s_!BaYW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb726e3dc-eaa5-4905-9356-b2ce3d36e112_1704x1696.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://www.ettoday.net/news/20220708/2290245.htm">https://www.ettoday.net/news/20220708/2290245.htm</a></figcaption></figure></div><h2>&#27243;&#31354;&#20986;&#19990;&#30340;&#32887;&#26989;&#65311;</h2><p>&#24478; 2012 &#24180;&#21704;&#20315;&#21830;&#26989;&#35413;&#35542;&#25291;&#20986;&#36039;&#26009;&#31185;&#23416;&#23478;&#65288;Data scientist&#65289;&#26159; 21 &#19990;&#32000;&#26368;&#24615;&#24863;&#30340;&#32887;&#26989;&#37027;&#21051;&#36215;&#65292;&#36039;&#26009;&#31185;&#23416;&#65288;Data science&#65289;&#24478;&#32654;&#22283;&#21521;&#19990;&#30028;&#25458;&#36215;&#30219;&#29378;&#30340;&#28010;&#28526;&#65292;&#19968;&#30452;&#24310;&#32396;&#21040; 2017 &#24180; Deep Mind &#22296;&#38538;&#30340; Alpha Go&#65307;&#36039;&#26009;&#31185;&#23416;&#12289;&#22823;&#25976;&#25818;&#12289;&#20154;&#24037;&#26234;&#24935;&#12289;&#27231;&#22120;&#23416;&#32722;&#33287;&#28145;&#24230;&#23416;&#32722;&#31561;&#23383;&#24409;&#24478;&#22577;&#31456;&#38620;&#35468;&#33287;&#31038;&#32676;&#23186;&#39636;&#21521;&#25105;&#20497;&#22823;&#37327;&#25918;&#36865;&#12290;&#24478;&#26032;&#21109;&#22296;&#38538;&#12289;&#36575;&#39636;&#20844;&#21496;&#12289;&#37329;&#34701;&#26989;&#12289;&#39015;&#21839;&#26989;&#33287;&#35069;&#36896;&#26989;&#38283;&#22987;&#37325;&#26032;&#24605;&#32034;&#36039;&#26009;&#39493;&#21205;&#65288;Data-driven&#65289;&#30340;&#31574;&#30053;&#21046;&#23450;&#65292;&#36914;&#32780;&#26399;&#26395;&#25307;&#21215;&#26356;&#22810;&#21516;&#26178;&#20855;&#20633;&#36575;&#39636;&#24037;&#31243;&#33287;&#32113;&#35336;&#23416;&#20841;&#20491;&#38936;&#22495;&#23560;&#38263;&#30340;&#36039;&#26009;&#31185;&#23416;&#23478;&#65292;&#36896;&#25104;&#23601;&#26989;&#24066;&#22580;&#30340;&#38656;&#27714;&#37327;&#22823;&#22686;&#65292;&#36914;&#32780;&#39493;&#21205;&#20102;&#36039;&#26009;&#31185;&#23416;&#23478;&#30340;&#24180;&#34218;&#25509;&#36817; 14 &#33836;&#32654;&#37329;&#65292;&#19968;&#36493;&#32780;&#25104;&#30717;&#35895;&#26368;&#20855;&#21560;&#24341;&#21147;&#30340;&#32887;&#32570;&#12290;</p><p>&#36039;&#26009;&#31185;&#23416;&#23478;&#20006;&#19981;&#26159;&#19968;&#20491;&#27243;&#31354;&#20986;&#19990;&#30340;&#32887;&#26989;&#65292;90 &#24180;&#20195;&#39080;&#38753;&#20840;&#32654;&#30340;&#38651;&#35222;&#21916;&#21127;&#20845;&#20154;&#34892;&#65288;Friends&#65289;&#65292;&#20854;&#20013;&#19968;&#20491;&#20027;&#35282; Chandler Bing&#65288;&#30001; Matthew Perry &#39166;&#28436;&#65289;&#65292;&#22312;&#21127;&#20013;&#26377;&#19968;&#20491;&#35373;&#23450;&#38750;&#24120;&#26377;&#36259;&#65292;&#37027;&#23601;&#26159;&#20182;&#30340;&#22909;&#26379;&#21451;&#20497;&#27704;&#36960;&#37117;&#35352;&#19981;&#20303;&#20182;&#24478;&#20107;&#20160;&#40636;&#27171;&#30340;&#24037;&#20316;&#12290;&#26377;&#19968;&#22825;&#20182;&#21578;&#35380;&#32769;&#23110; Monica Geller&#65288;&#30001; Courtney Cox &#39166;&#28436;&#65289;&#65292;&#28858;&#20102;&#23478;&#24237;&#25910;&#20837;&#33879;&#24819;&#20182;&#35201;&#22238;&#21435;&#20570;&#20182;&#21407;&#26412;&#30340;&#24037;&#20316;&#65292;&#36889;&#26178; Monica &#36319;&#20182;&#35498;&#65306;</p><blockquote><p>I want you to do something you like, not statistical analysis and data reconfiguration.</p></blockquote><p>&#22914;&#26524; Chandler &#26202; 20 &#24180;&#24478;&#20107;&#20182;&#21407;&#26412;&#30340;&#24037;&#20316;&#65292;&#37027;&#40636;&#32887;&#31281;&#22810;&#21322;&#23601;&#26159;&#36039;&#26009;&#31185;&#23416;&#23478;&#65292;&#38914;&#33879;&#36889;&#20491;&#26368;&#24615;&#24863;&#32887;&#26989;&#30340;&#20809;&#29872;&#65292;&#20063;&#35377;&#36889;&#20301;&#26377;&#40670;&#33178;&#28154;&#21448;&#24996;&#19990;&#23241;&#20439;&#30340;&#20642;&#20249;&#23601;&#19981;&#26371;&#36889;&#40636;&#35342;&#21421;&#20182;&#30340;&#24037;&#20316;&#20102;&#21543;&#65311;</p><h2>&#36039;&#26009;&#31185;&#23416;&#23478;&#30340;&#26085;&#24120;</h2><p>&#37027;&#40636;&#31350;&#31455;&#36039;&#26009;&#31185;&#23416;&#23478;&#30340;&#24037;&#20316;&#32887;&#36012;&#26159;&#20160;&#40636;&#65311;&#36039;&#26009;&#31185;&#23416;&#23478;&#38754;&#23565;&#30340;&#23560;&#26696;&#21487;&#33021;&#26371;&#21253;&#21547;&#19979;&#21015;&#36889;&#20123;&#24037;&#20316;&#20839;&#23481;&#65306;&#20351;&#29992;&#32773;&#30340;&#38656;&#27714;&#30332;&#24819;&#12289;&#33287;&#20351;&#29992;&#32773;&#35342;&#35542;&#38656;&#27714;&#35215;&#26684;&#65292;&#21462;&#24471;&#28204;&#35430;&#36039;&#26009;&#12289;&#36617;&#20837;&#29872;&#22659;&#12289;&#25972;&#29702;&#36039;&#26009;&#12289;&#20351;&#29992;&#22294;&#24418;&#25506;&#32034;&#36039;&#26009;&#12289;&#21033;&#29992;&#27169;&#22411;&#38928;&#28204;&#12289;&#37096;&#32626;&#23560;&#26696;&#21040;&#27491;&#24335;&#29872;&#22659;&#26368;&#24460;&#26159;&#23559;&#23560;&#26696;&#30340;&#20839;&#23481;&#20197;&#28154;&#39023;&#26131;&#25026;&#30340;&#26041;&#24335;&#33287;&#32068;&#32340;&#20839;&#37096;&#20854;&#20182;&#30340;&#22296;&#38538;&#28317;&#36890;&#21450;&#20998;&#20139;&#12290;</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!04Xz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!04Xz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 424w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 848w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 1272w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!04Xz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png" width="517" height="190" data-attrs="{&quot;src&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:517,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13579,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!04Xz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 424w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 848w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 1272w, https://substackcdn.com/image/fetch/$s_!04Xz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F45169bca-798b-478e-a846-4e24c69a8b8a_517x190.png 1456w" sizes="100vw"></picture><div></div></div></a><figcaption class="image-caption">&#20358;&#28304;&#65306;<a href="https://r4ds.had.co.nz/introduction.html">https://r4ds.had.co.nz/introduction.html</a></figcaption></figure></div><p>&#39318;&#20808;&#26159;&#36617;&#20837;&#36039;&#26009;&#65292;&#23559;&#24120;&#35211;&#36039;&#26009;&#26684;&#24335;&#65292;&#21253;&#21547;&#32020;&#25991;&#23383;&#27284;&#26696;&#12289;&#35430;&#31639;&#34920;&#25110;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#31649;&#29702;&#31995;&#32113;&#20013;&#30340;&#36039;&#26009;&#34920;&#65292;&#36879;&#36942;&#8;&#21508;&#24335;&#27169;&#32068;&#12289;&#22871;&#20214;&#36617;&#20837;&#38283;&#30332;&#29872;&#22659;&#65292;&#23436;&#25104;&#36039;&#26009;&#31185;&#23416;&#30340;&#31532;&#19968;&#20491;&#37324;&#31243;&#30865;&#65307;&#22312;&#8;&#38918;&#21033;&#21462;&#24471;&#36039;&#26009;&#20043;&#24460;&#65292;&#22312;&#25484;&#25511;&#36039;&#26009;&#29872;&#31680;&#65288;Wrangle&#65289;&#65292;&#8;&#36879;&#36942;&#23565;&#36039;&#26009;&#32080;&#27083;&#30340;&#35469;&#30693;&#23559;&#21407;&#22411;&#36039;&#26009;&#65288;Raw data&#65289;&#28165;&#29702;&#25972;&#20341;&#28858;&#32202;&#23526;&#20094;&#28136;&#30340;&#24418;&#24335;&#65288;Tidy data&#65289;&#65292;&#36889;&#27171;&#19968;&#33268;&#19988;&#36890;&#29992;&#30340;&#36039;&#26009;&#27171;&#24335;&#33021;&#22816;&#35731;&#36039;&#26009;&#31185;&#23416;&#22296;&#38538;&#38598;&#20013;&#31934;&#21147;&#34389;&#29702;&#8;&#36039;&#26009;&#25506;&#32034;&#21644;&#36039;&#26009;&#38928;&#28204;&#30456;&#38364;&#30340;&#25033;&#29992;&#65307;&#19968;&#26086;&#26377;&#20102;&#32202;&#23526;&#25972;&#28500;&#30340;&#36039;&#26009;&#65292;&#22312;&#25506;&#32034;&#36039;&#26009;&#29872;&#31680;&#65292;&#23559;&#36879;&#36942;&#21033;&#29992;&#35222;&#35258;&#21270;&#27169;&#32068;&#21644;&#22871;&#20214;&#36914;&#34892;&#25506;&#32034;&#24615;&#36039;&#26009;&#20998;&#26512;&#65292;&#36969;&#30070;&#30340;&#8;&#25506;&#32034;&#24615;&#36039;&#26009;&#20998;&#26512;&#21487;&#20197;&#35731;&#36039;&#26009;&#31185;&#23416;&#22296;&#38538;&#25366;&#25496;&#28507;&#34255;&#30340;&#29305;&#24501;&#65292;&#36914;&#32780;&#24310;&#23637;&#23560;&#26696;&#30340;&#31684;&#30087;&#33287;&#27934;&#35211;&#65307;&#22312;&#36039;&#26009;&#24314;&#27169;&#29872;&#31680;&#65292;&#24341;&#20837;&#32113;&#35336;&#20998;&#26512;&#33287;&#27231;&#22120;&#23416;&#32722;&#36889;&#20491;&#36039;&#26009;&#31185;&#23416;&#20013;&#26368;&#21560;&#24341;&#20154;&#12289;&#21152;&#20540;&#31243;&#24230;&#26368;&#22823;&#30340;&#36942;&#31243;&#65292;&#22312;&#23450;&#32681;&#31934;&#30906;&#30340;&#21839;&#38988;&#19979;&#65292;&#28436;&#31639;&#27861;&#21487;&#20197;&#35347;&#32244;&#24050;&#30693;&#36039;&#26009;&#20358;&#20316;&#28858;&#26410;&#30693;&#36039;&#26009;&#38928;&#28204;&#30340;&#8;&#20381;&#25818;&#65307;&#36039;&#26009;&#31185;&#23416;&#30340;&#26368;&#24460;&#19968;&#27493;&#26159;&#28317;&#36890;&#65292;&#36889;&#26159;&#8;&#23560;&#26696;&#30340;&#38364;&#37749;&#37096;&#20998;&#65292;&#22914;&#26524;&#33021;&#22816;&#26377;&#25928;&#22320;&#21521;&#21512;&#20316;&#37096;&#38272;&#65288;&#20687;&#26159;&#29986;&#21697;&#12289;&#34892;&#37559;&#33287;&#31649;&#29702;&#22296;&#38538;&#31561;&#65289;&#31934;&#28310;&#22320;&#20659;&#36948;&#20998;&#26512;&#32080;&#26524;&#65292;&#23559;&#33021;&#39023;&#33879;&#28858;&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#30340;&#25104;&#26524;&#21152;&#20540;&#65292;&#25552;&#21319;&#36039;&#26009;&#31185;&#23416;&#22296;&#38538;&#22312;&#32068;&#32340;&#20839;&#30340;&#20729;&#20540;&#12290;</p><h2>&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#30340;&#30332;&#36215;&#40670;</h2><p>&#36617;&#20837;&#36039;&#26009;&#22312;&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#20013;&#25198;&#28436;&#30332;&#36215;&#40670;&#65292;&#22914;&#26524;&#36889;&#20491;&#36039;&#26009;&#31185;&#23416;&#23560;&#26696;&#30446;&#30340;&#26159;&#21332;&#21161;&#25105;&#20497;&#21046;&#23450;&#36039;&#26009;&#39493;&#21205;&#30340;&#31574;&#30053;&#65288;Data-driven strategy&#65289;&#65292;&#32780;&#38750;&#20506;&#36084;&#30452;&#35258;&#65292;&#37027;&#40636;&#28858;&#23560;&#26696;&#32048;&#24515;&#30436;&#40670;&#36039;&#26009;&#20358;&#28304;&#33287;&#25972;&#29702;&#29554;&#21462;&#26041;&#27861;&#65292;&#21487;&#20197;&#28858;&#23559;&#20358;&#30340;&#27770;&#31574;&#22880;&#22522;&#31337;&#22266;&#30340;&#22522;&#30990;&#12290;&#36039;&#26009;&#24120;&#35211;&#20358;&#28304;&#21253;&#21547;&#65306;</p><ul><li><p>&#32020;&#25991;&#23383;&#27284;&#26696;</p><ul><li><p>&#38750;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;</p></li><li><p>&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;</p><ul><li><p>CSV</p></li><li><p>JSON</p></li><li><p>HTML</p></li></ul></li></ul></li><li><p>&#35430;&#31639;&#34920;</p></li><li><p>&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#31649;&#29702;&#31995;&#32113;&#20013;&#30340;&#36039;&#26009;&#34920;</p></li></ul><h2>&#20351;&#29992; Python &#36617;&#20837;&#32020;&#25991;&#23383;&#27284;&#26696;</h2><p>&#32020;&#25991;&#23383;&#27284;&#26696;&#25351;&#30340;&#26159;&#21482;&#26377;&#25991;&#23383;&#25152;&#27083;&#25104;&#30340;&#38651;&#33126;&#27284;&#26696;&#65292;&#36889;&#20195;&#34920;&#20854;&#20013;&#19981;&#21253;&#21547;&#23383;&#22411;&#30340;&#27171;&#24335;&#25110;&#27573;&#33853;&#27161;&#35352;&#31561;&#65292;&#36889;&#39006;&#22411;&#27284;&#26696;&#26368;&#26126;&#39023;&#30340;&#29305;&#24615;&#23601;&#26159;&#33021;&#22816;&#20351;&#29992;&#26368;&#31777;&#21934;&#30340;&#25991;&#23383;&#32232;&#36655;&#22120;&#65288;&#20363;&#22914; Windows &#30340;&#12300;&#35352;&#20107;&#26412;&#12301;&#12289;macOS &#30340; TextEdit&#65289;&#30452;&#25509;&#38283;&#21855;&#27298;&#35222;&#12290;</p><p>&#32020;&#25991;&#23383;&#27284;&#26696;&#28085;&#33995;&#30340;&#31684;&#22285;&#30456;&#30070;&#24291;&#27867;&#65292;&#33021;&#22816;&#20877;&#21312;&#20998;&#28858;&#38750;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#33287;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#20841;&#22823;&#39006;&#65307;&#32780;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#20134;&#33021;&#20877;&#32048;&#20998;&#20986; JSON&#12289;CSV &#33287; HTML &#31561;&#12290;</p><p>&#38750;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#24120;&#29992;&#20358;&#20786;&#23384;&#20687;&#26159;&#25991;&#31456;&#12289;&#21127;&#26412;&#25110;&#31995;&#32113;&#26085;&#35468;&#65288;System logs&#65289;&#31561;&#65292;&#20363;&#22914;&#20786;&#23384;&#22312;&#24037;&#20316;&#30446;&#37636;&#30340;&#32147;&#20856;&#38651;&#24433;&#12300;&#21050;&#28608; 1995&#12301;&#31777;&#20171; <code>the_shawshank_redemption_summaries.txt</code>&#65292;&#25105;&#20497;&#20351;&#29992;&#20839;&#24314;&#30340;&nbsp;<code>open()</code>&nbsp;&#20989;&#25976;&#38283;&#21855;&#27284;&#26696;&#65292;&#20006;&#23559;&#27284;&#26696;&#20839;&#23481;&#19968;&#21015;&#19968;&#21015;&#36617;&#20837;&#21040; <code>list</code> &#20043;&#20013;&#65292;&#28858;&#20102;&#35731;&#38283;&#27284;&#12289;&#35712;&#27284;&#33287;&#38364;&#27284;&#30340;&#27969;&#31243;&#33021;&#22816;&#19968;&#27683;&#21621;&#25104;&#65292;&#20351;&#29992; <code>with</code> &#25944;&#36848;&#24314;&#31435;&#36039;&#28304;&#31649;&#29702;&#22120;&#30340;&#31243;&#24335;&#21312;&#22602;&#12290;</p><pre><code>text_file_path = "the_shawshank_redemption_summaries.txt"
with open(text_file_path) as file:
    the_shawshank_redemption_summaries = file.readlines()
print(the_shawshank_redemption_summaries)</code></pre><p>&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#25351;&#30340;&#26159;&#36879;&#36942;&#29305;&#23450;&#31526;&#34399;&#35731;&#36039;&#26009;&#33021;&#22816;&#31995;&#32113;&#24615;&#22320;&#20786;&#23384;&#12289;&#35712;&#21462;&#21450;&#34389;&#29702;&#65292;&#20363;&#22914; JSON(JavaScript Object Notation) &#21487;&#20197;&#36879;&#36942;&#22823;&#25324;&#34399; <code>{}</code> &#20786;&#23384;&#37749;&#20540;&#23565;&#25033;&#30340;&#36039;&#26009;&#12289;CSV(Comma Separated Values) &#21487;&#20197;&#36879;&#36942;&#36887;&#34399; <code>,</code> &#20998;&#38548;&#19981;&#21516;&#27396;&#20301;&#12289;HTML(Hyper Text Markup Language) &#21487;&#20197;&#36879;&#36942;&#27161;&#35352; <code>&lt;&gt;&lt;/&gt;</code> &#39023;&#31034;&#19981;&#21516;&#22806;&#22411;&#33287;&#21151;&#33021;&#30340;&#36039;&#26009;&#12290;</p><p>JSON &#26159;&#19968;&#31278;&#36629;&#37327;&#30340;&#36039;&#26009;&#20132;&#25563;&#26684;&#24335;&#65292;&#23565;&#26044;&#20154;&#39006;&#32780;&#35328;&#26159;&#23481;&#26131;&#38321;&#35712;&#21644;&#23531;&#20316;&#30340;&#26684;&#24335;&#65292;&#23565;&#26044;&#38651;&#33126;&#32780;&#35328;&#26159;&#23481;&#26131;&#35299;&#26512;&#21644;&#24314;&#31435;&#30340;&#26684;&#24335;&#65292;&#31777;&#35328;&#20043;&#65292;&#26159;&#19968;&#31278;&#23565;&#20154;&#39006;&#33287;&#38651;&#33126;&#37117;&#21451;&#21892;&#30340;&#32020;&#25991;&#23383;&#26684;&#24335;&#65292;JSON &#38614;&#28982;&#28304;&#26044; JavaScript&#65292;&#20294;&#21371;&#26159;&#29544;&#31435;&#26044;&#35442;&#31243;&#24335;&#35486;&#35328;&#20043;&#22806;&#65292;&#33021;&#22816;&#34987;&#30526;&#22810;&#31243;&#24335;&#35486;&#35328;&#36629;&#39686;&#35299;&#26512;&#21644;&#24314;&#31435;&#30340;&#19968;&#31278;&#29702;&#24819;&#36039;&#26009;&#20132;&#25563;&#26684;&#24335;&#12290;JSON &#21487;&#33021;&#30001;&#20841;&#31278;&#36039;&#26009;&#32080;&#27083;&#32068;&#25104;&#65306;&#37749;&#20540;&#23565;&#25033;&#38364;&#20418;&#33287;&#26377;&#24207;&#21015;&#34920;&#65292;&#21487;&#20197;&#29992; Python &#30340; <code>dict</code> &#33287; <code>list</code> &#20358;&#29702;&#35299;&#12290;&#25105;&#20497;&#20351;&#29992;&nbsp;<code>open()</code>&nbsp;&#20989;&#25976;&#25645;&#37197;&nbsp;<code>with</code>&nbsp;&#25944;&#36848;&#38283;&#21855;&nbsp;<code>teams_rowbased.json&#65292;</code>&#20351;&#29992;&nbsp;<code>json</code> &#27169;&#32068;&#30340; <code>load()</code>&nbsp;&#20989;&#25976;&#23559;&#27284;&#26696;&#20839;&#23481;&#36617;&#20837;&#65292;&#22240;&#28858; JSON &#21487;&#33021;&#30001;&#20841;&#31278;&#36039;&#26009;&#32080;&#27083;&#32068;&#25104;&#65292;&#36664;&#20986;&#29289;&#20214;&#21487;&#33021;&#26159;&nbsp;<code>dict</code>&nbsp;&#25110;&nbsp;<code>list</code>&nbsp;&#39006;&#21029;&#30340;&#23526;&#20363;&#12290;</p><pre><code>json_file_path = "teams_rowbased.json"
with open(json_file_path) as file:
    teams_json = json.load(file)
print(type(teams_json))
print(len(teams_json))
print(type(teams_json[0]))
print(len(teams_json[0]))</code></pre><p>CSV &#26159;&#26368;&#24291;&#27867;&#34987;&#20351;&#29992;&#30340;&#19968;&#31278;&#32080;&#27083;&#21270;&#32020;&#25991;&#23383;&#27284;&#26696;&#26684;&#24335;&#65292;&#22240;&#27492;&#36996;&#26377;&#29305;&#23450;&#30340;&#21103;&#27284;&#21517;&nbsp;<code>.csv&#65292;&#25105;&#20497;</code>&#20351;&#29992;<strong>&nbsp;</strong><code>pandas</code> &#27169;&#32068;&#30340; <code>read_csv()</code>&nbsp;&#20989;&#25976;&#36617;&#20837;&#12290;</p><pre><code>movies_csv = pd.read_csv("movies.csv")
print(type(movies_csv))
movies_csv.head()</code></pre><p>HTML &#26159;&#19968;&#31278;&#29992;&#26044;&#24314;&#31435;&#32178;&#38913;&#30340;&#27161;&#28310;&#27161;&#35352;&#35486;&#35328;&#65292;&#24120;&#33287; CSS&#12289;JavaScript &#19968;&#36215;&#34987;&#29992;&#26044;&#35373;&#35336;&#32178;&#38913;&#12289;&#32178;&#38913;&#25033;&#29992;&#31243;&#24335;&#20197;&#21450;&#34892;&#21205;&#25033;&#29992;&#31243;&#24335;&#30340;&#20351;&#29992;&#32773;&#20171;&#38754;&#65292;&#28687;&#35261;&#22120;&#21487;&#20197;&#35712;&#21462; HTML &#27284;&#26696;&#65292;&#20006;&#23559;&#20854;&#28210;&#26579;&#25104;&#35222;&#35258;&#21270;&#32178;&#38913;&#65292;HTML &#25551;&#36848;&#20102;&#19968;&#20491;&#32178;&#31449;&#30340;&#32080;&#27083;&#35486;&#24847;&#38568;&#33879;&#32218;&#32034;&#30340;&#21576;&#29694;&#65292;&#20351;&#20043;&#25104;&#28858;&#19968;&#31278;&#27161;&#35352;&#35486;&#35328;&#32780;&#38750;&#31243;&#24335;&#35486;&#35328;&#12290;&#36890;&#24120;&#36617;&#20837; HTML &#26178;&#26371;&#20351;&#29992; Requests &#27169;&#32068;&#25645;&#37197; BeautifulSoup4 &#27169;&#32068;&#65292;&#21069;&#32773;&#29992;&#26044;&#23565;&#32178;&#38913;&#20282;&#26381;&#22120;&#30332;&#36865;&#35531;&#27714;&#12289;&#24460;&#32773;&#21063;&#29992;&#26044;&#35299;&#26512; HTML &#30340;&#20839;&#23481;&#12290;</p><pre><code>headers = {
    "accept-language": "en,en-US;q=1"
}
r = requests.get("https://www.imdb.com/chart/top", headers=headers)
soup = BeautifulSoup(r.text)
for elem in soup.select(".titleColumn a"):
    print(elem.text)
for elem in soup.select(".titleColumn a"):
    print(elem.get("href"))</code></pre><h2>&#20351;&#29992; Python &#36617;&#20837;&#35430;&#31639;&#34920;</h2><p>&#35430;&#31639;&#34920;&#26159;&#39006;&#27604;&#32025;&#26412;&#35336;&#31639;&#34920;&#26684;&#30340;&#38651;&#33126;&#36575;&#39636;&#65292;&#30001;&#35377;&#22810;&#21015;&#33287;&#27396;&#25152;&#27083;&#25104;&#30340;&#20786;&#23384;&#26684;&#65292;&#20854;&#20013;&#21487;&#20197;&#23384;&#25918;&#25976;&#20540;&#12289;&#31639;&#24335;&#25110;&#25991;&#23383;&#65292;&#24120;&#35211;&#30340;&#35430;&#31639;&#34920;&#36575;&#39636;&#26377; Microsoft Excel&#12289;macOS Numbers &#33287; Google Sheets&#12290;&#35430;&#31639;&#34920;&#30340;&#27284;&#26696;&#28858;&#19968;&#20491;&#27963;&#38913;&#31807;&#65288;Workbook&#65289;&#12289;&#27963;&#38913;&#31807;&#20013;&#21487;&#20197;&#26377;&#22810;&#20491;&#35430;&#31639;&#34920;&#65288;Spreadsheets&#65289;&#65292;&#25105;&#20497;&#20351;&#29992; <code>pandas</code> &#27169;&#32068;&#30340; <code>read_excel()</code>&nbsp;&#20989;&#25976;&#38928;&#35373;&#35712;&#21462;&#31532;&#38646;&#24373;&#35430;&#31639;&#34920;&#65288;&#24038;&#37002;&#25976;&#20358;&#31532;&#19968;&#24373;&#65289;&#12290;</p><pre><code>excel_file_path = "imdb.xlsx"
movies_xlsx = pd.read_excel(excel_file_path)
print(type(movies_xlsx))
movies_xlsx.head()</code></pre><p>&#30001;&#26044;&#27963;&#38913;&#31807;&#20013;&#21487;&#20197;&#26377;&#22810;&#20491;&#35430;&#31639;&#34920;&#30340;&#35373;&#35336;&#65292;&#36617;&#20837;&#20043;&#21069;&#24314;&#35696;&#20808;&#20351;&#29992; pandas &#27169;&#32068;&#30340;&nbsp;<code>ExcelFile</code> &#39006;&#21029;&#30340; <code>sheet_names</code>&nbsp;&#23660;&#24615;&#27298;&#35222;&#27963;&#38913;&#31807;&#20013;&#26377;&#24190;&#20491;&#35430;&#31639;&#34920;&#12290;</p><pre><code>excel_file = pd.ExcelFile(excel_file_path)
excel_file.sheet_names</code></pre><p>&#22312; <code>pandas</code> &#27169;&#32068;&#30340; <code>read_excel()</code>&nbsp;&#20989;&#25976;&#25351;&#23450;&#21443;&#25976;<strong>&nbsp;</strong><code>sheet_name</code>&nbsp;&#36617;&#20837;&#29305;&#23450;&#35430;&#31639;&#34920;&#65292;&#21487;&#20197;&#25509;&#21463;&#35430;&#31639;&#34920;&#21517;&#31281;&#12289;&#20134;&#33021;&#36664;&#20837;&#25972;&#25976;&#65288;&#30001;&#24038;&#37002;&#24478;&#38646;&#38283;&#22987;&#25976;&#20358;&#31532;&#24190;&#24373;&#35430;&#31639;&#34920;&#65289;&#12290;</p><pre><code>casting_xlsx = pd.read_excel(excel_file_path, sheet_name="casting")
actors_xlsx = pd.read_excel(excel_file_path, sheet_name=2)
casting_xlsx.head()
actors_xlsx.head()</code></pre><h2>&#20351;&#29992; Python &#36617;&#20837;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#31649;&#29702;&#31995;&#32113;&#20013;&#30340;&#36039;&#26009;&#34920;</h2><p>&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#65288;Relational database&#65289;&#26159;&#22522;&#26044;&#38364;&#32879;&#27169;&#22411;&#25152;&#24314;&#27083;&#30340;&#36039;&#26009;&#24235;&#65292;&#26159;&#20786;&#23384;&#22312;&#38651;&#33126;&#20013;&#30340;&#36039;&#26009;&#38598;&#21512;&#12290;&#19968;&#20491;&#36039;&#26009;&#24235;&#20013;&#36890;&#24120;&#26371;&#26377;&#22810;&#20491;&#36039;&#26009;&#34920;&#65288;Table&#65289;&#33021;&#22816;&#34249;&#21161;&#38598;&#21512;&#36939;&#31639;&#65288;Set operation&#65289;&#31561;&#25976;&#23416;&#26041;&#27861;&#20358;&#34389;&#29702;&#36039;&#26009;&#34920;&#20043;&#38291;&#30340;&#25805;&#20316;&#21644;&#38364;&#32879;&#65292;&#20063;&#33021;&#22816;&#29992;&#20358;&#34920;&#31034;&#29694;&#23526;&#19990;&#30028;&#20013;&#30340;&#21830;&#26989;&#37007;&#36655;&#65292;&#20006;&#33021;&#22816;&#25509;&#21463;&#32080;&#27083;&#21270;&#26597;&#35426;&#35486;&#35328; SQL &#20358;&#36914;&#34892;&#27298;&#32034;&#21644;&#25805;&#20316;&#12290;&#25105;&#20497;&#20351;&#29992;&nbsp;<code>sqlite3</code> &#27169;&#32068;&#30340; <code>connect()</code>&nbsp;&#20989;&#25976;&#24314;&#31435;&#33287;&#36039;&#26009;&#24235;&#30340;&#36899;&#32218;&#65292;&#20877;&#36939;&#29992;&#32080;&#27083;&#21270;&#26597;&#35426;&#35486;&#35328; SQL &#25645;&#37197; pandas &#27169;&#32068;&#30340; <code>read_sql()</code>&nbsp;&#20989;&#25976;&#36617;&#20837;&#65292;&#36039;&#26009;&#24235;&#20351;&#29992;&#23436;&#30050;&#20043;&#24460;&#23559;&#36899;&#32218;&#38364;&#38281;&#12290;</p><pre><code>connection = sqlite3.connect("imdb.db")
query = """
SELECT *
  FROM movies;
"""
movies_db = pd.read_sql(query, connection)
movies_db.head()
query = """
SELECT *
  FROM casting;
"""
casting_db = pd.read_sql(query, connection)
casting_db.head()
query = """
SELECT *
  FROM actors;
"""
actors_db = pd.read_sql(query, connection)
actors_db.head()
connection.close()</code></pre><p>&#22312;&#35469;&#35672;&#20102;&#22914;&#20309;&#20351;&#29992; Python &#36617;&#20837;&#32020;&#25991;&#23383;&#27284;&#26696;&#12289;&#35430;&#31639;&#34920;&#33287;&#38364;&#32879;&#24335;&#36039;&#26009;&#24235;&#20013;&#30340;&#36039;&#26009;&#34920;&#20043;&#24460;&#65292;&#31532;&#19977;&#21313;&#19968;&#36913;&#32004;&#32173;&#23433;&#35336;&#30059;&#65306;&#20351;&#29992; Python &#36617;&#20837;&#36039;&#26009;&#20358;&#21040;&#23614;&#32882;&#65292;&#24076;&#26395;&#24744;&#20063;&#21644;&#25105;&#19968;&#27171;&#26399;&#24453;&#19979;&#19968;&#31687;&#25991;&#31456;&#12290;</p><p>&#23565;&#26044;&#36889;&#31687;&#25991;&#31456;&#26377;&#20160;&#40636;&#24819;&#27861;&#21602;&#65311;&#21916;&#27489;&#128571;&#12289;&#30041;&#35328;&#128587;&#8205;&#9794;&#65039;&#25110;&#32773;&#20998;&#20139;&#128588;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datainpoint.substack.com/p/week-thirty-one-import-with-python/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datainpoint.substack.com/p/week-thirty-one-import-with-python/comments"><span>Leave a comment</span></a></p>
      <p>
          <a href="https://datainpoint.substack.com/p/week-thirty-one-import-with-python">
              Read more
          </a>
      </p>
   ]]></content:encoded></item></channel></rss>