深度學習入坑指北

深度學習入坑指北

這是基於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=f(x)

線性關係

y=wx+b


給兩組數據:

x y
10 2
3 4

構成方程:

\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
面熟對不對?
求解線性問題
權重和偏置怎麼設置?
我也不知道,那就按正態分佈隨機吧…

激活函數

面對現實
非線性世界


激活函數 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日】

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章