<?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[ML² Notes - Medium]]></title>
        <description><![CDATA[ML² Notes - Medium]]></description>
        <link>https://medium.com/ml%C2%B2-notes?source=rss----7e89bd660417---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>ML² Notes - Medium</title>
            <link>https://medium.com/ml%C2%B2-notes?source=rss----7e89bd660417---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:33:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/ml%C2%B2-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[Improving Deep Neural Networks Week 1]]></title>
            <link>https://medium.com/ml%C2%B2-notes/improving-deep-neural-networks-week-1-3e08958bdb04?source=rss----7e89bd660417---4</link>
            <guid isPermaLink="false">https://medium.com/p/3e08958bdb04</guid>
            <dc:creator><![CDATA[Jack Pan]]></dc:creator>
            <pubDate>Mon, 15 Jan 2018 15:34:06 GMT</pubDate>
            <atom:updated>2018-01-15T15:34:06.118Z</atom:updated>
            <content:encoded><![CDATA[<p>深度學習層數、 Hidden Unit 數量、 Activation Function 、 Learning Rate 等需要決定的 Hyperparameters 通常會透過多次的測試來決定。</p><p>將資料切分成 Train / Dev / Test 三份，用 Train Set 訓練模型、 Dev Set 檢查不同 Hyperparameters 下模型的效果，並挑出表現最好的 Hyperparameters 、最後用 Test Set 得到無偏差的模型效果評估。</p><p>在傳統機器學習上，會用 60 / 20 / 20 的方式去切資料。但隨著資料量增大， Andrew 建議不用跟隨此原則， Dev / Test Set 皆各取一萬筆資料即可，其餘的皆用來訓練模型。</p><p>在切分資料的時候要注意，最好三份資料的分佈狀態皆是接近的，尤其是 Dev / Test Set ，因為這兩份會拿來評估模型的表現。</p><p>而若不想得到無偏差的模型效果評估，就可以不用切出 Test Set 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*JCC4p2pgjmSg5O_Fc_AOFA.png" /></figure><p>透過 Train / Dev Set 來檢查模型是否有 High Bias 或 High Variance 。</p><p>假設已知模型最佳表現為 x ，則若在 Train Set 表現接近於 x ，是 Low Bias ，反之是 High Bias 。</p><p>若在 Dev Set 之表現接近於在 Train Set 之表現，是 Low Variance ，反之是 High Variance 。</p><p>建構深度學習網路時可以依照下面的步驟進行。首先將 Bias 降到足夠低，可以透過加大網路、增加訓練時間、改變神經網路的架構來達成。</p><p>當 Bias 夠低時，檢查 Variance 是否會高，若高的話，透過增加 Training Samples 、加上 Regularization 、改變神經網路的架構來降低。</p><p>調整過後再回頭檢視 Bias ，重複過程，直到 Bias 和 Variance 達到要求。</p><p>L2 Regularization ：所有的 w 平方後相加。<br>L1 Regularization ：所有的 w 絕對值相加。會使得 w 比較稀疏（較多 0 ）。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bzp5_Hl0sC2VU36CLyq10w.png" /></figure><p>上圖為加上 L2 Regularization 後做 Gradient Descent 的推導。</p><p>可以發現加上 L2 Regularization 後，每次更新 w 時，會多出一項 (- alpha*lambda/m)*w ，會使 w 每次都往 0 更靠近，因此又被稱作 Weight Decay 。</p><p>L2 Regularization 可以降低 Variance ，是因為它會使得 W 變小，使神經網路中，節點影響力下降，相對降低神經網路的複雜度。</p><p>另一種說法是，當使用 Tanh 當作 Activation Function 時，由於降低 W 會使進入 Tanh 的值變小較接近於零，其是在 Tanh 中接近於線性反應的區間，因此會讓神經網路的每個節點都變成幾近線性，降低複雜度。</p><ul><li>From HW: L2-regularization relies on the assumption that a model with small weights is simpler than a model with large weights. Thus, by penalizing the square values of the weights in the cost function you drive all the weights to smaller values. It becomes too costly for the cost to have large weights! This leads to a smoother model in which the output changes more slowly as the input changes.</li></ul><p>神經網路中另一種 Regularization 的方式為 Dropout 。設定每個節點在訓練時保留的機率，每次會刪掉不同的節點進行訓練。</p><p>而訓練完後，使用神經網路時，不需要刪掉任何節點。</p><p>現在最常用的 Dropout 方式為 Inverted Dropout ，它會依照刪除節點的機率，重新 Normalize 每層的 Activation Value 。如此可以確保，每次下一層拿到的輸入期望值都會是一樣的，不會降低。下圖中的 a3 /= keep-prob 即是在做這件事。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*qTmdswybPrqt01ab6naRuQ.png" /></figure><p>Dropout 因為每次都會隨機刪除掉一些節點，所以每個節點不會僅依靠前一層的少數節點，否則當這些節點被刪除時，就無法有正確輸出。因此會平均分佈權重在前一層的所有節點上，與 L2 Regularization 的效果類似。</p><ul><li>From HW: When you shut some neurons down, you actually modify your model. The idea behind drop-out is that at each iteration, you train a different model that uses only a subset of your neurons. With dropout, your neurons thus become less sensitive to the activation of one other specific neuron, because that other neuron might be shut down at any time.</li></ul><p>Dropout 只需用在訓練時。</p><p>Dropout 可以設定不同的機率在不同層上，通常會在參數比較多的層設定較大的機率。不過這樣的方式也會讓 Hyperparameters 增加，需要微調每個層設定的 Dropout 機率。折中的做法是，選取一些層做 Dropout ，另一些不做，而這些做 Dropout 的層皆使用相同的機率。</p><p>Dropout 一開始是使用於電腦視覺領域，因為相較於影像像素數量，訓練的資料都不太足夠，多會有 Overfitting 的問題。但不一定同樣適用於其他的領域。</p><p>Dropout 的缺點是，使用後 Cost Function 將不再能完整定義，因為每次會有隨機的節點被丟掉。所以在每次的訓練迴圈裡， Cost Function 不一定皆會遞減。若要檢查訓練過程是否有問題，最好將 Dropout 關掉比較容易檢查。</p><p>其他 Regularization 的方法：</p><p>Data Augmentation ，如將圖片的資料做旋轉、縮放等處理後，當作一個新的訓練資料。使模型適應更多樣化的資料。</p><p>Early Stop ，訓練模型時，若 Dev Set 的 Cost Function 開始上升，即停止。但 Andrew 並不推薦這樣的做法，因為 Early Stop 同時也使 Cost 沒有降到最低。他認為降低 Cost 、避免 Overfitting 兩件事，應該分開來處理，降低耦合性。</p><p>在訓練神經網路時，先將所有的輸入特徵皆 Normalize 成平均為零、變異數為一。這樣可以加快訓練速度。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*wzmnAiLp2vi48qgvOt5Mcw.png" /></figure><p>訓練深度神經網路的一個問題是， Gradient Vanishing / Exploding。當層數很多時，只要數值不接近於 1 ，經過多層的傳播，數值即會變很大或很小。</p><p>其中一個解決方式是，在一開始的時候對於 W 做好的初始化，讓 Activation Function 出來的數字能盡量接近 1 。當 Input 越多時， W 的初始化就要越小，如此才能使最後輸出的值較小。而不同的 Activation Function 也有不同的初始化方式。若用 Relu ，通常用 ：<br>np.random.randn(shape)*np.sqrt(2/n^(l-1)) 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*sM-B1A6mKVcJ5J0JVBO54Q.png" /></figure><p>在檢查 Gradient 算的正不正確時，用 Double Side 的估計方式會比較準。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*bO1XjHeWH5STlPtFok-QmA.png" /></figure><p>同時 Andrew 也給我們準則，看怎麼樣的狀況是計算 Gradient 有問題。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*U5Rd6eLUDA6QGx2ZHOwXwQ.png" /><figcaption>d_theta_appro 代表用 Double Side 計算出來的 Gradient 。</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e08958bdb04" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ml%C2%B2-notes/improving-deep-neural-networks-week-1-3e08958bdb04">Improving Deep Neural Networks Week 1</a> was originally published in <a href="https://medium.com/ml%C2%B2-notes">ML² Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neural Networks and Deep Learning Week 4]]></title>
            <link>https://medium.com/ml%C2%B2-notes/neural-networks-and-deep-learning-week-4-73fff2c7ac5d?source=rss----7e89bd660417---4</link>
            <guid isPermaLink="false">https://medium.com/p/73fff2c7ac5d</guid>
            <dc:creator><![CDATA[Jack Pan]]></dc:creator>
            <pubDate>Mon, 08 Jan 2018 16:08:39 GMT</pubDate>
            <atom:updated>2018-01-08T16:08:38.791Z</atom:updated>
            <content:encoded><![CDATA[<h4>Deep Neural Network</h4><p>將上一週的兩層 Neural Network 繼續加入更多層，如：四層五層，即是深度神經網路。</p><p>在建置深度神經網路時，確認各個變數或參數的維度正確，可以降低 Bug 的發生率。</p><p>n^[l] 代表 l 層共有幾個節點。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*h49UtWLoyEvMCoe_Jg3piA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*PqUPUPCkxVjo9d82FKhPuw.png" /></figure><p>當層數加大時， Neural Network 越可以將低層的特徵，以有效率的方式結合，讓整個模型能夠學習複雜的問題。</p><p>以人臉辨識為例，低層次的部分，會學習到如線條邊緣等特徵，將這些特徵組合會形成單一眼睛、鼻子等輪廓，再將這些特徵組合，即可以合成一張臉。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*xL_RlcmHRzB34Di6Plscgw.png" /></figure><p>另一個例子是，若要學習 x1 XOR x2 XOR x3 … XOR xn 的函數。很明顯下圖左邊是更有效率的表示方式。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*XymfP487KzWL25EfAIaQXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*K9BAP75vkQkqgzKIeV81iQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*My-qE6nEOzet_rO-CfCzyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*LjdCKMQAUL7nQWauLXgb2Q.png" /></figure><p>Parameters： W 與 b 。</p><p>Hyperparameters： Neural Network 的層數、每層的節點數量、 Activation Function 、 Learning Rate ……等，需要人工設定的部分。</p><h4>Note on HW</h4><p>使用五層的神經網路，將先前辨識貓的模型準確度從 70% 提升到 80% 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*ukvObzt_9OYgazHoLMlo-w.png" /></figure><p>但對於如上圖這些例子，仍是辨識錯誤的樣本。</p><p>作業中歸納幾個原因：<br>* 貓的身體位置比較不一樣<br>* 貓和背景顏色很像<br>* 不常見的貓顏色與品種<br>* 角度、亮度、貓在圖中很大或很小</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73fff2c7ac5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ml%C2%B2-notes/neural-networks-and-deep-learning-week-4-73fff2c7ac5d">Neural Networks and Deep Learning Week 4</a> was originally published in <a href="https://medium.com/ml%C2%B2-notes">ML² Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neural Networks and Deep Learning Week 3]]></title>
            <link>https://medium.com/ml%C2%B2-notes/neural-networks-and-deep-learning-week-3-c0752b5ca1b?source=rss----7e89bd660417---4</link>
            <guid isPermaLink="false">https://medium.com/p/c0752b5ca1b</guid>
            <dc:creator><![CDATA[Jack Pan]]></dc:creator>
            <pubDate>Mon, 08 Jan 2018 15:33:56 GMT</pubDate>
            <atom:updated>2018-01-08T15:36:39.516Z</atom:updated>
            <content:encoded><![CDATA[<h4>Shallow Neural Network</h4><p>將上一週的 Logistic Regression 多個堆疊起來，即可以形成 Neural Network 。圖中每個圓圈是一個節點，代表一個 Logistic Regression ，且前一層的輸出為下一層的輸入。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*ov3v1pKJDPCalkQ0zE_t7g.png" /></figure><p>上標中括號內的數字代表第幾層。上圖為兩層的 NN ，在講幾層時並不會包含最一開始的輸入層。</p><p>圖中 W^[1] 為 (4, 3) 的矩陣，代表此層有四個 Logistic Regression 的節點，並且每個單元皆輸入三個特徵值。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*BEO7sD6zwWuqlCbhXseqNw.png" /></figure><p>一樣可以透過向量化的方式，一次計算多個樣本的結果。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*qGnm6g5JdaUnJ4C9S5J4og.png" /></figure><p>Logistic Regression 最後一步是用 Sigmoid Function 將數值限制在零和一之間。在 Neural Network 中，此種函數稱為 Activation Function ，控制每一個節點最後要輸出的值是什麼。</p><p>建置 Neural Network 的時候，每個節點可以選擇不同的 Activation Function 。除了 Sigmoid 外，常見的尚有圖中的另外三種： tanh 、 ReLU 、 Leaky ReLU 。</p><p>tanh 的好處是平均值為零，會讓 Neural Network 更好訓練（之後的課程才會解釋）。</p><p>ReLU 和 Leaky ReLU 的好處是，在極大值時，微分值仍很大，不像 Sigmoid 和 tanh 幾近於零，這樣的性質，可使 Gradient Descent 更好運作而讓訓練加快。</p><p>因此預設多使用 ReLU 或 Leaky ReLU 當作節點的 Activation Function 。而 Sigmoid 則多使用在當輸出須限制在零和一之間時。</p><p>如做二元分類的時候：最後一層節點會用 Sigmoid ，來讓輸出是零與一。而前面層的節點則大多數人會用 ReLU 。</p><p>對於 Neural Network 而言，多數節點使用 Activation Function 是必要的。因為 Activation Function 為非線性的函數，如此才能使得 Neural Network 適應更複雜的問題。</p><p>假設沒有 Activation Function ，則 Neural Network 將會成為一堆線性迴歸的線性組合，仍是一個線性模型，無法解決非線性問題。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*kjOnd92liI0TYHzyUQBz9w.png" /></figure><p>在初始化 W 時需注意與 Logistic Regression 不同，不能夠設定其為零。由於 Neural Network 可想像成多個 Logistic Regression 堆疊在一起，若皆將 W 初始為零，則同一層的節點都將得到同樣的 Gradient ，每個節點輸出的東西都一樣，如此就失去多個節點的意義。</p><p>W = np.random.randn(n[i], n[i-1])*0.01</p><p>因此在初始化 W 時，要使用亂數來決定，讓不同的節點一開始就有不同的性質。同時初始化的數值不要過大過小，避免算出來的值過高或過低，當值越極端時，則在 Activation Function 的 Gradient 會過小（如 tanh 的兩端斜率接近於零），導致訓練效率降低。所以如上式會再乘上 0.01 。</p><p>b 在初始化時仍可以設定為零。</p><h4>Note on Implementation of HW</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*4VC8VLHWzwh9KE6b_Dsvrg.png" /></figure><p>現有資料集如上圖，分成紅藍兩類。並根據 X Y 座標預測屬於哪一類。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*LAceixHyb741eTo6XRonkQ.png" /></figure><p>使用 Logistic Regression 的結果如上圖， X Y 座標落在紅色區域內的預測是紅色類別、藍色區域內的則預測為藍色類別。</p><p>由於 Logistic Regression 為線性模型，因此只能夠在此空間上切出一條直線來分類。準確度僅 47% 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*y2xblTS7mInDa1gbCKONrQ.png" /></figure><p>使用如最上方圖的兩層 Neural Network 。可以在此空間切出更多分法，讓模型能適應較複雜的問題。準確度為 90% 。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0752b5ca1b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ml%C2%B2-notes/neural-networks-and-deep-learning-week-3-c0752b5ca1b">Neural Networks and Deep Learning Week 3</a> was originally published in <a href="https://medium.com/ml%C2%B2-notes">ML² Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neural Networks and Deep Learning Week 2]]></title>
            <link>https://medium.com/ml%C2%B2-notes/neural-networks-and-deep-learning-week-2-e9d6b707b41d?source=rss----7e89bd660417---4</link>
            <guid isPermaLink="false">https://medium.com/p/e9d6b707b41d</guid>
            <dc:creator><![CDATA[Jack Pan]]></dc:creator>
            <pubDate>Sun, 07 Jan 2018 15:12:15 GMT</pubDate>
            <atom:updated>2018-01-07T15:13:51.721Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Binary Classification</strong></h4><p>二元分類問題。例如：判斷某張圖片是不是貓的照片。<br>在處理圖片時，彩色圖片通常會將 RGB 拉成一維當作輸入特徵。例如： 64*64 大小的圖片，其 x 之維度將為 12288*1 。</p><h4><strong>Notation</strong></h4><p>m ：資料數量（可能是 training set or testing set or all）。<br>nx：樣本特徵大小。<br>x ：單一樣本的特徵，通常為 nx*1 維。<br>X ：所有樣本的特徵，通常為 nx*m 維。<br>y ：單一樣本的答案，在 Binary Classification 為 1*1 維。<br>Y ：所有樣本的答案，在 Binary Classification 為 1*m 維。</p><h4><strong>Logistic Regression</strong></h4><p>一般的線性迴歸的式子為 w1x1+w2x2+…+wnxn+b ，求解 W 與 b 後，即可用此式回答迴歸問題。<br>而在 Logistic Regression 中為回答二元分類問題，其輸出結果會在 0 和 1 之間，表示正方機率。透過將線性迴歸的式子外圍多包上 Sigmoid 函數來達成此目的。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*Be3Bhz0BA-NgZIYqRVZtug.gif" /><figcaption>Sigmoid function — 經過轉換後，所有值皆會在 0 和 1 之間</figcaption></figure><h4><strong>Logistic Regression Cost Function</strong></h4><p>在求解 W 與 b 的過程中，必須有一個式子評判目前的 W 和 b 好不好，稱為 Cost Function ，當此 Cost Function 計算出來的值越小，代表 W 和 b 選的越好，即模型表現較好。</p><p>決定 Cost Function 前，會先決定 Loss Function 。兩者差別為，<strong> Loss Function 是判斷單一樣本的結果好壞， Cost Function 則是所有樣本。 Cost Function 通常即為所有 Loss Function 的平均。</strong></p><p>由於 Gradient Descent 的特性，會希望 Cost Function 在 W 和 b 空間下為 Convex 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*ZyjEj3A_QyR4WY7y5cwIWQ.png" /></figure><p>同時也要符合 Maximum Likelihood Estimation 之假設，因此設定為：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*hbmrlju2it65SBVI_t9aiA.png" /></figure><h4><strong>Gradient Descent</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*XozfH5MiFkw8r-Oz3LmjRg.png" /></figure><p>模型的訓練目標為選出使 Cost Function 值越小的 W 和 b 的組合。其中一個方法為 Gradient Descent ，如圖中每次將 W 和 b 往梯度的反方向移動，就可以漸漸降低 Cost Function 的值。</p><p>Gradient Descent 將 Cost Function 分別對 W 和 b 做偏微分。該數字的意義為若將現在的 W 或 b 加上一個極小的數字後， Cost Function 會上升或下降多少。</p><p>為了使 Cost Function 數值下降，若偏微分為正，應將 W 或 b 往下調、偏微分為負，應將 W 或 b 往上調。因此可以設定成現在的 W 或 b 減掉偏微分的數值，為新的 W 或 b 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*vi3YUBjTjMWhhfLwYhXytQ.png" /><figcaption>p.s: ln(a) 微分為 1/a</figcaption></figure><p>上圖為單一樣本，即 Loss Function 的偏微分， Cost Function 的偏微分是取 Loss Function 偏微分的平均。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/1*_bTAIq3xo_iv_qxIF_ZpcA.png" /></figure><h4>Vectorization</h4><p>盡量不要使用 For Loop ，用向量化的方式計算並使用 numpy 內建的函數。如此程式會自動進行平行處理。</p><p>將每個樣本平行堆疊在一個矩陣內，即可用矩陣運算的方式一次計算出所有樣本的結果。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*E2Q6x-_UzIzqma1OrmLGIg.png" /><figcaption>右邊為向量化過後的程式，最外層的迴圈還是需要的。大寫字母代表經過堆疊每個樣本後的矩陣。</figcaption></figure><h4>Broadcasting in Python Numpy</h4><p>在 Python Numpy 中，矩陣只要有一個維度對應正確、另一個維度是一，仍可以進行加減乘除。因為 Python Numpy 會自動重複資料，補齊另一個維度。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*N7QsZxywqugWN6_2XlnqIQ.png" /></figure><h4>Note on Python Numpy</h4><p>Python Numpy 有種特別的向量，其維度為 (n, ) ，稱其為 Rank 1 Array 。用這種向量常會發生非預期的行為，因此並不建議使用，應使用 .reshape(n, 1) 將其轉換成正常的向量。</p><h4>Note on Implementation of HW</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vXExcI-sTJ5G9ZRFWRE__g.png" /><figcaption>Normalizing rows: 使用 np.linalg.norm 。</figcaption></figure><p>keepdims=True ，會讓 Numpy 輸出維持一樣維度的向量，在這邊的目的是避免 Numpy 輸出 Rank 1 Array 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*h6rknhCBZU7kKqX2Qyyl4A.png" /></figure><p>使用 Logistic Regression 在此辨識貓的作業上，可以達到約 70% 的正確率。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9d6b707b41d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ml%C2%B2-notes/neural-networks-and-deep-learning-week-2-e9d6b707b41d">Neural Networks and Deep Learning Week 2</a> was originally published in <a href="https://medium.com/ml%C2%B2-notes">ML² Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>