Skip to Content
精通機器學習
book

精通機器學習

by Aurélien Géron
April 2020
Intermediate to advanced
816 pages
18h 32m
Chinese
GoTop Information, Inc.
Content preview from 精通機器學習
用正則化來避免過擬
|
359
其次
作者介紹了一種稱為
MC Dropout
的強大技術
它可以提升任何訓練後的
dropout
模型的效果
且完全不需要重新訓練它
甚至修改它
為模型的不確定性提供
更好的衡量標準
也令人驚訝地容易實作
如果你覺得上面的說法看起來像
怪招
one weird trick)」
廣告
看一下接下來的程式
它是完整的
MC Dropout
實作
可改善我們之前訓練好的
dropout
模型
且不需要再次
訓練它
y_probas = np.stack([model(X_test_scaled, training=True)
for
sample
in
range(100)])
y_proba = y_probas.mean(axis=0)
我們只對測試組進行
100
次預測
設定
training=True
來確保
Dropout
層是活躍的
因為
dropout
是活躍的
所有的預測都會不同
之前談過
predict()
會回傳一個矩陣
在裡
面每一個實例有一列
每個類別有一行
因為測試組有
10,000
個實例
以及
10
個類別
這個矩陣的外形是
[10000, 10]
我們把
100
個這種矩陣疊在一起
所以
y_probas
是個外
形為
[100, 10000, 10]
的陣列
計算第一維
axis=0
的平均值可以得到
y_proba
它是
外形為
[10000, 10]
的陣列
就像我們進行一次預測之後得到的東西
全部就這樣
啟動
dropout
並計算多個預測結果的平均值可以得到一個
Monte Carlo ...
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

面向数据科学家的实用统计学

面向数据科学家的实用统计学

Peter Bruce, Andrew Bruce
C语言核心技术(原书第2版)

C语言核心技术(原书第2版)

Peter Prinz, Tony Crawford
高效能PYTHON程式設計

高效能PYTHON程式設計

Micha Gorelick, Ian Ozsvald
下一代空间计算:AR与VR创新理论与实践

下一代空间计算:AR与VR创新理论与实践

Erin Pangilinan, Steve Lukas, Vasanth Mohan

Publisher Resources

ISBN: 9789865024345