<?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[Toby’s study notes - Medium]]></title>
        <description><![CDATA[This publication show my study notes on programing. there will be some problems I face, or just something I found. Hope this will help you. - Medium]]></description>
        <link>https://medium.com/tobys-study-notes?source=rss----89298e835f4---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Toby’s study notes - Medium</title>
            <link>https://medium.com/tobys-study-notes?source=rss----89298e835f4---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:00:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/tobys-study-notes" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[pandas讀取excel & 移除無關資料列]]></title>
            <link>https://medium.com/tobys-study-notes/pandas%E8%AE%80%E5%8F%96excel-%E7%A7%BB%E9%99%A4%E7%84%A1%E9%97%9C%E8%B3%87%E6%96%99%E5%88%97-901ec01fc796?source=rss----89298e835f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/901ec01fc796</guid>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[xlsx]]></category>
            <category><![CDATA[excel]]></category>
            <dc:creator><![CDATA[Toby]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 08:12:00 GMT</pubDate>
            <atom:updated>2024-02-20T08:12:00.066Z</atom:updated>
            <content:encoded><![CDATA[<p>範例excel如下，excel檔案開頭有一行不需要的資料，title在第二行，後續為資料內容。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*IbpRInbewxtNY285bYIeyg.png" /></figure><p>直接使用pandas讀取，可以看到他將第一列作為標題。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*jmmqcC4F53d0Ar9Ir28OfQ.png" /></figure><p>此時真正的欄位是第一行，也就是df.iloc[0]。注意，此時第一行已經作為標題，不在資料表內，因此不需要移除他。我們只要重設title，並且移除做為資料的title，只留下正常資料即可。</p><pre>import pandas as pd<br><br>xls = pd.ExcelFile(‘data/test.xlsx’)<br>df1 = pd.read_excel(xls)<br>df1.columns = df1.iloc[0]<br>df1 = df1.iloc[1:]<br>print(df1.head())</pre><p>執行結果如下:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/1*YJzU65zzBX02LrOsnQV6-A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=901ec01fc796" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tobys-study-notes/pandas%E8%AE%80%E5%8F%96excel-%E7%A7%BB%E9%99%A4%E7%84%A1%E9%97%9C%E8%B3%87%E6%96%99%E5%88%97-901ec01fc796">pandas讀取excel &amp; 移除無關資料列</a> was originally published in <a href="https://medium.com/tobys-study-notes">Toby’s study notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ubuntu安裝pytorch-gpu 問題總結]]></title>
            <link>https://medium.com/tobys-study-notes/ubuntu%E5%AE%89%E8%A3%9Dpytorch-gpu-%E5%95%8F%E9%A1%8C%E7%B8%BD%E7%B5%90-c5841d661021?source=rss----89298e835f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/c5841d661021</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[cuda]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Toby]]></dc:creator>
            <pubDate>Wed, 10 Aug 2022 03:42:20 GMT</pubDate>
            <atom:updated>2023-03-30T03:37:56.435Z</atom:updated>
            <content:encoded><![CDATA[<h3>ubuntu安裝pytorch-gpu指南</h3><p>nvidia-gpu與pytorch環境配置</p><p>一開始我參考這篇文安裝，教學很詳細。</p><p><a href="https://mikethreeacer.medium.com/ubuntu-18-04-%E5%AE%89%E8%A3%9D-cuda-cudnn-anaconda-pytorch-1f170b3326a4">Ubuntu 18.04 安裝 CUDA cuDNN Anaconda pytorch</a></p><p>這邊補充幾點安裝中遇到的：</p><ol><li>安裝步驟(1)中，安裝完nvidia-driver後，要記得重新啟動，在測試</li></ol><pre>nvidia-smi</pre><p>不然會報錯，nvidia driver無法連接。</p><p>2. 步驟(2)，安裝CUDA可以到官網選擇版本：</p><ul><li>pytorch有限制cuda版本，參考 <a href="https://pytorch.org/get-started/locally/">https://pytorch.org/get-started/locally/</a></li></ul><p><a href="https://developer.nvidia.com/cuda-toolkit-archive">CUDA Toolkit Archive</a></p><p>選擇linux-&gt;x86_64-&gt;Ubuntu-&gt;22.04-&gt;deb(local)</p><p>下面會出現安裝指令，依照步驟安裝就好了。</p><p>3.重啟後，執行nvcc -V會出現錯誤，此時再安裝toolkit</p><p>p.s. nvcc -V記得大寫</p><pre>sudo apt install nvidia-cuda-toolkit</pre><p>4. 步驟(3)安裝cudnn可以直接安裝deb包了：</p><p>進入cudnn網站 <a href="https://developer.nvidia.com/rdp/cudnn-download">cuDNN Download | NVIDIA Developer</a>，選擇</p><pre>Download cuDNN v8.5.0 (August 8th, 2022), for CUDA 11.xLocal Installers for Windows and Linux, Ubuntu(x86_64, armsbsa)</pre><pre>Local Installer for Ubuntu22.04 x86_64 (Deb)</pre><p>下載完直接安裝deb包就好了。</p><p>5.配置conda與虛擬環境</p><p>6.安裝pytorch</p><p>進入官網：<a href="https://pytorch.org/get-started/locally/">https://pytorch.org/get-started/locally/</a></p><p>選擇stable-&gt;linux-&gt;conda-&gt;python-&gt;CUDA(version)</p><p>依照下方指令安裝即可。</p><p>7.測試</p><pre>python<br>&gt; import torch<br>&gt; torch.cuda.is_available()<br>&gt; True</pre><p>成功啦！</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5841d661021" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tobys-study-notes/ubuntu%E5%AE%89%E8%A3%9Dpytorch-gpu-%E5%95%8F%E9%A1%8C%E7%B8%BD%E7%B5%90-c5841d661021">ubuntu安裝pytorch-gpu 問題總結</a> was originally published in <a href="https://medium.com/tobys-study-notes">Toby’s study notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BERT簡單概念學習]]></title>
            <link>https://medium.com/tobys-study-notes/bert%E6%A6%82%E5%BF%B5%E5%AD%B8%E7%BF%92-74081e9a5968?source=rss----89298e835f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/74081e9a5968</guid>
            <category><![CDATA[bert]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[attention]]></category>
            <category><![CDATA[transformer-model]]></category>
            <dc:creator><![CDATA[Toby]]></dc:creator>
            <pubDate>Mon, 04 Jul 2022 13:19:00 GMT</pubDate>
            <atom:updated>2022-09-22T18:27:46.700Z</atom:updated>
            <content:encoded><![CDATA[<p>BERT是NLP(自然語言處理)中常使用的模型，相較於RNN/LSTM通常能取得更好的表現，所以這篇文章簡單介紹BERT的概念。</p><p>首先可以先觀看幾部影片，由淺入深的掌握概念:</p><ol><li>遞迴神經網路進化史 從RNN到BERT（台灣人工智慧小聚）</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FZDIUp3QRf8w%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZDIUp3QRf8w&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FZDIUp3QRf8w%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0a2804438cdc5cbc71c7c62f56f52ff/href">https://medium.com/media/c0a2804438cdc5cbc71c7c62f56f52ff/href</a></iframe><p>2.【機器學習2021】自督導式學習 (Self-supervised Learning) (二) BERT簡介</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fgh0hewYkjgo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dgh0hewYkjgo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fgh0hewYkjgo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c8d9194593eb658b31491839be3306c/href">https://medium.com/media/2c8d9194593eb658b31491839be3306c/href</a></iframe><h3>正文:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rperBpkmjTtFADIS_aRFjg.png" /></figure><p>在RNN的encoder-decoder model中，會使用一組向量作為中間的特徵。但只使用一組向量很難表示詞語間的關係(「他」指的是胖虎還是大雄)，所以我們會計算關係權重，用加權的方法產生多個向量，作為encoder的輸出。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dx0TYD1UFdStjldQiaSwAg.png" /></figure><p>為了釐清輸入詞語間的關係，需要引入self-attention，計算輸入詞語間的相關度後，依據權重作加權輸出。如此一來就可以分析出代稱的關係。</p><p>Ex. I am a student，「I」和「student」的關係會比較重。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1B86MXwT3IXgjxfrJfZ2xg.png" /></figure><p>transformer model中，引入了Multi-Head Attention。而BERT就屬於encoder的部分。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wMs7gqC33-tp5CzBbXXtiQ.png" /></figure><p>BERT是encoder的部分，訓練時我們在BERT後方加上linear layer，做挖空填寫和語句順序的訓練。</p><p>例如將台灣大學的「灣」用mask蓋住，然後訓練linear layer預測下一個詞的機率，「灣」應該會最大。由於使用的資料本來是完整的，所以我們會知道mask的內容，因此我們不需要標記資料集來學習，也就是self-supervised learning。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Jb6tkoEOWrPud4s3XzJ3g.png" /></figure><p>剛剛訓練的BERT只有填空、排句子的能力。需要通過改變後續的layer，來產生不同功能的輸出。這個步驟稱為Fine-Tune。</p><p>Ex.想要做情感分析，就在後方接上classification model做分類，輸出為positive/negative的分類問題。</p><p>由於下游任務是我們指定的，所以需要標記好的資料作訓練，例如情感分析的資料集，來做最後的訓練。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74081e9a5968" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tobys-study-notes/bert%E6%A6%82%E5%BF%B5%E5%AD%B8%E7%BF%92-74081e9a5968">BERT簡單概念學習</a> was originally published in <a href="https://medium.com/tobys-study-notes">Toby’s study notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[解決apt在精簡docker上找不到vim]]></title>
            <link>https://medium.com/tobys-study-notes/%E8%A7%A3%E6%B1%BAapt%E5%9C%A8%E7%B2%BE%E7%B0%A1docker%E4%B8%8A%E6%89%BE%E4%B8%8D%E5%88%B0vim-742428bee915?source=rss----89298e835f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/742428bee915</guid>
            <dc:creator><![CDATA[Toby]]></dc:creator>
            <pubDate>Fri, 14 Aug 2020 08:09:31 GMT</pubDate>
            <atom:updated>2020-08-26T04:54:15.255Z</atom:updated>
            <content:encoded><![CDATA[<h3>解決apt在精簡docker上找不到vim/ifconfig等基本命令</h3><p>在精簡的docker執行以下指令</p><pre>apt-get install vim</pre><p>出現以下錯誤</p><pre>E: Unable to locate package vim</pre><p>解決方法:更新套件庫</p><pre>apt-get update<br><br>apt-get install apt-file<br><br>apt-file update</pre><p>安裝vim</p><pre>apt-get install vim</pre><p>安裝ifconfig</p><pre>apt-get install net-tools</pre><p>#完成</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=742428bee915" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tobys-study-notes/%E8%A7%A3%E6%B1%BAapt%E5%9C%A8%E7%B2%BE%E7%B0%A1docker%E4%B8%8A%E6%89%BE%E4%B8%8D%E5%88%B0vim-742428bee915">解決apt在精簡docker上找不到vim</a> was originally published in <a href="https://medium.com/tobys-study-notes">Toby’s study notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java8證照(OCAJP)新手指南]]></title>
            <link>https://medium.com/tobys-study-notes/java8%E8%AD%89%E7%85%A7-ocajp-%E6%96%B0%E6%89%8B%E6%8C%87%E5%8D%97-d08d099dd832?source=rss----89298e835f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/d08d099dd832</guid>
            <dc:creator><![CDATA[Toby]]></dc:creator>
            <pubDate>Mon, 10 Aug 2020 09:18:44 GMT</pubDate>
            <atom:updated>2020-08-10T09:21:58.734Z</atom:updated>
            <content:encoded><![CDATA[<h3>1.前言</h3><p>今年暑假想說測試一下自己，於是報名了OCAJP的考試(2020/08)。小弟是在巨匠電腦報名的，OCAJP加OCPJP共花了8000多元，相當的貴啊，各位一定要準備好再參加，不然實在有點浪費。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sAkicnuZrh5Yiu-fTM4M1g.png" /><figcaption>效期只有一年</figcaption></figure><h3>2.準備</h3><p>我在巨匠電腦上過Java的認證課程，所以在準備上除了看看課程筆記，就只有買了一本&lt;Java SE8 OCAJP專業認證指南&gt;。</p><p>書中的觀念講解十分清楚，一開始擔心題目太少，但是做起來發現其實挺多了，可以用來複習基本知識。</p><p>其中考古題命中率可以說相當的低啊，幾乎只有幾題有命中。所幸題目不是太難，只要該注意的有注意到就可以得分。只是有些題目文字相當的多，長度都比書中的題目長上不少，分配時間時要多多注意。</p><h3>3.考試</h3><p>考試時可以提早十分鐘到考場，冷靜休息一下再考。</p><p>考試時要記得攜帶<strong><em>雙證件，</em></strong>現場會幫你<strong><em>拍照</em></strong>，簽名等程序，之後會帶你到一個小房間，全程都有攝影，還有一個小白板可以計算，照著指示完成就行了。</p><p>考題有70題，作答時間150分鐘，題目的英文敘述有些長，對我來說有點趕，如果你答得比較快，應該沒什麼壓力。建議不會的題目可以按下Mark鍵，最後再多做一次檢查。</p><p>考試完後一陣子，就會收到通知mail(官方說30分鐘，實際大概10分鐘內)，</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*5hBCWcTxwjawS4PQZJY2jw.png" /></figure><p>點進去就會看到分數，只要&gt;65%就通過了。</p><h3>4.準備方向</h3><p>因為我是學完Java後，碰了C一陣子，才回來考證照，所以發現有不少的地方需要注意。</p><blockquote>(1)String是immutable(也就是不可更改的)</blockquote><p>考題常常出現string.replace(x,x)，這樣是不會有任何效果的。</p><p>實際上要寫成string = string.replace(x,x)</p><blockquote>(2)Public/Default/Protected/Private存取<em>修飾</em></blockquote><p>四種權限要記住範圍，範圍外存取會編譯失敗。</p><blockquote>(3)Throwable</blockquote><p>Exception跟Error都是繼承自Throwable，也是throw(s)/catch後方能接住的類別。</p><p>其中Exception除了RuntimeException外都要事先Catch/throws，而記憶體不足等Error是不需要的(ArrayIndexOutOfBound不需要的)</p><p>這部分考得相當多，要多練習。</p><blockquote>(4)參數初始化</blockquote><p>區域變數 不會自動初始化</p><p>全域變數/陣列 都會</p><blockquote>(5)Switch內容</blockquote><p>Switch能承接的內容只有Byte,Short,Int,String,char，(long不行)，並且String承接的選項要用&quot;&quot;包起來。</p><blockquote>(6)args</blockquote><p>Java的程式參數預設是沒有的，不向C++的args[0]是程式的所在路徑， Java的args不指定length就是0。</p><blockquote>(7)main</blockquote><p>C++的main打 int main(){}就能跑，Java則不行</p><p>要打成 public static void main(String[] args){}才能跑，甚麼都不能少，但是public跟static可以對調。</p><blockquote>上面提到的只是一小部分。儘管學會了理論觀念，還是要實際寫寫看程式，才會發現很多小細節。</blockquote><h3>5.結論</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RofnFY68kodnMDZZrx_m2A.png" /><figcaption>終於考到拉!!!</figcaption></figure><p>這張證照的容錯率不低，只要多花點時間準備，應該都能通過。祝各位拿到證照拉~</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d08d099dd832" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tobys-study-notes/java8%E8%AD%89%E7%85%A7-ocajp-%E6%96%B0%E6%89%8B%E6%8C%87%E5%8D%97-d08d099dd832">Java8證照(OCAJP)新手指南</a> was originally published in <a href="https://medium.com/tobys-study-notes">Toby’s study notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>