Skip to Content
Python: Real World Machine Learning
book

Python: Real World Machine Learning

by Prateek Joshi, John Hearty, Bastiaan Sjardin, Luca Massaron, Alberto Boschetti
November 2016
Beginner to intermediate
941 pages
21h 55m
English
Packt Publishing
Content preview from Python: Real World Machine Learning

PCA with H2O

We can also use the PCA implementation provided by H2O. (We've already seen H2O in the previous chapter and mentioned it along the book.)

With H2O, we first need to turn on the server with the init method. Then, we dump the dataset on a file (precisely, a CSV file) and finally run the PCA analysis. As the last step, we shut down the server.

We're trying this implementation on some of the biggest datasets seen so far—the one with 100K observations and 100 features and the one with 10K observations and 2,500 features:

In: import h2o from h2o.transforms.decomposition import H2OPCA h2o.init(max_mem_size_GB=4) def testH2O_pca(nrows, ncols, k=20): temp_file = tempfile.NamedTemporaryFile().name X, _ = make_blobs(nrows, n_features=ncols, random_state=101) ...
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.
Start your free trial

You might also like

Interpretable Machine Learning with Python

Interpretable Machine Learning with Python

Serg Masís
Large Scale Machine Learning with Python

Large Scale Machine Learning with Python

Luca Massaron, Alberto Boschetti, Bastiaan Sjardin

Publisher Resources

ISBN: 9781787123212Supplemental ContentPurchase Link