Hands – On Machine Learning With Scikit – Learn Keras And TensorFlow 3rd Edition – Aurelien Geron

📥
Total Downloads: 7
 - Unknown book cover

Similarly, specifying optimizer=”sgd” is equivalent to specifying optimizer=tf.keras.optimizers.SGD(), and metrics=[“accuracy”] is equivalent to metrics= [tf.keras.metrics.sparse_categorical_accuracy] (when using this loss). We will use many other losses, optimizers, and metrics in this book; for the full lists, see https://keras.io/api/losses/, https://keras.io/api/optimizers/, and https://keras.io/api/metrics/. This code requires some explanation. First, we use the “sparse_categorical_crossentropy” loss because we have sparse labels (i.e., for each instance, there is just a target class index, from 0 to 9 in this case), and the classes are exclusive.

If instead we had one target probability per class for each instance (such as one-hot vectors, e.g. [0., 0., 0., 1., 0., 0., 0., 0., 0., 0.] to represent class 3), then we would need to use the “categorical_crossentropy” loss instead. If we were doing binary classification or multilabel binary classification, then we would use the “sigmoid” activation function in the output layer instead of the “softmax” activation function, and we would use the “binary_crossentropy” loss. If you want to convert sparse labels (i.e., class indices) to one-hot vector labels, use the tf.keras.utils.to_categorical() function.

To go the other way round, use the np.argmax() function with axis=1. Regarding the optimizer, “sgd” means that we will train the model using Stochastic Gradient Descent. In other words, Keras will perform the backpropagation algorithm described earlier (i.e., reverse-mode autodiff plus Gradient Descent). We will discuss more efficient optimizers in Chapter 11. They improve Gradient Descent, not autodiff. When using the SGD optimizer, it is important to tune the learning rate. So, you will generally want to use optimizer=tf.keras.optimizers.SGD(learning_rate=???) to set the learning rate, rather than optimizer=”sgd”, which defaults to a learning rate of 0.01.

Finally, since this is a classifier, it’s useful to measure its accuracy during training and evaluation, which is why we set metrics=[“accuracy”]. Training and evaluating the model Now the model is ready to be trained. For this we simply need to call its fit() method: >>> history = model.fit(X_train, y_train, epochs=30, … validation_data=(X_valid, y_valid)) …

With Early Release ebooks, you get books in their earliest form—the author’s raw and unedited content as they write—so you can take advantage of these technologies long before the official release of these titles. Aurélien Géron OceanofPDF.com Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow by Aurélien Géron Copyright © 2022 Aurélien Géron. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.

O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or [email protected]. Acquisitions Editor: Nicole Butterfield Development Editor: Michele Cronin Production Editor: Beth Kelly Copyeditor: Kim Cofer Proofreader: Indexer: Interior Designer: David Futato Cover Designer: Karen Montgomery Illustrator: Kate Dullea October 2022: Third Edition Revision History for the Early Release 2022-02-08: First Release 2022-03-14: Second Release 2022-04-18: Third Release 2022-06-010: Fourth Release See http://oreilly.com/catalog/errata.csp?isbn=9781098125974 for release details.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Hands- On Machine Learning with Scikit-Learn, Keras, and TensorFlow, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. The views expressed in this work are those of the author, and do not represent the publisher’s views. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work.

Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-098-12597-4 [LSI] OceanofPDF.com Preface The Machine Learning Tsunami In 2006, Geoffrey Hinton et al.

published a paper⁠ showing how to train a deep neural network capable of recognizing handwritten digits with state- of-the-art precision (>98%). They branded this technique “Deep Learning.” A deep neural network is a (very) simplified model of our cerebral cortex, composed of a stack of layers of artificial neurons. Training a deep neural net was widely considered impossible at the time,⁠ and most researchers had abandoned the idea in the late 1990s. This paper revived the interest of the scientific community, and before long many new papers demonstrated that Deep Learning was not only possible, but capable of mind-blowing achievements that no other Machine Learning (ML) technique could hope to match (with the help of tremendous computing power and great amounts of data).

This is a short excerpt from the opening of “” by Unknown, quoted for review and introduction purposes. All rights belong to the copyright holders.

Book Information

  • Unique ID: 16f36bec2080e1f8
  • File Extension: .pdf
  • File Size: 88,144,516 bytes (84.061 MB)
  • Title:
  • Author: Unknown
  • ISBN: 9781098125974
  • Pages: 1215
  • Language: English (en)

Reading & Word Statistics

  • Estimated Reading Time: 1289.68 minutes
  • Total Words: 257,936
  • Total Characters: 1,639,116
  • Average Words per Page: 212.29
  • Average Characters per Page: 1349.07

Most Frequent Words

model (2013), training (1257), layer (1048), use (979), data (973), set (932), using (896), keras (888), layers (868), function (858), learning (811), train (802), one (743), figure (719), example (697), see (615), dataset (584), time (563), also (557), output (539), first (522), input (496), let’s (491), get (487), chapter (456), number (450), need (445), class (433), batch (421), called (417), want (403), now (402), like (395), size (384), two (379), make (376), images (375), random (373), much (372), algorithm (366), neural (360), inputs (360), step (358), test (356), image (355), new (353), instances (353), models (352), loss (348), activation (346), shape (344), features (340), value (336), used (335), many (333), feature (333), values (324), method (324), well (311), since (304), code (303), network (303), array (302), dense (300), tensorflow (297), state (288), equation (288), fit (287), mean (285), outputs (281), machine (279), next (278), look (276), instead (273), different (273), tensor (270), predictions (267), create (264), instance (259), large (252), gradient (252), right (252), good (251), rate (251), weights (251), true (248), possible (244), linear (241), name (240), regression (239), it’s (239), deep (237), import (234), add (232), even (230), note (228), predict (218), way (216), dtype (213), better (212).

PDF Download

📖 Read Online (3D Flipbook)

You can start reading by flipping the pages.

Or download it as a PDF: