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 一维到三维推广

相关文章
相关标签/搜索