Andrew ng 深度學習課程筆記

課程一 神經網絡和深度學習

1. 深度學習概論

1.2 什麼是神經網絡

從Housing Price Prediction 講起 => regression 迴歸能夠當作一個簡單的單層,一個神經元的神經網絡python

1.3 用神經網絡進行監督學習

image

1.4 爲何深度學習會興起

  • Data
  • Computation
  • Algorithms: 好比sigmod -> relu 使得計算gradient descent更快

image

2. 神經網絡基礎

2.1 二分分類

some notations ...算法

2.2 logistic 迴歸

logistic 迴歸就是一個淺層(shallow, 實際上一個hidden layer也沒有,只有一個output layer)神經網絡bash

Give\ x,\ want\ \hat y = P(y=1|x);\  (0<=y<=1)

parameters:w\in \mathbb{R},b\in \mathbb{R}

Output:\hat y=\sigma(w^tx+b); find\ w,b

\sigma(z)=\frac{1}{1+e^{-z}}
複製代碼

2.3 logistic迴歸損失函數

使用這個損失函數便於計算gradient descent網絡

Loss(Error)\ Function : L(\hat y,y) = - (y\log\hat y + (1-y)\log(1-\hat y)) 

Cost\ Function:  J(w,b) = 1/m *\sum_{i=1}^m  L(\hat y^i,y^i) = -\frac{1}{m}*\sum_{i=1}^m(y^i\log\hat y^i + (1-y^i)\log(1-\hat y^i)) 

複製代碼

2.4 梯度降低法

w := w - \alpha \frac{dJ(w,b)}{dw};\  (\alpha:learning\ rate)

b := b - \alpha \frac{dJ(w,b)}{db}
複製代碼

2.7 計算圖

反向傳播:其實有點相似dp算法,後往前算gradient descent, 這樣有些算的結果能夠複用,計算效率大大提升 框架

image

2.9 logistic迴歸中的梯度降低

\text {圖裏面的a是以前的} \hat y
複製代碼

image

分數求導:結果的分子=原式的分子求導乘以原式的分母-原式的分母求導乘以原式的分子,結果的分母=原式的分母的平方。dom

2.10 logistic迴歸on m個examples

image

2.11 向量化

向量化計算更高效機器學習

import numpy as np
import time

a = np.random.rand(1000000)
b = np.random.rand(1000000)
tic = time.time()
c = np.dot(a, b)
print("cost " + str((time.time() - tic)*1000) + "ms")
複製代碼

2.13 向量化的logistic迴歸

image

2.15 python中的廣播

2.16 python/numpy中的向量說明

不要使用秩爲1的向量,顯式使用1*n或者n*1的向量, 使用reshape和assert來確保維度符合預期ide

import numpy as np
a = np.random.randn(5) #do not use 
print("a:",a.shape,"\n", a)
b = np.random.randn(5, 1)
print("b:",b.shape,"\n", b)
c = np.random.randn(1, 5)
print("c:",c.shape,"\n", c)

a = a.reshape(5, 1)
assert(a.shape == (5, 1))
複製代碼

3. 淺層神經網絡

3.1 神經網絡概覽

image

3.2 神經網絡表示

image

3.5 向量化實現的解釋

image

3.6 激活函數

image

3.7 爲何使用非線性的激活函數

若是是線性的 通過幾層以後仍是線性的,多層就沒有意義了函數

3.8 激活函數的導數

image
image
image

3.9 激活函數的導數

image

image

3.11 隨機初始化

多神經元爲什麼W不能初始化爲0矩陣學習

4. 深層神經網絡

4.1 深層神經網絡

image

4.3 覈對矩陣的維數

image

image

4.7 參數VS超參數

image

課程二 改善深層神經網絡:超參數調試、正則化以及優化

1. 深度學習的實用層面

1.1 訓練、開發、測試集

1.2 誤差、方差

image
image

1.4 Regularization

image
image

lamda 很大會發生什麼:

image

1.6 Drop Out Regularization

1.8 其餘Regularization方法

early stopping

1.9 Normalizing inputs

image

image

1.10 vanishing/exploding gradients

image

1.11 權重初始化

image

1.13 Gradient Check

image

1.14 Gradient Check Implementation Notes

image

2. 優化算法

2.1 Mini-batch gradient descent

batch-size 要適配CPU/GPU memory

2.3 Exponentially weighted averages

image

移動平都可撫平短時間波動,將長線趨勢或週期顯現出來。數學上,移動平都可視爲一種卷積。

Bias correction

image

2.6 Gradient Descent with Momentum

image

2.7 RMSprop

image

2.8 Adam優化算法

Momentum + RMSprop

image

2.9 Learning rate decay

逐步減少Learning rate的方式

2.10 局部最優的問題

在高維空間,容易遇到saddle point可是local optima其實不容易遇到

plateaus是個問題,learning會很慢,可是相似adam的方法能減輕這個問題

3. 超參數調試、batch正則化和程序框架

