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 精通機器學習
Kernel PCA
|
221
它很適合用來處理大型的訓練組
以及線上執行
PCA
也就是在新實例到達時立刻
處理
)。
下面的程式將
MNIST
資料組拆成
100
個小批次
使用
NumPy
array_split()
函式
),
將它們送給
Scikit-Learn
IncrementalPCA
類別
https://homl.info/32
5
來將
MNIST
料組的維數降成
154
跟之前一樣
)。
注意
你必須用各個小批次來呼叫
partial_fit()
方法
而不是用整個訓練組來呼叫
fit()
方法
from sklearn.decomposition import
IncrementalPCA
n_batches = 100
inc_pca = IncrementalPCA(n_components=154)
for
X_batch
in
np.array_split(X_train, n_batches):
inc_pca.partial_fit(X_batch)
X_reduced = inc_pca.transform(X_train)
你也可以使用
NumPy
memmap
類別來處理二進制檔案或磁碟內的大型陣列
就像它們完
全在記憶體一樣
這個類別只會將它需要的資料載入記憶體
因為
IncrementalPCA
類別
在任何時間都只使用小部分的陣列
記憶體的使用量在控制之下
所以你可以呼叫一般的
fit()
方法
就像這樣
X_mm = np.memmap(filename, dtype="float32", ...
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

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

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

Erin Pangilinan, Steve Lukas, Vasanth Mohan
C语言核心技术(原书第2版)

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

Peter Prinz, Tony Crawford

Publisher Resources

ISBN: 9789865024345