深度学习入坑指北

这是基于markdown-preview-enhanced插件编写的一个加强版的Markdown文件。
格式有所调整,原版是可以通过Reveal生成PPT效果的。
Github上的原版文件以及Reveal展示

深度学习简介

是什么?

  • AI大爆发的导火索

  • 机器学习的最前沿分支

  • 深度学习 = 深度神经网络


AI&机器学习&深度学习

机器学习怎么学?

  • 监督学习
    手把手教学

  • 无监督学习
    丢你本书看,然而并不想理你

  • 强化学习
    丢你本书看,请你做题,板子伺候

深度学习的强项

监督学习

  • 分类

  • 回归

分类,就是选择。

上哪个大学

找谁做女友

做什么工作

玩什么游戏

全是分类

应用

  • 图片识别,行为识别,自动驾驶
  • 聊天机器人,机器翻译
  • 生成文本,图片,语音,视频
  • AlphaGo,自动打星际2

为什么用深度学习?

简单粗暴效果好!

简单粗暴

Input 扔进 NN 出Output

效果好

为什么深度学习这么强?


- 高性能
GPU,TPU,NPU

  • 大数据
    互联网,物联网产生海量数据

  • 强算法
    先驱们的不断开拓优化
    CNN,RNN,GAN,DQN,CapsuleNet


NN打油诗
- East196

机器性能大提升,
海量数据在产生。
群策群力来优化,
神经网络强大深。

看起来公式好难懂~~

只需要理解三个概念
- 高数 导数 函数变化的趋势
- 线代 矩阵乘法 维度的对应
- 概率 事件发生的几率 可能性

从神经网络到深度学习

y=wx+b y = w x + b 谈起

最简单的函数

y=f(x) y = f ( x )

线性关系

y=wx+b y = w x + b


给两组数据:

xy
102
34

构成方程:

\begin{cases}
2 = 10w+ b \\
4 = 3w+b
\end{cases}

怎么解?:)


import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import *
#指定默认字体  
matplotlib.rcParams['font.family']='simhei'  
#解决负号'-'显示为方块的问题  
matplotlib.rcParams['axes.unicode_minus']=False  

#解方程 y = wx + b
x = np.array([10,3])
y = np.array([2,4])

A = np.vstack([x, np.ones(len(x))]).T
w, b = np.linalg.lstsq(A, y)[0]
#print(w, b)

# 再来画个图
plt.axis([0, 15, 0 ,6])
plt.plot(x, y, 'o', label=u'原始数据', markersize=10)

t = np.linspace(-10,20,10)
plt.plot(t, w*t + b, 'r', label=u'线性方程')
plt.legend()
plt.show()


然而,现实世界是:


import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import *
#指定默认字体  
matplotlib.rcParams['font.family']='simhei'  
#解决负号'-'显示为方块的问题  
matplotlib.rcParams['axes.unicode_minus']=False  

# 模拟真实数据
x = np.linspace(-15,20,100)
y = 10*x +np.random.rand(100)*120
z = 3*x*x +np.random.rand(100)*160
m = 2*x*x +10*x +np.random.rand(100)*250

# 再来画个图
plt.plot(x, y, 'o', label=u'真实数据', markersize=10)
plt.plot(x, z, 'x', label=u'数据', markersize=10)
plt.plot(x, m, '*', label=u'数据', markersize=10)

plt.legend()
plt.show()

机器学习

use scikit-learn
- 监督学习:分类,回归
- 无监督学习:聚类


- 基本回归:线性、决策树、SVM、KNN
- 集成方法:随机森林、Adaboost、GradientBoosting、Bagging、ExtraTrees

最简单的神经网络

Neural Network

digraph Ped_Lion_Share           {
rankdir=LR;
label = "最简单的神经网络" ;
"x" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"f" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"y" [shape=circle  , regular=1,style=filled,fillcolor=white   ]
"x"->"f"
"f"->"y"
}

只有一个神经元

神经网络怎么计算?

权重Weight与偏置Biase

y=wx+b y = w x + b
面熟对不对?
求解线性问题
权重和偏置怎么设置?
我也不知道,那就按正态分布随机吧…

激活函数

面对现实
非线性世界


激活函数 Sigmoid&Tanh

