Conventions used
There are a number of text conventions used throughout this book.
Code in text
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “The CountVectorizer
class takes the token pattern argument as the input [a-zA-Z]+
, which identifies words with lowercase or uppercase letters.”
A block of code is set as follows:
import numpy as np from sklearn.model_selection import train_test_split # Create the train and test sets. X_train, X_test, y_train, y_test = train_test_split(data['tweet'], data['class'], test_size=0.1, stratify=data['class'], random_state=123)
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
Epoch 7/15 628/628 [==============================] - 753s 1s/step - loss: 0.2343 - accuracy: 0.9388 - val_loss: 0.3681 - val_accuracy: 0.8991
Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “For example, muscles can be transformed into mussels with a minimum of 3 substitutions.”
Tips or important notes
Appear like this.