第二週:神經網絡基礎

logistic函數

預測概率yhat = w^t * x +b,爲了保證概率爲1,使用sigmoid函數進行修正,
yhat = 1/(1+e-z)(wt+b)

損失函數和成本函數

利用loss function和cost function 可以來體現預測效果
(how well your parameters w and b are doing on the training set.)
loss function是單個的y的預測效果
公式: 損失函數
cost fuction 是對整體的預測情況進行表示,公式如下:
成本函數

w和b的調試(梯度下降法)

在這裏插入圖片描述成本函數J(w,b)是一個凸函數,要調w和b使成本函數達到最小值

在這裏插入圖片描述

反向傳播和正向傳播(導數)

一個數學公式,從左到右的進行計算即爲正向傳播,從右向左來求導數,爲反向傳播。
在程序中,也許關注的使f的最終的導數,用dvar表示。

廣播

廣播聽起來感覺很高大上,但其實是一種矩陣的擴展。
例如,在計算矩陣A[1,2,3,4]*100時,是將100展開爲【100,100,100,100】來計算
另外,在python中要儘量減少for循環,使用np.來計算矩陣。

具體實現

1、數據預處理
-Figure out the dimensions and shapes of the problem (m_train, m_test, num_px, …)
-Reshape the datasets such that each example is now a vector of size (num_px * num_px * 3, 1)
-“Standardize” the data
2、神經網絡學習

  • Initialize the parameters of the model
  • Learn the parameters for the model by minimizing the cost
  • Use the learned parameters to make predictions (on the test set)
  • Analyse the results and conclude
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章