<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by YT Chen on Medium]]></title>
        <description><![CDATA[Stories by YT Chen on Medium]]></description>
        <link>https://medium.com/@yt.chen?source=rss-cc51727aa09d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qdxd8Uo1o947GxOa7xoyJw.jpeg</url>
            <title>Stories by YT Chen on Medium</title>
            <link>https://medium.com/@yt.chen?source=rss-cc51727aa09d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:55:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yt.chen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[非本科，又如何？ — 論非本科的自我實踐之路]]></title>
            <link>https://medium.com/@yt.chen/%E9%9D%9E%E6%9C%AC%E7%A7%91-%E5%8F%88%E5%A6%82%E4%BD%95-%E8%AB%96%E9%9D%9E%E6%9C%AC%E7%A7%91%E7%9A%84%E8%87%AA%E6%88%91%E5%AF%A6%E8%B8%90%E4%B9%8B%E8%B7%AF-88d6497c912d?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/88d6497c912d</guid>
            <category><![CDATA[software-engineer]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-engineer-intern]]></category>
            <category><![CDATA[software-engineer-career]]></category>
            <category><![CDATA[software-engineer-life]]></category>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Tue, 05 Dec 2023 03:16:50 GMT</pubDate>
            <atom:updated>2023-12-12T07:50:27.613Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>非本科，又如何？ — 論非本科的自我實踐之路</strong></h3><blockquote>本文同步發表於 <a href="https://techblog.lycorp.co.jp/zh-hant/implementation-myself-by-different-department">LY Tech Blog</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WC0jQt1cAjnePGO959U2lA.jpeg" /><figcaption>攝於 2023.11.29</figcaption></figure><p><strong>前言</strong></p><p>大家好，我是 LINE 購物的 TECH FRESH — YT Chen，於今年 7 月加入 LINE Taiwan，很高興今天能有機會與大家分享 —「非本科，又如何？」</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fspeakerdeck.com%2Fplayer%2F3655ba6a92d9403692bbd0b53957fc97&amp;display_name=Speaker+Deck&amp;url=https%3A%2F%2Fspeakerdeck.com%2Fline_developers_tw%2Fqa-internship-experience-sharing-line-techfresh&amp;image=https%3A%2F%2Ffiles.speakerdeck.com%2Fpresentations%2F3655ba6a92d9403692bbd0b53957fc97%2Fslide_0.jpg%3F28116292&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=speakerdeck" width="710" height="399" frameborder="0" scrolling="no"><a href="https://medium.com/media/667842c76b947fe0021abd5c405c4079/href">https://medium.com/media/667842c76b947fe0021abd5c405c4079/href</a></iframe><p><strong>怎麼找到第一份軟體工程師（SWE）的工作？</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R1C9IhTklQq5WfwnxeUzQw.png" /><figcaption>節錄自投影片</figcaption></figure><p>如果你是一個非本科系且想要轉到軟體領域的同學會發現你現在好像有很多條路可以選，像是自學、轉系輔系雙主修、報培訓機構或是直接跨考研究所，而且你可能會很猶豫自己到底要選哪條路才能夠拿到第一份軟體工程師的工作，每條路又有各自的難處，例如自學要怎麼開始啊、雙主修課太多要延畢怎麼辦啊、培訓機構太貴跟不上啊或是跨考研究所會不會考不上等等的焦慮與煩惱，因此我把這張圖稱為「焦慮樹」。</p><p>若你常看一些網路論壇你會發現很多人會建議你報坊間的培訓機構以及直接跨考研究所，但是這些無疑都是一件成本巨大的決定，所以說在學生時代就決定跨領域的同學們很幸運，因為還有機會利用許多學校的資源以及分配自己的時間，所以我認為你應該先從上面兩個（自學與轉系輔系雙主修或修課）開始。</p><p><strong>入職前 — 以最小成本試錯並滾動調整</strong></p><p>Linux 之父的名言 ”Talk is cheap. Show me the code.”，不要一下就定很高大上的目標，請遵循以下四個步驟：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ejdcPaanx5H72Ms-XfnZUw.png" /><figcaption>節錄自投影片</figcaption></figure><p><strong>確定目標</strong></p><p>先畫靶再射箭才會長久。</p><p>我喜歡什麼？我該往前端、後端、APP、Data 或是 AI 等等的領域前進？</p><p><strong>自學基礎</strong></p><p>例如了解遞迴（recursion）、熟悉 Linux 基礎指令，知道資料結構與演算法（DSA）在講什麼等等。</p><p><strong>實作專案</strong></p><p>我想要做一個 Facebook，我該怎麼使用什麼框架（Framework）？</p><p><strong>研究透徹</strong></p><p>我的專案是怎麼運行的？為什麼我會選擇使用這些工具？</p><p>上面的每一環節都很容易令人想放棄，這很正常，沒有強烈的動機的話很難貫徹始終，為什麼叫做「以最小成本試錯並滾動調整呢」？因為在學習的路徑中也能夠獲得很多對於自身的回饋，例如你發現在自學時坐不住或是三天打魚兩天曬網，那你完全可以選擇再去尋找更適合自己的路，每個人都有自己擅長與不擅長的事，用自身的優勢去面對未來數十年的職涯挑戰無疑是較為輕鬆的。</p><p>更好的軟體隨時都在路上，無論是什麼種類的軟體工程師都必須要不斷的學習，最重要的是抓住精髓並多加運用。自學的管道有很多種，youtube 影片總歸是一個免費又有效的學習方式，若是願意花點小錢的話也可以考慮購買線上課程，再來才是考慮成本較高的其他選擇。因為此時你已經有了具體的目標、一些基礎以及最重要的 — — 抱有強烈的熱忱，比起一張白紙的同儕而言你已經取得了不小的優勢。</p><p><strong>轉職後 — 跳的更高</strong></p><p>”The future depends on what you do today.“ — Mahatma Gandhi</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-3insejB9GCg84Ie-4YaGg.png" /><figcaption>節錄自投影片</figcaption></figure><p><strong>補足核心</strong></p><p>做為一個非本科生，在成功轉職後你可能會在工作中感受到一股飄忽不定的壓力，一種不曉得怎麼繼續向上的憂愁，時光不知不覺的的一次次的 CRUD 中悄然度過，這時候就很適合再深入研究一些學科，例如想要寫更好的程式碼的話你或許會想要更深入了解物件導向程式設計（OOP），想要增進程式運作效能的話可以看看作業系統（OS）。</p><p><strong>主動爭取</strong></p><p>可以在工作中多多主動爭取自己有興趣的專案，抑或是假設你目前的工作並不是軟體工程師但你想要嘗試，那你也可以嘗試在既有的工作之中加入一些跟開發軟體相關的部分，例如用 python 處理那些無趣的例行事務，這種 mindset 會成為你未來的談資。</p><p><strong>與人為善</strong></p><p>第一份工作會影響你未來職涯的很長一段時間，所以盡可能的在工作中努力學習與表現，此外也可以尋求內推，內推的話就可以省去 HR review 的環節，直接將履歷送到用人主管手上！</p><p><strong>面試導向</strong></p><p>上一節的實作專案流程固然可以使你成功拿到第一份軟體工程師工作，但是除非你天賦異稟不然是很難一蹴而幾的進到那些夢想公司的，為了達到更高的目標 — — 「刷題」勢不可避。</p><p>以上就是如何第一次轉職軟體工程師就上手的秘訣啦！接下來來瞧瞧我在 LINE 的任務吧！</p><p><strong>Work in LINE</strong></p><p><strong>LINE SHOPPING 介紹</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QHsQXI3W35E0M1B-MSxBEw.png" /><figcaption>節錄自投影片</figcaption></figure><p>LINE 購物是一個導購平台，在這裡搜尋後，LINE購物會幫你導向與他們合作的商家中，購買後即可獲得等同於現金的 LINE POINTS 的回饋。</p><p><strong>What does Automation Engineer do?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZeQAUNnUAGCElT5qlEOdnw.png" /><figcaption>節錄自投影片</figcaption></figure><p>Automation Engineer 所做的事情一言以蔽之就是自動化一些一定要做的測試並從報告中找到系統哪裡壞掉了。簡單介紹與解釋一下 AE 們的主要日常任務：</p><p><strong>Smoke Test</strong></p><p>關於這個名詞據傳有一個有趣的由來，就是當電路板首次接上電源時如果沒有馬上冒黑煙就代表至少它設計上沒有嚴重的問題，剩下的再慢慢修也不遲。</p><p>引用到軟體工程上來說就是「基礎功能一定不能壞」，以 LINE 購物為例，LINE 購物是一個可以在上面搜尋並導購的平台，那很明顯我們產品的價值就在於「搜尋」與「導購」，什麼都可以壞但這兩個功能必定不能壞！</p><p><strong>Performance Test</strong></p><p>分成很多種，不過這裡只舉一個例子，生活中我們在搶演唱會的票時系統總會當機，但事實上我們應該透過 Load Test 來評估以現有我們系統的資源能承受多少流量，再去做 auto scaling 之類的才能保證系統依然能在大量的流量中存活。</p><p><strong>Health Check</strong></p><p>要建構一個系統勢必有很多附屬的服務，例如資料庫、搜尋服務、廣告服務等等，因此我們必須即時掌控哪些服務出問題了，這樣才能以最快的速度去處理。</p><p><strong>CI / CD</strong></p><p>這同樣是一個大主題，但核心都是「自動化的做某些事情」，例如我每一週都要 release 一個版本，但是如果每次我都要 git clone 下來然後再推到 production 上豈不是很麻煩？因此有了 CI / CD 工具後我們就可以讓這個過程自動化，例如每週五的晚上 19:00 觸發，這樣就可以直接快樂下班回家了。</p><p>如果覺得意猶未盡的話強烈推薦前 TECH FRESH — 依涵的 <a href="https://engineering.linecorp.com/zh-hant/blog/qa-automation-engineer-line-shopping">文章</a>，寫的超級詳細！</p><p><strong>Now, I’m a SWE! And then?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hi09FsF5QYaB1cpwqg8odA.png" /><figcaption>節錄自投影片</figcaption></figure><p>好的，相信大家在看完這篇文章之後都已經成功的成為了一個軟體工程師！</p><p>那麽要怎麼在這個職場存活呢？以下就為大家整理出四個成為 senior 的必點技能樹：</p><p><strong>Problem Solving</strong></p><p>定位出問題點之後善用 Google 搜尋或是 ChatGPT…沒了它們幾乎就沒辦法開發了。</p><p>還有一點是團隊如果有比較 senior 的成員的話那千萬不要放過機會，尤其是當你卡關時一定要問，因為會讓你卡關無非是：</p><ol><li>技術不達標</li><li>新進公司的不熟悉</li></ol><p>技術不夠的話問 senior 的好處顯而易見，新進公司的不熟悉包含了很多，例如對公司 code base 的不熟悉抑或是 Domain Knowledge 不夠都有可能，如果有 mentor 制度的話那就更好了。</p><p><strong>Debugging Expert</strong></p><p>每天都在與為什麼這跑不動跟為什麼這跑的動中掙扎，但都沒有不能 reproduce 出來慘…ＱＱ</p><p><strong>Good Learner</strong></p><p>軟體工程絕對是值得耕耘的一畝地，在這裡不論出身，你的知識與經歷將會成為你最大的後盾，所以為自己而學吧！</p><p><strong>Team Player</strong></p><p>主動向你的主管或是 mentor 報告目前的進度，讓他們對你很放心，當然也記得要跟他人合作啦！</p><p>最後一點就是不要把自己當成只是一個 ”programmer”，你可以試想五年後你想要在職場上有什麼身份，例如你想要做主管，那你就應該多去爭取與人溝通的機會，相反的如果你想要成為更厲害的工程師那就應該繼續增進自己的程式能力或是基礎學科。</p><p><strong>結語</strong></p><p>在這篇文章中相信你已經清晰的了解身為非本科系的學生如何轉職、成為一個好的軟體工程師以及 Automation Engineer 的一些工作內容，以上就是我這次的分享，希望能對你有幫助，謝謝！</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88d6497c912d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nvidia-smi 連不到 driver 的自救方法]]></title>
            <link>https://medium.com/@yt.chen/nvidia-smi-%E9%80%A3%E4%B8%8D%E5%88%B0-driver-%E7%9A%84%E8%87%AA%E6%95%91%E6%96%B9%E6%B3%95-69cbed16171d?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/69cbed16171d</guid>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Fri, 24 Nov 2023 05:33:33 GMT</pubDate>
            <atom:updated>2023-11-24T05:33:33.757Z</atom:updated>
            <content:encoded><![CDATA[<p>最近在用 12G VRAM 的顯卡跑 LLM，實在很痛苦…</p><p>跑一跑就莫名 OOM，然後 reboot 後就連不到 GPU 惹所以簡單紀錄一下 QQ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d24DZ2V3RovxzLDL" /><figcaption>Photo by <a href="https://unsplash.com/@thomasfos?utm_source=medium&amp;utm_medium=referral">Thomas Foster</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>萬惡的根源</h3><p>輸入 nvidia-smi 時跑出這咚咚</p><pre>NVIDIA-SMI has failed because it couldn&#39;t communicate with the NVIDIA driver. <br>Make sure that the latest NVIDIA driver is installed and running.</pre><p>查了一圈都沒有類似 restart driver 的方法，都是叫你直接 reinstall。</p><h3>解決方式</h3><pre>ls /usr/src | grep nvidia</pre><p>會出來先前的 Nvidia driver version，以我的為例就是 nvidia-530.30.02</p><pre>sudo apt-get install dkms</pre><p>裝 dkms 這個 lib，總之是一個能夠珍惜生命讓你不用每次花時間找 src 跟手動編譯的好東西</p><pre>sudo dkms install -m nvidia -v 530.30.02</pre><p>我的是 530.30.02，注意要替換成 `<strong>ls /usr/src | grep nvidia</strong>`中的 version</p><p>如果沒噴錯恭喜你，driver 又可以用了🎉</p><pre>Error! Your kernel headers for kernel 5.4.0-167-generic cannot be found.<br>Please install the linux-headers-5.4.0-167-generic package,<br>or use the --kernelsourcedir option to tell DKMS where it&#39;s located</pre><p>如果出現如上字樣那要再加一步，再加裝 kernel header</p><pre>sudo apt-get install linux-headers-5.4.0–167-generic</pre><p>Yeah! driver 又可以用了🎉</p><h3>小結</h3><p>其實不算棘手的問題，只是每次遇到都很阿砸，還有我也很疑惑為什麼明明是重裝同樣的 driver version，所需要的 kernel header 居然不一樣？</p><p>不過根據我精湛的受折磨經驗，只要牽涉到 CUDA / CUDNN / driver 時都是重裝治百病😂 (x)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69cbed16171d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[用Heroku佈署到網路上-Streamlit入門(3)]]></title>
            <link>https://medium.com/@yt.chen/%E7%94%A8heroku%E4%BD%88%E7%BD%B2%E5%88%B0%E7%B6%B2%E8%B7%AF%E4%B8%8A-streamlit%E5%85%A5%E9%96%80-3-6b5ce168a4b8?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b5ce168a4b8</guid>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Thu, 20 Feb 2020 10:15:09 GMT</pubDate>
            <atom:updated>2020-02-20T10:15:09.559Z</atom:updated>
            <content:encoded><![CDATA[<p>上一篇說模型做出來總是會想用一下</p><p>那現在就是獨樂樂不如眾樂樂了(a.k.a. 不能只有我玩到)</p><p>比本機自high麻煩很多，不過成品是值得的！</p><p>還沒玩過成品的這邊請，要等一段時間是因為要開啟heroku的伺服器</p><p><a href="https://titanic-test-streamlit.herokuapp.com/">Streamlit</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3-oYt3dE85kcs9DQWHWodA.png" /><figcaption>Titanic Test</figcaption></figure><p>首先請先下載git、heroku CLI，</p><p>並申請heroku帳號(必須)，搭配github一起食用效果更佳(非必須)</p><p>git： <a href="https://git-scm.com/downloads">https://git-scm.com/downloads</a></p><p>heroku CLI: <a href="https://devcenter.heroku.com/articles/heroku-cli">https://devcenter.heroku.com/articles/heroku-cli</a></p><p>此專案github： <a href="https://github.com/ytchen175/Titanic_test">https://github.com/ytchen175/Titanic_test</a></p><p>下載後把app.py與README.md丟掉替換成你的，除非你也想做鐵達尼</p><h3>github：</h3><p>將檔案放置於指定的位置，我是跟github一起放</p><p>成功被git管理的話會多出一個名為.git的隱藏資料夾</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*HhLrXM7IkeAn-a-OW3lbcA.png" /></figure><p>推上自己的repo，用網頁還桌面版還命令(git push)都可以啦</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vbEH8ZeFW3GQ2Fr4d-5oAA.png" /></figure><h3>git：</h3><p>第一次使用git記得自定義你的username與email</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*8CQyZhGhuie8w-oUxE-L0g.png" /></figure><p>使用git四連擊！</p><p>git init #初始化git倉庫</p><p>git add . #把資料夾內所有檔案增加給git管理</p><p>git commit -m “這次版本在幹嘛” #提交版本並說明這次版本在幹嘛</p><p>git status #這次改動了甚麼</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*WuMMnXiPG9gJTKNx8KBbcw.png" /></figure><p>用完這行雲流水的四連擊之後應該已經成功把檔案交給git並變成初版了</p><h3><strong>heroku：</strong></h3><p>接下來是登入heroku</p><p>heroku login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*aU7pvQxayo321caGKSRoDQ.png" /></figure><p>創建一個heroku的遠端伺服器，後面沒寫就幫你隨機取名</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*_UNqA5zi6PppU-9XoDTowg.png" /></figure><p>已經有伺服器的話就用remote</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*WUBL3YdTVNCgWPE1iYknpw.png" /></figure><p>再來用git push heroku master</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*vCwbdnhif2CujGhOS7uiZQ.png" /></figure><p>會跑很長一串，沒問題的話用網域是herokuapp.com的就可以連進去了</p><p>像我自己遇到的問題是無法找到pywin32的module</p><p>長的像這樣：</p><pre>Could not find a version that satisfies the requirement pywin32==223</pre><p>因為heroku其實不支援windows，連帶的也就不吃pywin32，所以請把requirements.txt中的dependency移掉</p><p>(如果你是使用pip freeze &gt;requirements.txt方法的windows使用者可能就會遇到此問題)</p><p>但我後來發現沒用到的dependency就刪掉也不會怎樣，還省時間跟空間XD</p><p>p.s.如果是用這邊repo下載的話，記得改一下setup.sh</p><p><a href="https://github.com/MaartenGr/streamlit_guide">https://github.com/MaartenGr/streamlit_guide</a></p><p>echo部分只要留上或下就好，我是留下面的，因為我不想填email</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*UwFiwCqsThc_qPXkZeoMVg.png" /></figure><p>啊如果下載我的版本的話我已經改好了，不用擔心</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b5ce168a4b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[機器學習/資料科學框架應用-Streamlit入門(2)]]></title>
            <link>https://medium.com/@yt.chen/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92-%E8%B3%87%E6%96%99%E7%A7%91%E5%AD%B8%E6%A1%86%E6%9E%B6%E6%87%89%E7%94%A8-streamlit%E5%85%A5%E9%96%80-2-cb8902c338bd?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb8902c338bd</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[streamlit]]></category>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Thu, 20 Feb 2020 08:52:15 GMT</pubDate>
            <atom:updated>2022-12-21T13:09:50.097Z</atom:updated>
            <content:encoded><![CDATA[<h3>實作一個專屬自己的機器學習app！-Streamlit入門(2)</h3><blockquote>EDA…處理缺失值…preprocessing….feature engineering….fit…模型完成！</blockquote><p>雖然常說資料跟丟進黑盒子裡沒兩樣(除了決策樹)，</p><p>但當辛辛苦苦的做完一個模型後總是會想要看一下效果是吧?</p><p>不然有種大招出完對方還是無動於衷的感覺(?)</p><p>所以來用經典的Titanic資料集玩玩看streamlit吧~</p><p>可以先點下方的成品link來預測你在鐵達尼號上的存活機率是多少</p><p>( 2022.12 更新: heroku 已停止免費服務，再見了朋友 )</p><p><a href="https://titanic-test-streamlit.herokuapp.com/">Streamlit</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3-oYt3dE85kcs9DQWHWodA.png" /><figcaption>Titanic Test</figcaption></figure><p><strong>實作：</strong></p><p>首先先開啟cmd並指向到檔案的位置</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*IXvy6S5E4D6SLUZAfnTlFA.png" /></figure><p>再叫streamlit運行你的檔案，關掉cmd時就等於關掉app的訊號源</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*PD-Mi4wkH_StoEO5PkxF4A.png" /></figure><p>通常它會直接跳出來，如果沒有的話就手動複製貼上到瀏覽器</p><p>不能用jupyter的話我個人是習慣用notepad++寫啦</p><p>常規的import套件</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7dc4be39b161780c3e6ef5f019934ca/href">https://medium.com/media/b7dc4be39b161780c3e6ef5f019934ca/href</a></iframe><p>用@st.cache讀原始資料，因為kaggle有提供連結所以不用再另外找平台放資料，如果是私用的資料可以放在AWS等雲端，沒有要push出去就正常的本機就好</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d199e7704e183a8007b7b2aace9a089/href">https://medium.com/media/1d199e7704e183a8007b7b2aace9a089/href</a></iframe><p>常規的迴歸填值、feature engineering、one-hot encoding、standardization</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f278237b693b1c2e6af0ef6188b43440/href">https://medium.com/media/f278237b693b1c2e6af0ef6188b43440/href</a></iframe><p>fit它，模型完成啦~</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b7fb0184a4c8b1052718af637d15e39/href">https://medium.com/media/5b7fb0184a4c8b1052718af637d15e39/href</a></iframe><p>主角streamlit，建議先建list就好，原本是想套進one-hot的函式裡，然而Pclass出現的結果不如預期</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/92cd45a9ff4e879f2ac52f2f4bd80301/href">https://medium.com/media/92cd45a9ff4e879f2ac52f2f4bd80301/href</a></iframe><p>手動one-hot encoding…很不優雅….</p><p>換算是從wiki上看的，GBP£1≒NT$39</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb57cb6c6a9c382b3f59dae55b5b7722/href">https://medium.com/media/cb57cb6c6a9c382b3f59dae55b5b7722/href</a></iframe><p>用silder、selectbox等widget獲取使用者資料後變SibSp、Parch、Familysize</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0e89fdc037a2b066e87d604c75cb2d4/href">https://medium.com/media/d0e89fdc037a2b066e87d604c75cb2d4/href</a></iframe><p>因為我模型使用的是經過standardization的age跟fare，所以需要再進行一次</p><p>並print出最後要丟進模型的資料</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93107119770fb94b0fc5987d5d029242/href">https://medium.com/media/93107119770fb94b0fc5987d5d029242/href</a></iframe><p>最後用先前訓練好的RandomForestClassifier預測使用者的生存或死亡率~</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c31f699728cd570fb792fd0898fe1e56/href">https://medium.com/media/c31f699728cd570fb792fd0898fe1e56/href</a></iframe><p>整體程式碼：</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c95b5dc59058a1b4a320a45e8115e937/href">https://medium.com/media/c95b5dc59058a1b4a320a45e8115e937/href</a></iframe><p>下一篇：deploy到網路上！</p><p><a href="https://medium.com/@yt.chen/%E7%94%A8heroku%E4%BD%88%E7%BD%B2%E5%88%B0%E7%B6%B2%E8%B7%AF%E4%B8%8A-streamlit%E5%85%A5%E9%96%80-3-6b5ce168a4b8">用Heroku佈署到網路上-Streamlit入門(3)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb8902c338bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[機器學習/資料科學框架應用-Streamlit入門(1)]]></title>
            <link>https://medium.com/@yt.chen/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92-%E8%B3%87%E6%96%99%E7%A7%91%E5%AD%B8%E6%A1%86%E6%9E%B6%E6%87%89%E7%94%A8-streamlit%E5%85%A5%E9%96%80-1-d07478cd4d8?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d07478cd4d8</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[streamlit]]></category>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Thu, 20 Feb 2020 07:08:52 GMT</pubDate>
            <atom:updated>2022-12-21T13:00:05.766Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Streamlit是什麼?-Streamlit入門(1)</strong></h3><p>Streamlit 是特別設計給機器學習與資料科學的開源框架，</p><p>不需要任何網頁的知識，</p><p>只需要用python的語法就能輕鬆架構出dashboard與app！</p><p>Documentation：</p><p><a href="https://docs.streamlit.io/">Streamlit Docs</a></p><p>以下皆在終端機(cmd)操作，用jupyter是不行的！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLlm11nMiRfskJGpOS8-iA.png" /></figure><p>用pip就能安裝</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/213b9f00965f6ad572973a8f2238821e/href">https://medium.com/media/213b9f00965f6ad572973a8f2238821e/href</a></iframe><p>如果要跑自己的檔案則是輸入</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84cb57d2929495c33c5ae7f775c5e79e/href">https://medium.com/media/84cb57d2929495c33c5ae7f775c5e79e/href</a></iframe><p>使用 streamlit hello可以看看官方的4個demo，都很炫酷</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6c43b33f104239ccebefb8db54c5914/href">https://medium.com/media/e6c43b33f104239ccebefb8db54c5914/href</a></iframe><p>左邊拖曳silder調整參數就可以改變中間的碎形動畫</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UgLxQvs5wA3t_2ejK9sw-Q.png" /><figcaption>streamlit demo-1</figcaption></figure><p>在進度條跑完前會隨機繪製的折線圖</p><figure><img alt="streamlit-2" src="https://cdn-images-1.medium.com/max/1024/1*w6mTCaollEOPFX7Jp3gI_w.png" /><figcaption>streamlit demo-2</figcaption></figure><p>地圖</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nft8YwOIHZBlIN6kOvCCBQ.png" /><figcaption>streamlit demo-3</figcaption></figure><p>按X就可以看不到某國的資料</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmE7aB1y9PFLC8UEmkfMOg.png" /><figcaption>streamlit demo-4</figcaption></figure><p>還可以玩實時的圖像辨識，雖然第一次要下載一段時間但真心推薦玩一玩</p><p><a href="https://github.com/streamlit/demo-self-driving">https://github.com/streamlit/demo-self-driving</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cbeb18b25a2ceb3b409a31f0294d6229/href">https://medium.com/media/cbeb18b25a2ceb3b409a31f0294d6229/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bK2zGOp4E6NNV8H4HAe3Ig.png" /><figcaption>streamlit demo-self driving</figcaption></figure><p>以及官方的 <a href="https://docs.streamlit.io/tutorial/create_a_data_explorer_app.html">Tutorial: Create a data explorer app</a></p><p>透過這個Tutorial可以了解streamlit的精髓-<strong>@st.cache</strong></p><p><strong>@st.cache是什麼？</strong></p><p>@st.cache是裝飾器(Decorator)，在def前加入能使得載入資料變成快取，進而加速app的運算速度，基本上不用的話速度會~很~慢~~</p><p>有興趣請參考以下documents：</p><ul><li><a href="https://docs.streamlit.io/caching.html">Caching - Streamlit 0.56.0 documentation</a></li><li><a href="https://docs.streamlit.io/advanced_caching.html">Advanced caching - Streamlit 0.56.0 documentation</a></li></ul><p>用<strong>st.write()</strong>即可print出大部分的東西，包括但不限於dataframe、matplotlib/altair/ploty圖表、graphviz關係圖、keras model圖與表情符號(?)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*5JVgT8dw22G_6IDIgyvDzw.png" /><figcaption>或許是最花俏的Hello World?</figcaption></figure><p>使用python 3也可以不要用st.write()，document中稱為Magic Commands</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*tXK01w3hAnXoc9NxcK-ZeA.png" /><figcaption>streamlit-magic commands</figcaption></figure><p>除了另外import套件之外，streamlit也有提供自己的簡單繪圖api</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*jhVmCrB041SjM7jv8Oa1uw.png" /><figcaption>streamlit-line_chart</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*Cor-5Kqdc4TH4Kj-dl9RSQ.png" /><figcaption>streamlit-area_chart</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*rfagD6VeFQz7jlCBy6Yj-w.png" /><figcaption>streamlit-bar_chart</figcaption></figure><p><strong>st.image()</strong>可以插入圖片、後面替換為<strong>audio</strong>/<strong>video</strong>則是音訊跟影片</p><p>當然如果要在網路上使用還是得找個圖床之類的放啦</p><p><strong>互動式小工具(</strong><a href="https://docs.streamlit.io/api.html#id6"><strong>Display interactive widgets</strong></a><strong>)：</strong></p><p>button:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*Ri5EUSs3tbYXqEsUjpHIVw.png" /></figure><p>checkbox:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*spG5Yp7KCdwW3hVIbPTkkw.png" /></figure><p>radio:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*ztnYMQnd5gYPXopIsaifsQ.png" /></figure><p>selectbox:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*whRmmVeiRq3pDiY154kwWg.png" /></figure><p>multiselect:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*IowQJty4xPw7B-wBQqHwQA.png" /></figure><p>silder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*6_dkw3wTRO-YyB_qic9KSw.png" /></figure><p>file_uploader:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*eGk--efAj3V-MLH075Dq3A.png" /></figure><p>sidebar.XX :(位於左方)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*C9CKWc1KLD-OKSwE5frV1A.png" /></figure><p>echo:可運行並show出code，通常會搭配checkbox隱藏起來</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*KImfKPrncCXqZPVGLC-XIw.png" /></figure><p>更多請參考api reference：</p><p><a href="https://docs.streamlit.io/api.html">API reference - Streamlit 0.56.0 documentation</a></p><p>下一篇：實際運用框架</p><p><a href="https://medium.com/@yt.chen/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92-%E8%B3%87%E6%96%99%E7%A7%91%E5%AD%B8%E6%A1%86%E6%9E%B6%E6%87%89%E7%94%A8-streamlit%E5%85%A5%E9%96%80-2-cb8902c338bd">機器學習/資料科學框架應用-Streamlit入門(2)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d07478cd4d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[資料分析、資料科學和商業分析的差別？]]></title>
            <link>https://medium.com/@yt.chen/%E8%B3%87%E6%96%99%E5%88%86%E6%9E%90-%E8%B3%87%E6%96%99%E7%A7%91%E5%AD%B8%E5%92%8C%E5%95%86%E6%A5%AD%E5%88%86%E6%9E%90%E7%9A%84%E5%B7%AE%E5%88%A5-1670b746c394?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1670b746c394</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Tue, 17 Dec 2019 16:02:19 GMT</pubDate>
            <atom:updated>2019-12-17T16:02:19.819Z</atom:updated>
            <content:encoded><![CDATA[<p>感覺有微小差別但具體來說又不知道差在哪？</p><p>既然題目是資料分析，當然也要用數據來解決問題</p><p>就用這三個關鍵字分別從104爬下資料吧~！看看業界實際需要哪些人才</p><p>經過篩選關鍵字後的資料如下，把一些不太相關的工作手動加函式輔助篩掉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BahcdJLn22oejaQKhLJqXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4-_na7EoI_PPQAOxPKjaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9d1S5etN7mHlmtC0SRfUlQ.png" /></figure><p>把擅長工具拖出來做成文字雲看看</p><p>(以下把Excel、PowerPoint和Word統稱為微軟系列)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*FCGreGnOhN1FwWvTwFFFLA.png" /></figure><p>資料分析師最常被要求的專業工具是Python、SQL、R、SPSS、Java、SAS、google analysis與微軟系列</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*v26_NkCyWWKJTA21wmRAxg.png" /></figure><p>資料科學家最常被要求的專業工具則是Python、SQL、Java、R、Orcale、hadoop、JavaScript和SAS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*wNuRZd2dWZtVB0dUbVBt-Q.png" /></figure><p>商業分析師最常被要求的專業工具有 微軟系列、Python、SQL、SAP、R、Tableau、google analysis和Visio</p><p>觀察這三張文字雲，可以發現：</p><ol><li><strong>資料科學家</strong>的專業比較偏向<strong>程式與資料庫</strong>，的確是相當正統的硬骨頭，特別的是「Linux」的出現率也非常高，同樣的硬體，Linux的運算能力還是比Windows強。</li><li><strong>商業分析師</strong>更著重於<strong>視覺化</strong>、<strong>BI</strong>與<strong>ERP</strong>的搭配，比起冷冰冰的程式語言，Excel跟SAP更加重要。</li><li><strong>資料分析師</strong>前幾個跟資料科學家也相當相似，不同的是多了<strong>R</strong>、<strong>SPSS</strong>、<strong>SAS</strong>和google analysis，R跟SAS對於商學院的學生應該較為友好。</li></ol><p>共通點是<strong>python</strong>都一樣重要，剩下的工具像是可選項，有很好，但沒有主要項就總是差了那麼一點。</p><p>接下來是工作內容，使用jieba精確模式切詞</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*BOdCDj5EkIbu563gbpyUDQ.png" /></figure><p>資料分析師的前10關鍵詞：</p><p>資料 、數據、 規劃 、系統、 專案 、客戶、 能力、 技術 、模型與團隊</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*dhcaosp82fvG4Csc7SEC2g.png" /></figure><p>資料科學家的前10關鍵詞：</p><p>資料 、數據、 系統 、技術 、規劃、 專案、 團隊、 模型、 能力及程式</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*tXd-1WNFGWMybVfg-96CVQ.png" /></figure><p>商業分析師的前10關鍵詞：</p><p>資料、團隊、規劃、業務、專案、系統、產品、數據、商業和客戶</p><p>再來比一下關鍵詞，我們把它們串起來：</p><p>1.<strong>資料科學家</strong>比其他兩個多了<strong>程式</strong>這個詞，說明其對於程式能力的重視。</p><p>2.<strong>商業分析師</strong>中的<strong>團隊</strong>占了第二位，並且多了<strong>業務</strong>、<strong>產品</strong>、<strong>商業</strong>等字，向業務端解釋團隊對於產品的分析結果就是他們的工作。</p><p>3<strong>.資料分析師</strong>就是這兩種的折衷，或許公司所期待的是對客戶解釋開發專案，因此溝通能力也很重要。</p><p>雖然大部分都是面議，但用最低的起薪來看看薪水如何吧！</p><p>因為沒有實際數據所以只是僅供參考~面議我都用40k估</p><p>事實上應該會比這些圖表高許多，僅供參考僅供參考(很重要多講幾次)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*oLGUOFQrzy2T5jN6qlB6wA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*dGYoDVIGQQiNo9KHEIQUhg.png" /></figure><p>商業分析的資料太少了所以就不列出了，通常會被歸類在ERP管理師</p><p>基本上只能說這個領域的pay肯定是不錯的，畢竟是新興領域</p><p>結論：</p><p>大致上跟事先的想法差不多，資料科學肯定是最需要強大的程式背景，其他兩個非本科系的或許也有機會轉換跑道。此外，商業分析師的職缺還是較為稀少，其定位就像掛著分析師的PM，負責協調溝通。</p><p>若將這三個用大學科系來比喻的話，我覺得資料科學家是資工，資料分析師是統計或財金，而商業分析師是企管系。</p><p>感謝收看！</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1670b746c394" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[用Excel預測美中台股票指數簡單模型-(4)結論]]></title>
            <link>https://medium.com/@yt.chen/%E7%94%A8excel%E9%A0%90%E6%B8%AC%E7%BE%8E%E4%B8%AD%E5%8F%B0%E8%82%A1%E7%A5%A8%E6%8C%87%E6%95%B8%E7%B0%A1%E5%96%AE%E6%A8%A1%E5%9E%8B-4-%E7%B5%90%E8%AB%96-7fdcfca2a989?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fdcfca2a989</guid>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Wed, 20 Nov 2019 02:27:04 GMT</pubDate>
            <atom:updated>2019-11-20T02:27:04.449Z</atom:updated>
            <content:encoded><![CDATA[<p>導出模型的迴歸式和下結論</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wx4nzOeTp_MoGEfW_uCKwQ.png" /></figure><p>上面的表格可讓我們求出此模型的迴歸式為</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*BZf_d6Htw2t9KoYiAbQgWg.png" /></figure><p>把下面殘差輸出中台股的預測列copy到新工作表，跟實際的報酬率一起做折線圖</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*0SFiZyVHr2p2SF0uYwdnWA.png" /></figure><p>歷經千辛萬苦，模型的預測跟實際報酬率總算出來啦~</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*_ANPOGQhcK7Y-eXTAGvu0w.png" /></figure><p>觀察兩條線，藍色的實際報酬率的跳動區間硬是比橘色的報酬率大了許多</p><p>我認為這模型還是有可取之處的，大致走勢都正確，只是波動太大了</p><p>當然不能盡信，但配合時事跟財經素養評估也能作為投資人的參考！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*VKdxsqIlrveFtzuYLEPSnA.png" /></figure><p>那我們來看看某些突然跳多或跳空的時候發生了什麼</p><p>以2016/9/8~2016/9/12為例，美股昨天大跌，所以台股也跟風跌</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*xeYd56kAVmr9olWue7ru4A.png" /></figure><p>感覺這其實某方面也證明了美國跟台股真的有連動關係...</p><p>因為資料有一段時間了新聞不大好找，所以就用這篇做代表吧</p><p>未來假設你想使用模型預測報酬率</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*BZf_d6Htw2t9KoYiAbQgWg.png" /></figure><p>將各變數代進去就能求出y，也就是台股的報酬率了</p><p>本系列到此結束，感謝閱讀</p><p>如果覺得我的文對您有幫助可以按clap幫我拍拍手~</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fdcfca2a989" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[用Excel預測美中台股票指數簡單模型-(3)ANOVA表意義]]></title>
            <link>https://medium.com/@yt.chen/%E7%94%A8excel%E9%A0%90%E6%B8%AC%E7%BE%8E%E4%B8%AD%E5%8F%B0%E8%82%A1%E7%A5%A8%E6%8C%87%E6%95%B8%E7%B0%A1%E5%96%AE%E6%A8%A1%E5%9E%8B-3-anova%E8%A1%A8%E6%84%8F%E7%BE%A9-6c0062a1e66a?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c0062a1e66a</guid>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[index]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[regression]]></category>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Tue, 19 Nov 2019 12:05:42 GMT</pubDate>
            <atom:updated>2019-11-20T10:21:53.983Z</atom:updated>
            <content:encoded><![CDATA[<p>帶你清楚了解ANOVA表</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQsS42NEtjK1DyoOlmAnKg.png" /></figure><p>二、ANOVA表</p><p>1.迴歸的基礎概念</p><p>首先我們先來了解線性迴歸式的構成</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*y0xQXEQOupmuVr5QZSMzEQ.png" /></figure><p>y是受影響或你想推論的應變數，β1就是截距，β2、β3就是自變數，</p><p>簡單線性迴歸跟多元線性迴歸只差在後面拖多長，開心的話β100也ok</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/0*ZGo6t5hT-0VwjzHg" /></figure><p>上面有^的代表是估計的結果，￣的是平均數，Yi是每筆資料的落點</p><p>搭配圖可以發現SST=SSR+SSE，總和=迴歸+殘差</p><p>細心再拉回上篇看R平方的公式就會看懂，</p><p>迴歸模型的解釋係數R平方=迴歸SSR/總和SST，這真是再正常不過了</p><p>如果這張圖是一個Model的話那他R平方也會&lt;50%，因為SSE&gt;SSR</p><p>2. ANOVA本人-變異數分析(Analysis of Variance)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*pJCd_FJU2I-RQ5f86HQ4cQ.png" /></figure><p>用白話文總結這三個東西的關係：</p><p>總和SST=(每筆資料<strong>真實</strong>數值-資料的<strong>平均</strong>)的sum</p><p>迴歸部分SSR=(每筆資料<strong>估計</strong>數值-資料的<strong>平均</strong>)的sum</p><p>殘差部分SSE=(每筆資料<strong>真實</strong>數值-每筆資料<strong>估計</strong>數值)的sum</p><p>建議是記圖再畫下來比較容易理解</p><p>SS÷df=MS</p><p>除上自由度變成均方差就是把他標準化，</p><p>假設今天請你比較165公分65公斤和170公分70公斤哪個比較胖，</p><p>一般人第一個反應會是算BMI，超過24就是胖低於18就是瘦</p><p>那統計學同樣是在算BMI，只是公式看起來可怕且要查表的BMI</p><p>2-2. F值公式</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/1*1Zj1mzFZ1HC0QVabJUKPoQ.png" /></figure><p>用標準化後的SSR和SSE來探討這模型好不好</p><p>只跟(k-1)和(n-k)有關，查表用的v1跟v2就是這兩個</p><p>大於查表的值才是好的模型(具顯著差異)</p><p>做迴歸恨不得R平方越高越好，最好有90%以上，那90%是什麼意思？</p><p>SSR佔90%，SSE佔10%，假設他們自由度是1，那F值就是9</p><p>如果80%那就是80%÷20%=4</p><p>再把值丟去查表，大於表定值則顯著，所以F值當然越大越好</p><p>2.3 顯著值(p值)</p><p>此時需要帶出我們的假設二寶-</p><p><strong>虛無假設H0(Null Hypothesis)</strong>、<strong>對立假設H1(Alternative Hypothesis)</strong></p><p>舉例來說，今天我想要知道同家公司男生的薪水跟女生的薪水有沒有差</p><p>我的H0:男生薪水=女生薪水</p><p>我的H1:男生薪水≠女生薪水</p><p>但我壓根不想要計算出來的結果是H0的男=女，如果等於的話為什麼要算咧</p><p>醉翁之意在於對立假設H1，把等於的假設推翻了就代表不等於。</p><p>型I錯誤(α)、 型II錯誤(β)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*shYLPeVMbL0vEWjiniGJcQ.png" /></figure><p>先來張經典圖表，很頭痛嗎？沒關係，我們把剛剛的假設帶進來</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*1crlkNx6eqDjpypzwZj49Q.png" /></figure><p>型I錯誤(α)：實際上男=女，結果Reject H1</p><p>型II錯誤(β)：實際上男≠女，結果Do not reject H0</p><p>α自己設(0.1、0.05、0.01等)，β則越低越好</p><p>話又說回來，所以p值是什麼？</p><p>p值(p value)定義：<strong>在現有的抽樣樣本下，能Reject H0的min顯著水準</strong></p><p>所以p需要&lt;α才能說是顯著(reject H0)的</p><p>p值越小H0越不可能發生，越能reject H0，H1會正確的機率就提高了</p><p>雖然近年來有些爭議但畢竟是流傳很廣的工具，不得不認識一下</p><p>下篇：結論</p><p><a href="https://medium.com/@yt.chen/%E7%94%A8excel%E9%A0%90%E6%B8%AC%E7%BE%8E%E4%B8%AD%E5%8F%B0%E8%82%A1%E7%A5%A8%E6%8C%87%E6%95%B8%E7%B0%A1%E5%96%AE%E6%A8%A1%E5%9E%8B-4-%E7%B5%90%E8%AB%96-7fdcfca2a989">用Excel預測美中台股票指數簡單模型-(4)結論</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c0062a1e66a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[用Excel預測美中台股票指數簡單模型-(2)摘要輸出意義]]></title>
            <link>https://medium.com/@yt.chen/%E7%94%A8excel%E9%A0%90%E6%B8%AC%E7%BE%8E%E4%B8%AD%E5%8F%B0%E8%82%A1%E7%A5%A8%E6%8C%87%E6%95%B8%E7%B0%A1%E5%96%AE%E6%A8%A1%E5%9E%8B-2-%E6%91%98%E8%A6%81%E8%BC%B8%E5%87%BA%E6%84%8F%E7%BE%A9-d0d0aba7353d?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0d0aba7353d</guid>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Tue, 19 Nov 2019 07:44:39 GMT</pubDate>
            <atom:updated>2019-11-19T12:12:50.732Z</atom:updated>
            <content:encoded><![CDATA[<h3>用Excel預測美中台股票指數簡單模型-(2)迴歸統計：R平方</h3><p>此篇開始會牽涉到較多的理論和名詞了</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQsS42NEtjK1DyoOlmAnKg.png" /></figure><p>一、迴歸統計</p><p>1.什麼是R？</p><p>R是相關係數，會落在-1~1之間，跟CAPM中的Beta係數概念很像</p><p>通常會使用R平方或是調整後的R來判斷這個迴歸模型能不能解釋Y，以本文來說，即是美國(β2)和上證(β3)這兩個自變數能否解釋台灣(Y)的報酬率變動</p><p>像這個模型很悽慘的只能解釋10%左右，這可能代表三者間沒啥關係，</p><p>也有可能代表是非線性關係，也有可能是變數不夠...太多種可能</p><p>想想也是，</p><p>如果靠著簡單的線性迴歸模型就能解釋個50%，那計量學家大概都發大財了</p><p>P.S.但R平方的大小不代表模型的絕對優劣，還是需要搭配P值F值等輔助判斷</p><p>2.那R平方跟調整後的R有什麼差別？</p><p>因為R平方有個缺點，增加自變數的個數時，R平方會越來越大</p><p>有可能你塞一堆奇奇怪怪的自變數 模型所謂的&quot;精確性&quot;就變高了</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/0*v0FNmaw88kCwUzDy.jpg" /></figure><p>看起來很可怕嗎？R平方還可以寫成這樣</p><p>先別管SST、SSR和SSE了，之後會解釋的</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*GaFrkaKsIMndumuaU4H7DQ.png" /></figure><p>調整的R平方公式</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*NRFAh8LjfNn4XbmComoC4A.png" /></figure><p>擺在一起後應該有feel多了，這邊除的是自由度，</p><p>n=樣本數，觀察值個數；</p><p>k=約束條件個數，本模型設了2個自變數，加上截距就變3了</p><p>調整後的R平方因為用的是均方的概念所以比較不受變數個數影響</p><p>下篇：ANOVA表的意義</p><p><a href="https://medium.com/@yt.chen/%E7%94%A8excel%E9%A0%90%E6%B8%AC%E7%BE%8E%E4%B8%AD%E5%8F%B0%E8%82%A1%E7%A5%A8%E6%8C%87%E6%95%B8%E7%B0%A1%E5%96%AE%E6%A8%A1%E5%9E%8B-3-anova%E8%A1%A8%E6%84%8F%E7%BE%A9-6c0062a1e66a">用Excel預測美中台股票指數簡單模型-(3)ANOVA表意義</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0d0aba7353d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[用Excel預測美中台股票指數簡單模型-(1)資料獲取與整理]]></title>
            <link>https://medium.com/@yt.chen/%E7%94%A8excel%E9%A0%90%E6%B8%AC%E7%BE%8E%E4%B8%AD%E5%8F%B0%E8%82%A1%E7%A5%A8%E6%8C%87%E6%95%B8%E7%B0%A1%E5%96%AE%E6%A8%A1%E5%9E%8B-1-%E8%B3%87%E6%96%99%E7%8D%B2%E5%8F%96%E8%88%87%E6%95%B4%E7%90%86-8ffc9ef913cc?source=rss-cc51727aa09d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ffc9ef913cc</guid>
            <dc:creator><![CDATA[YT Chen]]></dc:creator>
            <pubDate>Tue, 19 Nov 2019 07:40:41 GMT</pubDate>
            <atom:updated>2019-11-19T12:09:26.374Z</atom:updated>
            <content:encoded><![CDATA[<p>前陣子美中貿易戰使得亞洲股指動盪不安，那麼投資人要如何知道這是巧合還是常態呢？我們可以做一個簡單的<strong>線性迴歸模型(Linear Regression Model)</strong>預測。</p><p>首先我們需要資料，股票指數的資料網路上就有很多免費資源，這裡使用yahoo finance來獲取所需的資料</p><p><a href="https://finance.yahoo.com/quote/%5EGSPC/history?period1=1451577600&amp;period2=1514736000&amp;interval=1d&amp;filter=history&amp;frequency=1d">S&amp;P 500 (^GSPC) Historical Data</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QyoqlmgDrkm7CCu3LtVOxw.png" /></figure><p>選擇想下載的日期→apply→Download Data，很簡單吧</p><p>NASDAQ偏向高科技產業，道瓊名符其實的是工業指數，因此選用涵蓋產業較為廣泛的S&amp;P500來代表美國</p><ul><li><a href="https://finance.yahoo.com/quote/%5ETWII/history?p=%5ETWII">TSEC weighted index (^TWII) Historical Data</a></li><li><a href="https://hk.investing.com/indices/shanghai-composite-historical-data">上證綜合指數 歷史匯率 - Investing.com</a></li></ul><p>台灣的加權指數跟上證指數，依法炮製通通下載</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OY_kpnPVhZq887dJ-XADiQ.png" /></figure><p>拿到原始資料後整理成如上的表格，因為主體是台灣所以美國的日期要往前一天，像是1/4就要調整為1/3</p><p>因為先天指數相異過大，所以用<strong>報酬率</strong>來計算：(後-前)/前</p><p>P.S.迴歸模型還有相當多種，例如對數和平方或甚至三次方，</p><p>非線性的難度變高許多，陽春的Excel沒法跑</p><p>第一行的前報酬率要再手動查詢，或是抓資料時就順便把去年12/31的抓進來</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*heRi2RKVTzyOiRXQPXDdCQ.png" /></figure><p>點選上排的資料→資料分析→迴歸，Y範圍是台股報酬率，X範圍則為美股和陸股報酬率</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9JMGdumlCLzwjv6zP1b_lQ.png" /></figure><p>分析的結果就出現啦，這樣不方便閱讀，所以把一長串的數字依序改成相對應的指數名稱吧</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQsS42NEtjK1DyoOlmAnKg.png" /></figure><p>下篇：R是什麼</p><p><a href="https://medium.com/@yt.chen/%E7%94%A8excel%E9%A0%90%E6%B8%AC%E7%BE%8E%E4%B8%AD%E5%8F%B0%E8%82%A1%E7%A5%A8%E6%8C%87%E6%95%B8%E7%B0%A1%E5%96%AE%E6%A8%A1%E5%9E%8B-2-%E6%91%98%E8%A6%81%E8%BC%B8%E5%87%BA%E6%84%8F%E7%BE%A9-d0d0aba7353d">用Excel預測美中台股票指數簡單模型-(2)摘要輸出意義</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ffc9ef913cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>