Skip to Content
深度學習|內行人的做法
book

深度學習|內行人的做法

by Josh Patterson, Adam Gibson
January 2019
Beginner to intermediate
576 pages
14h 31m
Chinese
GoTop Information, Inc.
Content preview from 深度學習|內行人的做法
298
|
第六章:深度網路的調整
考慮到
最佳化效率
時,必須說明一下,我們不可能完全不管其他超參數(如學習速率)
而獨立決定小批量數量應該是多少
比較大的小批量數量也就表示比較平滑的梯度
(即更精確、更具有一致性的梯度值),只要結合適當的調整,就可以針對給定數量的
參數更新,進行更快的學習。當然,需要權衡取捨的是,如此一來每個參數更新,也就
需要花費更長的時間來進行計算。使用比較大的小批量數量,可能也有助於我們的網
路,能夠在一些比較困難的情況下(例如有很多雜訊或遇到各類別數量不均衡的資料
集)進行學習。
那麼,究竟應該怎麼選擇適當的小批量數量呢?實務上來說,如果是用 CPU 進行訓
練,通常就是從 32 256 之間;如果是用 GPU 進行訓練,通常就是從 32 1024
間。在一般的情況下,這個範圍內的某個數字對於比較小的網路來說已經足夠了;如果
遇到比較大的網路,或許應該再多測試一下(否則訓練時間有可能會過長)。
不過,記憶體要求有可能會對大型網路小批量數量的最大值形成一種限制。
對於分散式訓練來說,在共用硬體上針對每個執行程序(executor)使用
比較小的小批量數量(例如在每台機器上使用多個執行程序進行 Spark
練),這種做法並不罕見。
最後不要忘記的是,如果增加小批量數量,每個階段的參數更新次數就會減少(別忘了
一個階段指的就是訓練組資料全都被使用過一次)。每個階段的參數更新次數,正好就
是訓練組資料的樣本總數除以小批量數量的結果。
小批量數量與階段的關係
如果把小批量數量增為兩倍,我們就必須把階段的數量增為兩倍,才能保 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

高效能網站建置指南

高效能網站建置指南

Steve Souders
初探深度學習|使用TensorFlow

初探深度學習|使用TensorFlow

Reza Zadeh, Bharath Ramsundar
深度学习实战

深度学习实战

Douwe Osinga

Publisher Resources

ISBN: 9789865020262