3.1 搜索超參數

image

  1. Try random values: don't use a grid
  2. Coarse to fine

image

3.4 Batch Normalization

一個問題,在迴歸中能夠normalization在神經網絡中能否作相似的事情

image

經過lamda和beta能夠控制mean和variance

image

image

image

3.6 Batch Normalization爲何有效

  1. By normlization values to similar range of values, it speed up learning
  2. Batch normlization reduces the problem of input values(對於每一層) changing
  3. Has a slight regulazation effect (like dropout, it adds some noice to each hidden layer's activations)

3.7 Batch Normalization at test time

使用訓練中加權指數平均算出來的mean,variance來test

image

3.8 Softmax regression

多類,而不是二類。generazation of logistic regression.

image

3.10 深度學習框架

課程三 結構化機器學習項目

1. 機器學習(ML)策略(1)

1.1 爲何是ML策略

1.2 正交化

  1. Fit training set well in cost function
  • If it doesn’t fit well, the use of a bigger neural network or switching to a better optimization algorithm might help.
  1. Fit development set well on cost function
  • If it doesn’t fit well, regularization or using bigger training set might help.
  1. Fit test set well on cost function
  • If it doesn’t fit well, the use of a bigger development set might help
  1. Performs well in real world
  • If it doesn’t perform well, the development test set is not set correctly or the cost function is not evaluating the right thing

1.3 單一數字評估指標

關於accuracy/precision/recall/F1

image
image

1.4 知足和優化指標

1.5 訓練/開發/測試集劃分

1.6 開發集合測試集的大小

1.7 何時該改變開發/測試集和指標

1.8 爲何是人的表現

1.9 可避免誤差

1.10 理解人的表現

1.11 超過人的表現

1.12 改善你的模型的表現

image

2. 機器學習(ML)策略(2)

2.1 進行偏差分析

2.2 清楚標註錯誤的數據

2.3 快速搭建你的第一個系統,並進行迭代

2.4 在不一樣的劃分上進行訓練並測試

2.5 不匹配數據劃分的誤差和方差

2.6 定位數據不匹配

2.7 遷移學習

2.8 多任務學習

2.9 什麼是端到端的深度學習

2.10 是否要使用端到端的深度學習

課程四 卷積神經網絡

1. 卷積神經網絡

1.1 計算機視覺

真實處理的圖片很大->卷積神經網絡

1.2 邊緣檢測示例

filter(kernel)的選擇有不少種,或者把filter自己看成參數來學習.

image

1.4 Padding

image

1.5 卷積步長

1.6 Convolutions over volumes

image

1.7 單層卷積網絡

image

1.8 簡單卷積網絡示例

image

1.9 池化層

image

1.10 卷積神經網絡示例

image
image

1.11 爲何使用卷積?

image

2. 深度卷積網絡:實例探究

2.1 爲何要進行實例探究

  • Classic networks:
    • LeNet-5
    • AlexNet
    • VGG
  • ResNet
  • Inception

2.2 經典網絡

介紹了三種經典模型:LeNet-5,AlexNet,VGG-16

2.3 殘差網絡(ResNets, Residual Networks)

image

2.4 殘差網絡爲何有用?

2.5 網絡中的網絡以及 1×1 卷積

1×1 卷積能夠壓縮或者保持,增長輸入層的信道(channel)數量.

image

2.6 谷歌 Inception 網絡簡介

2.7 Inception 網絡

Inception module -> Inception network

image
image

2.8 使用開源的實現方案

2.9 遷移學習

使用他人的模型做爲initalization(選擇freeze some layers)訓練

image

2.10 數據擴充

  • mirroring
  • random cropping
  • rotating,shearing,local warping...
  • color shifting

2.11 計算機視覺現狀

image

3. 目標檢測

3.1 目標定位

image

3.2 特徵點檢測

image

3.3 目標檢測

先crop圖片訓練模型 + slide-window =>計算成本很高

image

3.4 卷積的滑動窗口實現

一次計算,其實沒有slide,比傳統的slide-window方式高效不少

image

3.5 Bounding Box預測

YOLO: grid + 3.1中的算法的卷積實現.

image
image

3.6 交併比

IOU - Intersection over Union = SizeOfIntersection/ SizeOfUnion

3.7 非極大值抑制

image

3.8 Anchor Boxes

image

3.9 YOLO 算法

3.10 RPN網絡

image

4. 特殊應用:人臉識別和神經風格轉換

4.1 什麼是人臉識別?

image

4.2 One-Shot 學習

image

4.3 Siamese 網絡

image

4.4 Triplet 損失

image
image
image

4.5 面部驗證與二分類

image

4.6 什麼是神經風格轉換?

4.7 什麼是深度卷積網絡?

image

4.8 代價函數

4.9 內容代價函數

4.10 風格代價函數

核心是maximize 各個channel 的 correlation

image

image

4.11 一維到三維推廣

相關文章
相關標籤/搜索