import math  
import matplotlib.pyplot as plt  
import numpy as np  
import matplotlib as mpl  
mpl.rcParams['axes.unicode_minus']=False  


def  sigmoid(x):  
    return 1.0 / (1.0 + np.exp(-x))  

fig = plt.figure(figsize=(6,4))  
ax = fig.add_subplot(111)  

x = np.linspace(-10, 10)  
y = sigmoid(x)  
tanh = 2*sigmoid(2*x) - 1  

plt.xlim(-11,11)  
plt.ylim(-1.1,1.1)  

ax.spines['top'].set_color('none')  
ax.spines['right'].set_color('none')  

ax.xaxis.set_ticks_position('bottom')  
ax.spines['bottom'].set_position(('data',0))  
ax.set_xticks([-10,-5,0,5,10])  
ax.yaxis.set_ticks_position('left')  
ax.spines['left'].set_position(('data',0))  
ax.set_yticks([-1,-0.5,0.5,1])  

plt.plot(x,y,label="Sigmoid",color = "blue")  
plt.plot(2*x,tanh,label="Tanh", color = "red")  
plt.legend()  
plt.show()  


激活函数 ReLU

import math  
import matplotlib.pyplot as plt  
import numpy as np  
import matplotlib as mpl  
mpl.rcParams['axes.unicode_minus']=False  

fig = plt.figure(figsize=(6,4))  
ax = fig.add_subplot(111)  

x = np.arange(-10, 10)  
y = np.where(x<0,0,x)  

plt.xlim(-11,11)  
plt.ylim(-11,11)  

ax.spines['top'].set_color('none')  
ax.spines['right'].set_color('none')  

ax.xaxis.set_ticks_position('bottom')  
ax.spines['bottom'].set_position(('data',0))  
ax.set_xticks([-10,-5,0,5,10])  
ax.yaxis.set_ticks_position('left')  
ax.spines['left'].set_position(('data',0))  
ax.set_yticks([-10,-5,5,10])  

plt.plot(x,y,label="ReLU",color = "blue")  
plt.legend()  
plt.show()  

反向传播神经网络

Back-propagation Neural Network
- 前馈神经网络
- 优化器根据误差回头修正参数

然而,Tensorflow 默默安排好了一切

识别图片?

输入 => 特征

九宫格,9个特征
上中下,3个特征
整图,1个特征
9+3+1=13

输入 == 特征

NO!
现在计算机跑这么快了,
我要把 宽*高*RGBA 直接扔进去!!!

DNN出场

Deep Neural Network
更大更深的神经网络
use tensorflow pytorch

CNN

Convolutional Neural Network
卷积神经网络
CNN

卷积:手电筒一块一块过
手电筒
每次看到手电筒照到的那 一块地方


池化:近视眼心更宽
近视眼
n * n -> 1 * 1

CNN应用

手写识别
猫狗分类

发现小行星

RNN

Recurrent Neural Network
循环神经网络
RNN
原理:状态记忆

LSTM

Long-Short Term Memory
LSTM
原理:三重门

RNN应用

机器翻译

机器翻译

语音识别

语音识别

行为识别

行为识别

前沿技术

GAN

Generative Adversarial Network
生成对抗网络
GAN

GAN应用

DCGAN生成女朋友

Deep Convolutional Generative Adversarial Network
DCGAN生成女朋友

神奇女侠下海

观海背锅

DRL

Deep Reinforcement Learning


RL


DQN玩游戏
game


AlphaGo系列
alphago

Autoencoder

