1. On the Number of Linear Regions of
Deep Neural Networks
NIPS 2014
78 citations
Guido Montúfar
Max Planck Institute for
Mathematics in the Sciences
Razvan Pascanu
Université de Montréal
Kyunghyun Cho
Université de Montréal
Yoshua Bengio
Université de Montréal
8. Background: Expressiveness
● Universality
– A single layer neural net can approximate any
continuous functions if given enough units.
● Then, why bother going deep?
– Depth Efficiency
2
9. Background: Expressiveness
● Universality
– A single layer neural net can approximate any
continuous functions if given enough units.
● Then, why bother going deep?
– Depth Efficiency
● deeper network can represent certain functions more
effectively than shallower ones
2
17. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
all regions = lower-bounded + not-lower-bounded
4
18. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
all regions = lower-bounded + not-lower-bounded
4
19. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
all regions = lower-bounded + not-lower-bounded
not-lower-bounded = left-bounded + not-left-bounded
4
20. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
all regions = lower-bounded + not-lower-bounded
not-lower-bounded = left-bounded + not-left-bounded
4
21. Main Idea
● 1 layer – neurons can separate input in
into at most distinct regions
each neuron separates input into 2 parts
5
22. Main Idea
● 1 layer – neurons can separate input in
into at most distinct regions
● #separate regions(in input space) by region R
R
R’ R’
R’
5
24. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
6
25. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
the ith group Gi deals with ith dimension of input
By divide neurons into n groups
...
G1
...
Gn
...
1.9 "
neurons
6
26. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
...h1 h2 hp
Gi
2.35 "
6
i
27. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
...h1 h2 hp
Gi
2.35 "
6
28. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
...h1 h2 hp
Gi
2.35 "
6
31. Method: Deep Rectifier Network
● regions with output value in
● n groups giving separate regions
8
32. Method: Deep Rectifier Network
● regions with output value in
● n groups giving separate regions
● L layers separate regions
last layer
8
33. Method: Deep Rectifier Network
● regions with output value in
● n groups giving separate regions
L layers each with n neurons 1 layer with nL neurons
● L layers separate regions
last layer
8
34. Method: Deep Rectifier Network
● regions with output value in
● n groups giving separate regions
L layers each with n neurons 1 layer with nL neurons
● L layers separate regions
last layer
8
35. Method: Deep Rectifier Network
L layers each with n neurons 1 layer with nL neurons
with same #neurons, deeper network can
separate inputs into exponentially more regions
9
37. On the Number of Linear Regions of
Deep Neural Networks
NIPS 2014
78 citations
Guido Montúfar
Max Planck Institute for
Mathematics in the Sciences
Razvan Pascanu
Université de Montréal
Kyunghyun Cho
Université de Montréal
Yoshua Bengio
Université de Montréal
今天要報的是一篇 neural network 的理論 paper ,我
們知道 neural network 很厲害,而且 empirical 觀察
似乎越深越厲害,這篇做的是試圖找出 neural
network 越深越厲害的原因,作者是 Yoshua
Bengio ,這是 2014 年幾個重量級的 paper ,同年
重量級 paper 還有之前報過的 GAN 。
38. Background: Expressiveness
● Universality
– Intuitive example:
1D data
1
首先講一下最基本 neural network 很厲害的原因,你
們應該聽過關於 neural network 的 expressive
power ,在 1988 年就有人證明 neural network 的
expressive power 是 universal 的,也就是一層
activation function 使用 sigmoid 的 neural network
可以 approximate 任意連續的函數。
舉例來說,右邊這是一個連續的函數, x 軸是 input ,
y 軸是函數 f(x) 的值,那可以怎麼用 neural network
來 approximate 呢?
40. Background: Expressiveness
● Universality
– Idea: approximate by
sum of step functions
ith
step function Si
(x)
1
你可以想像應該是像階梯形狀的,叫它 step function
S(x) 。舉例來說,這一段的 step function 長這樣,
S(x) 只有在要 approximate 的那一段是定值,其他
時候都是 0 。
41. Background: Expressiveness
● Universality
– How to create a step function?
– Idea: approximate by
sum of step functions
ith
step function Si
(x)
1
剩下的問題是,該怎麼樣用 sigmoid 來兜出 step
function 呢?
42. Background: Expressiveness
● Universality
– creation of step function
= -
1
我們知道 sigmoid 是 S 形狀的嘛,那我可以調整
weight 和 bias 的比例,讓它 S 的轉角很硬很接近
90 度,那使用兩個轉角接近 90 度但 S 往上轉的地
方不同的 neuron ,一個往上轉的時候是在
approximate 區域的開始,另一個是在區域結束,然
後將第一個 neuron 減去第二個 neuron ,就能湊出
step function 。所以精確來其實是說是兩層 neural
network 是 universal approximator ,第一層有很多
兩兩配對的 neuron ,第二層只有一個 neuron 將每
個配對中的第一個 neuron 減去第二個。
43. Background: Expressiveness
● Universality
– A single layer neural net can approximate any
continuous functions if given enough units.
● Then, why bother going deep?
2
好,那接下來要問既然一層 neural network 就是
universal approximator ,那更 deep 的 neural
network 也是 universal approximator 阿,他們對於
能 express 的 function 應該沒有差別,那為何
empirical 比如 image classification 比賽會觀察到使
用比較 deep 的 network 表現比較好呢?
44. Background: Expressiveness
● Universality
– A single layer neural net can approximate any
continuous functions if given enough units.
● Then, why bother going deep?
– Depth Efficiency
2
答案是 depth efficiency
45. Background: Expressiveness
● Universality
– A single layer neural net can approximate any
continuous functions if given enough units.
● Then, why bother going deep?
– Depth Efficiency
● deeper network can represent certain functions more
effectively than shallower ones
2
意思是對某些 function 來說,比起 shallow network ,
用 deep network 來 represent 會更有效率,或者說
可以用更少的 neuron 來 approximate 。
47. Problem Formulation
● How to study depth efficiency?
3
舉個可以展現 depth efficiency 的情況,圖 b 你可以看
到 input 是二維的有四個一模一樣的菱形,假如我現
在要學的事情是對稱,第一層學到欸四個菱形是對
稱的,那我用兩個 neuron 一個做水平對折另一個做
垂直對折,就能將 4 個菱形重合成一個菱形,而第
二層假如學到欸菱形的四個邊也是對稱的,又可以
用兩個 neuron 做一樣的事情,將 4 個邊重合在一
起。所以用兩層只需要 4 個 neuron 就能將 4 個菱形
共 16 條邊重合,但如果用一層可能會需要用 15 個
neuron 才能做到一樣的事情,因為要個別將另外 15
條邊疊在右上角的邊上。
48. Problem Formulation
● How to study depth efficiency?
classification is like folding inputs
to make similar examples close3
那你能不能量化 expressive 能力呢?我們先想每一層
neural network 其實就是將 input map 成 output ,
那怎麼樣算是好的 mapping 呢?概念應該會有點像
LDA ,類似的 input map 後要越近越好,而不同
class 的 inpu map 後要越遠越好。換句話說, input
對 neural network 其實是被分成一塊一塊
的, output 也被分成一塊一塊的,而 classification
就是在找哪幾塊 input 該 map 到同一塊 output 。
49. Problem Formulation
● How to study depth efficiency?
=> count the number of separable regions of input
3
所以假如可以 estimate 一個 neural network 到底將最
底下的 input 分成了幾塊區域,我們就可以量化的它
的 expressive 能力。
50. Problem Formulation
● How to study depth efficiency?
with same #neuron,
can deeper net express more separable regions?3
因此,這篇要解的問題正式定義成,在給定相同數量
的 neuron , deep network 是不是能夠將 input 分
的比 shallow network 還要多塊呢?
51. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
4
要回答這問題,組合數學有個很相關的經典問題,在
說:使用 m 個 hyperplane 最多可以將 n 維空間分成
幾個區域? 1975 一個俄羅斯數學家
George.Zaslavsky 給出答案是 summation of C m
取 i 從 i=1 加到 i=n 。
52. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
4
為了給 intuition ,在這邊以 2 維空間, n=2 為例,你
們也可以在紙上畫畫看,使用 m 條線,怎麼算最多
可以分出幾個區域呢?
53. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
all regions = lower-bounded + not-lower-bounded
4
想法是每一個區域,你都可以用 bound 來描述,有
bound 或沒有 bound 。所以我可以按照順序一維一
維數。比如說我可以先用第二維,以有沒有 lower-
bound 為條件將所有區域分成有 lower-bound 的區
域和沒有 lower bound 的區域。為了考慮 general 的
情況,我可以調整直線斜率,避免有直線是水平線
的情況。
54. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
all regions = lower-bounded + not-lower-bounded
4
先來數有 lower-bound 的區域,什麼情況下能保證一
定會有 lower-bound ?就是兩條線相交時,會產生
四個區域嘛,這四個區域中很肯定一定會有一個有
lower-bound 。那 m 條線最多可以有 C m 取 2 個交
點,所以有 lower-bound 的區域最多就是 C m 取 2
個。
55. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
all regions = lower-bounded + not-lower-bounded
not-lower-bounded = left-bounded + not-left-bounded
4
接下來要數沒有 lower-bound 的區域,我想用第一維
有沒有 left-bound 來數。同樣我假設沒有任何一條
線是垂直線,但這麼一來所有還沒數的區域全部都
沒有 left-bound ,沒辦法數。那一種解決方法是多
加一條水平線,由於還沒數的都沒有 lower-
bound ,所以一定可以找到一條水平線跟所有剩下
的區域相交。因此,我將每個區域加上這條水平線
後分成有 left-bound 和沒有 left-bound 。那因為沒
有一條線是水平線,跟水平線相交後原本右邊沒有
lower-bound 的區域一定會有 left-bound 。那有 m
條線,就有 C m 取 1 個有 left-bound 的區域。
56. Related Work
● Zaslavsky(1975) – hyperplanes in
can separate at most distinct regions
all regions = lower-bounded + not-lower-bounded
not-lower-bounded = left-bounded + not-left-bounded
4
再來數沒有 left-bound 的區域,只有一個,就是對所
有 m 條線都是左邊的區域。你可以用歸納法證明,
假如有個區域對任意一條線是在右邊的,一定已經
數過了。
57. Main Idea
● 1 layer – neurons can separate input in
into at most distinct regions
each neuron separates input into 2 parts
5
再來連結到 neural network ,其實每個 neuron 做的事
情就是在找 decision boundary ,將 n 維 input 切成
兩半,其中一半 activate 另一半 non-activate 。假
如 activation 是 linear 就是在用 hyperplane 在切空
間,而 non-linear 又比 linear 更複雜,所以 m 個
neuron 你可以說它至少可以將 input 切成
summation of C m 取 i 個區域。
58. Main Idea
● 1 layer – neurons can separate input in
into at most distinct regions
● #separate regions(in input space) by region R
R
R’ R’
R’
5
那這是一層,有很多層怎麼算?
別忘了每一層 neuron 做的事情除了將 input 切很多塊
以外,最重要的是找出 input 和 output 的
mapping 。所以要計算整個 neural network 可以將
input 切成幾塊,你可以從最後一層開始遞迴的計
算。定義 N 上標 l 下標 R 表示有幾個最底下的 input
區塊會 map 到第 l 層的 R 的區塊上。因為每一層會
被前一層 map ,所以有幾個 input 區塊 map 到 R 可
以由前一層那些 map 到 R 的區域 R’ 算出來,所以
繼續展開到第一層就能知道 input 總共被分成了幾
塊。
60. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
6
先講結果,給定一層 n 維 input , m 個 output 的
layer ,最多可以將 m/n 的 n 次方個 input 區域 map
到同一個 output 區域。
61. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
the ith group Gi deals with ith dimension of input
By divide neurons into n groups
...
G1
...
Gn
. ..
1.9 "
neurons
6
那構造的核心想法是保留 input 的維度。因為想保留
input 維度所以這篇有個唯一的假設是每層的 neuron
數不會比 n 小。那怎麼樣能保留 input 維度呢?我可
以將 neuron 分成 n 個 group ,再讓每個 group 分別
處理 input 其中一維,就能將 input 維度 n 保留到下
一層。所以剩下的就是在每個 group 中盡可能製造
出有相同 output 的區域。
62. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
...h1 h2 hp
Gi
2.35 "
6
i
來看其中一個第 i 個 group ,要讓它只處理 input 第 i
維的話,你可以想像每個 neuron 都會用到一個第 i
個位置是 1 其他都是 0 的 one-hot vector 來挑出第 i
維。
63. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
...h1 h2 hp
Gi
2.35 "
6
接下來,要怎麼製造相同的 output 呢?你可以這樣
assign weight ,第一個 neuron 長這樣, w 就是
one-hot vector 和 x 做內積再跟 0 比較取 max ,而
第二個 neuron 是 2wx-1 和 0 取 max ,第 p 個是
2wx-(p-1) 和 0 取 max 。
64. Method: Deep Rectifier Network
● Consider a layer , where
● We can make regions with same output
...h1 h2 hp
Gi
2.35 "
6
最後再將每個 neuron 乘上 1 或 -1 加起來,加總後效
果是
67. Method: Deep Rectifier Network
● regions with output value in
● n groups giving separate regions
8
總共 n 維都能製造出介於 0 到 1 之間的區域,都是互
相獨立的所以總共有 m/n 的 n 次方的區域。
68. Method: Deep Rectifier Network
● regions with output value in
● n groups giving separate regions
● L layers separate regions
last layer
8
那剛剛只有一層,假如我有 L 層可以用前面提過的
recursive 方法從最後一層開始算,最後一層有 n 下
標 L 個 neuron , input dimension 是 n0 ,所以最後
一層我可以切割出 summantion of C n 下標 L 取 j 種
個區域。而每一個區域又可以被前一層 L-1 的
neuron 數 /n0 的 n0 次方個區塊 map 到,共有 L-1
層連乘起來的式子長這樣。
69. Method: Deep Rectifier Network
● regions with output value in
● n groups giving separate regions
L layers each with n neurons 1 layer with nL neurons
● L layers separate regions
last layer
8
最後是我們的重點來比較 neuron 數相同的 deep
network ,假如有 L 層每層 n 個和 shallow network
只有一層有 nL 個 neuron ,用這個方法最多能分出
幾個區域。套公式算出來像這樣。
70. Method: Deep Rectifier Network
● regions with output value in
● n groups giving separate regions
L layers each with n neurons 1 layer with nL neurons
● L layers separate regions
last layer
8
把 deep 的裡面展開,再將相同的 n 的 n0 次方消掉。
deep 的 input 區域數是 n/n0 的 L-1 的 n0 次
方, shallow 的是 L 的 n0 次方。
71. Method: Deep Rectifier Network
L layers each with n neurons 1 layer with nL neurons
with same #neurons, deeper network can
separate inputs into exponentially more regions
9
所以你可以清楚看到 L 層和 1 層差了 L 次方倍。所以
給定同樣數量的 neuron , deep 的 expressive 能力
用 input 區域數量化的話,可以得知 deep 的
network 會是 shallow network 的 exponential 倍。
72. Conclusion
● Excellent work, though only applicable to
piecewise-linear activations
10
雖然這篇沒有實驗,但分析地很棒,是很好的 work 。