Errata

AI and Machine Learning for Coders

Errata for AI and Machine Learning for Coders

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
PDF
Page Ch. 3
transfer learning cats and dogs code

# Flatten the output layer to 1 dimension

x = layers.Flatten()(last_output)


NameError: name 'layers' is not defined

Note from the Author or Editor:
Please change the code on page 56.

Presently the first line reads:
from tensorflow.keras.applications.inception_v3 import InceptionV3

Please edit this to:
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras import layers
from tensorflow.keras import Model
from tensorflow.keras.applications.inception_v3 import InceptionV3
from tensorflow.keras.optimizers import RMSprop

Tony Holdroyd  Nov 16, 2020  May 28, 2021
Page Building a CNN to Distinguish Between Horses and Humans
P44 code, P51 first code

Imagedatagenerator is decaprated.
On P51, image.load_img raises an error.

Note from the Author or Editor:
Change the part of the URL that reads laurencemoroney.blog.appspot.com to learning-datasets and it will work

Anonymous  Feb 04, 2023  Feb 16, 2024
PDF
Page ch 3
Code block before Figure 3-8

The code block mentions an outdated link:
storage.googleapis.com/laurencemoroney-blog.appspot.com/horse-or-human.zip

New link: https : / / storage.googleapis.com/learning-datasets/horse-or-human.zip

O'Reilly Media
 
Feb 05, 2024  Feb 16, 2024
Page 3.8 - The Keras ImageDataGenerator
Here’s the code to get the training data and extract it into the appropriately named subdirectories, as shown in Figure 3-8:


this url is not working. i am getting "urllib.error.HTTPError: HTTP Error 404: Not Found" error while running the code

Note from the Author or Editor:
Change the part of the URL that reads laurencemoroney.blog.appspot.com to learning-datasets and it will work

Manas Mishra  Mar 12, 2023  Feb 16, 2024
Printed
Page 7
Figure 1-11

On the right of the diagram, first item "TensorFlow Lite" might change to "Standard TensorFlow" or "TensorFlow Serving".

Note from the Author or Editor:
Change to TensorFlow

Chun-Yu Chen  Aug 09, 2021  Feb 16, 2024
Printed
Page 31
In example code

There is an extra unnecessary tab after tf.keras.layers.Dense(10, activation=tf.nn.softmax).

Additionally, tf.keras.datasets.fashion_mnist is assigned to variable mnist, when it was previously assigned to variable data on page 26 and is again later on page 37.

Note from the Author or Editor:
For the tab, please edit the line on page 31 that reads

"tf.keras.layers.Dense(10, activation=tf.nn.softmax)"

It should be de-dented so that it vertically lines up with the line above it.

The other issue, with variable naming is ok as-is.

Matthieu J. Miossec  Jan 18, 2021  May 28, 2021
Printed
Page 44
1st paragragh

This paragraph is an exact copy of the last paragraph on page 43, including the code.

Note from the Author or Editor:
The sentence beginning with "Here's the code..", and the code at the bottom of page 43 should be deleted.

The sentence beginning with "Here's the code.." on page 44 should be edited so that the end of the sentence, instead of reading "as shown in the figure" should be "as shown in Figure 3-8."

Anonymous  Apr 17, 2021  May 28, 2021
Printed
Page 44
after figure

The text and code, starting with:
Here's the code to get the training, is identical to what is written on the previous page.

Note from the Author or Editor:
Correct, we will remove the duplicate!

Peter Larkin  Nov 11, 2021  Feb 16, 2024
Printed
Page 47
code, top of the page

Perhaps writing out tf.keras.optimizers.RMSprop(lr=0.001) in the code would be helpful to complete beginners.

Note from the Author or Editor:
Can we please make a tip section:

"The code on this page, and in many places in this book may require you to import python libraries. To find the correct imports, you can check out the repo at https://github.com/lmoroney/tfbook."

Matthieu J. Miossec  Jan 19, 2021  May 28, 2021
PDF
Page 114
3rd paragraph

"You can see the result on the accuracy in Figure 6-9." is might be "in Figure 6-10".

Note from the Author or Editor:
Change to 6-10 as suggested

Anonymous  Aug 05, 2021  Feb 16, 2024
PDF
Page 114
3rd paragraph

"This isn’t much different from the results in Figure 6-6," is should be "in Figure 6-8".

Note from the Author or Editor:
Change to 6-8 as suggested

Anonymous  Aug 05, 2021  Feb 16, 2024
Printed
Page 119
first paragraph after figure

Text "Reducing it to 85 would still keep 26,000 of the sentences ..without any padding at all".

Would have thought padding is still there it's just been reduced?

Note from the Author or Editor:
change text to "with greatly reduced padding"

Peter Larkin  Nov 11, 2021  Feb 16, 2024
PDF
Page 139
the wget command example at the bottom of the page.

accessing storage.googleapis.com/laurencemoroney-blog.appspot.com/glove.twitter.27B.25d.zip end with "NoSuchKeyThe specified key does not exist.No such object: laurencemoroney-blog.appspot.com/glove.twitter.27B.25d.zip".

We don't have the way to get glove.twitter.27B.25d.zip.

Note from the Author or Editor:
This file name should just be glove.zip

Anonymous  Sep 04, 2021  Feb 16, 2024
PDF
Page 258
Second paragraph of "Moving Beyond “Hello World”—Processing Images" section.

"The full app code is available in the GitHub repo for this book."
Despite being written as such, the entire Chapter 14 code does not exist in the repo.

Note from the Author or Editor:
no book change required, author will try to figure out why it's missing from GitHub.

Anonymous  Mar 11, 2022  Feb 16, 2024
Page 352
Figure 20-13. Buddy devices

In the figure, the purple down triangle of the second device must be up. Similarly, the blue up triangle should be down.

The following paragraph, "the dark triangles," is supposed to refer to purple triangles, but no up purple triangle appear in the diagram.

Also, in Figure 20-14, there are up and down purple triangles on the right side , but no up purple triangles appear in the devices on the left.

Note from the Author or Editor:
20-13 should have the darker blue triangle on the rightmost phone turned upside down.

20-14 should have the purple triangle on the middle phone and the arrow on its right both pointing up, and the blue triangle in the middle phone and the arrow on its right both pointing down.

Anonymous  Feb 10, 2022  Feb 16, 2024