digraph d3 {
rankdir=LR;


label = "自动编码器" ;

"x0" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x1" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x2" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x3" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x4" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x5" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x6" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x7" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x8" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"x9" [shape=circle     , regular=1,style=filled,fillcolor=white   ]


"e1" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"e2" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"e3" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"e4" [shape=circle     , regular=1,style=filled,fillcolor=white   ]

"m1" [shape=circle  , regular=1,style=filled,fillcolor=white   ]
"m2" [shape=circle  , regular=1,style=filled,fillcolor=white   ]

"d1" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"d2" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"d3" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"d4" [shape=circle     , regular=1,style=filled,fillcolor=white   ]

"r0" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r1" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r2" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r3" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r4" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r5" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r6" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r7" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r8" [shape=circle     , regular=1,style=filled,fillcolor=white   ]
"r9" [shape=circle     , regular=1,style=filled,fillcolor=white   ]

"x0"->"e1"
"x1"->"e1"
"x2"->"e1"
"x3"->"e1"
"x4"->"e1"
"x5"->"e1"
"x6"->"e1"
"x7"->"e1"
"x8"->"e1"
"x9"->"e1"
"x0"->"e2"
"x1"->"e2"
"x2"->"e2"
"x3"->"e2"
"x4"->"e2"
"x5"->"e2"
"x6"->"e2"
"x7"->"e2"
"x8"->"e2"
"x9"->"e2"
"x0"->"e3"
"x1"->"e3"
"x2"->"e3"
"x3"->"e3"
"x4"->"e3"
"x5"->"e3"
"x6"->"e3"
"x7"->"e3"
"x8"->"e3"
"x9"->"e3"
"x0"->"e4"
"x1"->"e4"
"x2"->"e4"
"x3"->"e4"
"x4"->"e4"
"x5"->"e4"
"x6"->"e4"
"x7"->"e4"
"x8"->"e4"
"x9"->"e4"
"e1"->"m1"
"e2"->"m1"
"e3"->"m1"
"e4"->"m1"
"e1"->"m2"
"e2"->"m2"
"e3"->"m2"
"e4"->"m2"
"m1"->"d1"
"m1"->"d2"
"m1"->"d3"
"m1"->"d4"
"m2"->"d1"
"m2"->"d2"
"m2"->"d3"
"m2"->"d4"
"d1"->"r0"
"d1"->"r1"
"d1"->"r2"
"d1"->"r3"
"d1"->"r4"
"d1"->"r5"
"d1"->"r6"
"d1"->"r7"
"d1"->"r8"
"d1"->"r9"
"d2"->"r0"
"d2"->"r1"
"d2"->"r2"
"d2"->"r3"
"d2"->"r4"
"d2"->"r5"
"d2"->"r6"
"d2"->"r7"
"d2"->"r8"
"d2"->"r9"
"d3"->"r0"
"d3"->"r1"
"d3"->"r2"
"d3"->"r3"
"d3"->"r4"
"d3"->"r5"
"d3"->"r6"
"d3"->"r7"
"d3"->"r8"
"d3"->"r9"

"d4"->"r0"
"d4"->"r1"
"d4"->"r2"
"d4"->"r3"
"d4"->"r4"
"d4"->"r5"
"d4"->"r6"
"d4"->"r7"
"d4"->"r8"
"d4"->"r9"
}

作用

保持输入和输出一致!!!


脑子秀逗了???

文青的解释


声律启蒙
梅酸对李苦,青眼对白眉

digraph dui {
rankdir=LR;
label = "文青的神经网络" ;
"曹操说梅酸"->"梅酸"
"王戎说李苦"->"李苦"
"阮籍青眼"->"青眼"
"马良白眉"->"白眉"
"梅酸"->"梅酸对李苦"
"李苦"->"梅酸对李苦"
"青眼"->"青眼对白眉"
"白眉"->"青眼对白眉"
"青眼对白眉"->"青 眼"
"青眼对白眉"->"白 眉"
"梅酸对李苦"->"梅 酸"
"梅酸对李苦"->"李 苦"
"青 眼"->"阮籍 青眼"
"白 眉"->"马良 白眉"
"梅 酸"->"曹操 说梅酸"
"李 苦"->"王戎 说李苦"
}


梅酸对李苦,青眼对白眉是能够复原的高度精简过的信息
同样,m1、m2 代表了全部的输入信息!!!
也就是说自动缩减了特征的维度~
带来了玩法的改变!!!

Capsule Net

胶囊网络

capsule net

Tips

可能的学习顺序

  • 入门:简单易懂
  • 经典:全面严谨
  • Blog
  • Github
  • 论文 arxiv
  • 比赛 kaggle 天池
    dot
    digraph graph1 {
    学习->思考->行动->学习
    }

视频

书籍

实战类

没错,随便买,反正你会去Github上下代码的~~~

专业类
科普类

版权声明:转载必须注明本文转自 East196 的博客:http://blog.csdn.net/east196
【本文由”深度熊猫”发布,2018年4月24日】

Logo

学大模型,用大模型上飞桨星河社区!每天8点V100G算力免费领!免费领取ERNIE 4.0 100w Token >>>

更多推荐