Skip to product information
Machine Learning Textbook: PyTorch Edition
Machine Learning Textbook: PyTorch Edition
Description
Book Introduction
Meet Amazon's best-selling books in PyTorch version!
A practical guide to machine learning/deep learning with solid theory and diverse examples.

The Amazon bestseller "Machine Learning Textbook" has been reborn with a PyTorch edition! This book provides a balanced explanation of theory and code, covering the concepts necessary to truly understand machine learning and deep learning, how core algorithms work and how to use them, the underlying mathematics, practical examples, and how to avoid common pitfalls.
Additionally, machine learning is explained using Python-based core libraries (SciPy, NumPy, scikit-learn, Matplotlib, Pandas), and deep learning is explained using PyTorch.
In addition to the core concepts of PyTorch, it also covers the latest trends such as transformers, PyTorch Lightning, XGBoost, and graph neural networks in addition to the contents covered in the 3rd edition of the Machine Learning Textbook. It is based on the latest versions of both scikit-learn and PyTorch.
Recommended for those who want to build a solid foundation in machine learning and deep learning.
  • You can preview some of the book's contents.
    Preview

index
Chapter 1.
Computers learn from data


1.1 Building an intelligent system that turns data into knowledge
1.2 Three Types of Machine Learning
__1.2.1 Predicting the Future with Supervised Learning
__1.2.2 Solving Reactive Problems with Reinforcement Learning
__1.2.3 Discovering Hidden Structure with Unsupervised Learning
1.3 Introduction to basic terminology and notation
__1.3.1 Notation and conventions used in this book
__1.3.2 Machine Learning Terminology
1.4 Machine Learning System Building Roadmap
__1.4.1 Preprocessing: Shaping the Data
__1.4.2 Training and selecting a predictive model
__1.4.3 Evaluate the model and predict with unseen samples
1.5 Python for Machine Learning
__1.5.1 Installing packages with Python and PIP
__1.5.2 Using the Anaconda Python distribution and package manager
__1.5.3 Packages for scientific computing, data science, and machine learning
1.6 Summary

Chapter 2.
Training a simple classification algorithm


2.1 Artificial Neurons: A Brief History of Early Machine Learning
__2.1.1 Mathematical Definition of Artificial Neurons
__2.1.2 Perceptron learning rules
2.2 Implementing the Perceptron Learning Algorithm in Python
__2.2.1 Object-Oriented Perceptron API
__2.2.2 Training a perceptron on the iris dataset
2.3 Adaptive linear neurons and learning convergence
__2.3.1 Minimizing the loss function using gradient descent
__2.3.2 Implementing Adalin in Python
__2.3.3 Improving Gradient Descent Results by Adjusting Feature Scales
__2.3.4 Large-Scale Machine Learning and Stochastic Gradient Descent
2.4 Summary

Chapter 3.
A Tour of Machine Learning Classification Models with Scikit-Learn


3.1 Choosing a Classification Algorithm
3.2 First Steps with Scikit-Learn: Training a Perceptron
3.3 Class Probability Modeling Using Logistic Regression
__3.3.1 Understanding Logistic Regression and Conditional Probability
__3.3.2 Learning weights for the logistic loss function
__3.3.3 Change the Adalin implementation to a logistic regression algorithm
__3.3.4 Training a Logistic Regression Model Using Scikit-Learn
__3.3.5 Avoiding Overfitting Using Regularization
3.4 Maximum Margin Classification Using Support Vector Machines
__3.4.1 Maximum Margin
__3.4.2 Tackling Nonlinear Classification Problems Using Slack Variables
__3.4.3 Other implementations of scikit-learn
3.5 Solving Nonlinear Problems Using Kernel SVMs
__3.5.1 Kernel methods for linearly non-separable data
__3.5.2 Finding a Partitioning Hyperplane in High-Dimensional Space Using Kernel Techniques
3.6 Decision Tree Learning
__3.6.1 Maximizing Information Gains: Maximizing Resource Utilization
__3.6.2 Creating a decision tree
__3.6.3 Connecting Multiple Decision Trees with Random Forests
3.7 k-nearest neighbors: a lazy learning algorithm
3.8 Summary

Chapter 4.
Creating a Good Training Dataset: Data Preprocessing


4.1 Handling Missing Data
__4.1.1 Identifying missing values ​​in tabular data
__4.1.2 Excluding training samples or features with missing values
__4.1.3 Replacing missing values
__4.1.4 Getting familiar with the scikit-learn estimator API
4.2 Handling Categorical Data
__4.2.1 Encoding Categorical Data Using Pandas
__4.2.2 Ordered feature mapping
__4.2.3 Class Label Encoding
__4.2.4 Applying one-hot encoding to unordered features
4.3 Divide the dataset into training and test datasets.
4.4 Matching the trait scale
4.5 Choosing Useful Traits
__4.5.1 L1 regularization and L2 regularization for limiting model complexity
__4.5.2 Geometric interpretation of L2 regularization
__4.5.3 Sparsity using L1 regularization
__4.5.4 Sequential Feature Selection Algorithm
4.6 Using feature importance in random forests
4.7 Summary

Chapter 5.
Data compression using dimensionality reduction


5.1 Unsupervised dimensionality reduction using principal component analysis
__5.1.1 Key steps of principal component analysis
__5.1.2 Principal component extraction step
__5.1.3 Total variance and explained variance
__5.1.4 Attribute Conversion
__5.1.5 Principal Component Analysis in Scikit-Learn
5.2 Supervised data compression using linear discriminant analysis
__5.2.1 Principal Component Analysis vs. Linear Discriminant Analysis
__5.2.2 How Linear Discriminant Analysis Works Internally
__5.2.3 Calculating the Scatter Matrix
__5.2.4 Selecting linear discriminant vectors for new feature subspaces
__5.2.5 Projecting samples into a new feature space
__5.2.6 LDA in scikit-learn
5.3 Nonlinear dimensionality reduction and visualization
__5.3.1 Why consider nonlinear dimensionality reduction?
__5.3.2 Data Visualization Using t-SNE
5.4 Summary

Chapter 6.
Best Practices for Model Evaluation and Hyperparameter Tuning


6.1 Efficient Workflow Using Pipelines
__6.1.1 Wisconsin Breast Cancer Dataset
__6.1.2 Connecting transformers and estimators with pipelines
6.2 Evaluating Model Performance Using k-Fold Cross-Validation
__6.2.1 Holdout Method
__6.2.2 k-fold cross-validation
6.3 Debugging Algorithms Using Learning and Validation Curves
__6.3.1 Analyzing Bias and Variance Problems with Learning Curves
__6.3.2 Investigating overfitting and underfitting with validation curves
6.4 Fine-tuning machine learning models using grid search
__6.4.1 Hyperparameter Tuning Using Grid Search
__6.4.2 Exploring Hyperparameter Settings More Broadly with Random Search
__6.4.3 Resource-Efficient Hyperparameter Search Using the SH Method
__6.4.4 Algorithm Selection Using Nested Cross-Validation
6.5 Various performance evaluation indicators
__6.5.1 Error matrix
__6.5.2 Optimizing the precision and recall of classification models
__6.5.3 Drawing the ROC curve
__6.5.4 Performance metrics for multi-classification
__6.5.5 Handling Unbalanced Classes
6.6 Summary

Chapter 7.
Ensemble learning combining different models


7.1 Ensemble Learning
7.2 Classification ensemble using majority voting
__7.2.1 Implementing a Simple Majority Voting Classifier
__7.2.2 Making Predictions Using Majority Voting
__7.2.3 Evaluation and Tuning of Ensemble Classifiers
7.3 Bagging: Classification Ensembles via Bootstrap Sampling
__7.3.1 How the Bagging Algorithm Works
__7.3.2 Classifying Samples of the Wine Dataset Using Bagging
7.4 AdaBoost with Weak Learners
__7.4.1 How Boosting Works
__7.4.2 Using AdaBoost in Scikit-learn
7.5 Gradient Boosting: Loss Gradient-Based Ensemble Training
__7.5.1 Comparison of AdaBoost and Gradient Boosting
__7.5.2 Introduction to the Gradient Boosting Algorithm
__7.5.3 Gradient Boosting Algorithm for Classification
__7.5.4 Gradient Boosting Classification Example
__7.5.5 Using XGBoost
7.6 Summary

Chapter 8.
Applying Machine Learning to Sentiment Analysis


8.1 Preparing IMDb Movie Review Data for Text Processing
__8.1.1 Obtaining a movie review dataset
__8.1.2 Preprocessing the movie review dataset into a simpler form
8.2 Introduction to the BoW Model
__8.2.1 Converting words into feature vectors
__8.2.2 Evaluating word relevance using tf-idf
__8.2.3 Text Data Cleaning
__8.2.4 Splitting a document into tokens
8.3 Training a Logistic Regression Model for Document Classification
8.4 Large-Scale Data Processing: Online Algorithms and External Memory Learning
8.5 Topic Modeling Using Latent Dirichlet Allocation
__8.5.1 Text Document Decomposition Using LDA
__8.5.2 LDA in scikit-learn
8.6 Summary

Chapter 9.
Predicting continuous target variables using regression analysis


9.1 Linear Regression
__9.1.1 Simple linear regression
__9.1.2 Multiple Linear Regression
9.2 Exploring the Ames Housing Dataset
__9.2.1 Reading the Ames Housing Dataset as a DataFrame
__9.2.2 Visualizing Key Features of the Dataset
__9.2.3 Analysis using the correlation matrix
9.3 Implementing a Least Squares Linear Regression Model
__9.3.1 Finding the parameters of a regression model using gradient descent
__9.3.2 Estimating the weights of a regression model with scikit-learn
9.4 Training a Stable Regression Model Using RANSAC
9.5 Performance Evaluation of Linear Regression Models
9.6 Applying regularization to regression
9.7 Converting a linear regression model to polynomial regression
__9.7.1 Adding Polynomial Terms Using Scikit-learn
__9.7.2 Modeling Nonlinear Relationships Using the Ames Housing Dataset
9.8 Handling Nonlinear Relationships Using Random Forests
__9.8.1 Decision Tree Regression
__9.8.2 Random Forest Regression
9.9 Summary

Chapter 10.
Handling Unlabeled Data: Cluster Analysis


10.1 Grouping similar objects using the k-means algorithm
__10.1.1 k-means clustering using scikit-learn
__10.1.2 Smartly assigning initial cluster centroids with k-means++
__10.1.3 Direct vs. Indirect Clustering
__10.1.4 Finding the optimal number of clusters using the elbow method
__10.1.5 Quantifying cluster quality with silhouette graphs
10.2 Organizing clusters into a hierarchical tree
__10.2.1 Clustering Bottom-Up
__10.2.2 Performing hierarchical clustering on a distance matrix
__10.2.3 Connecting a dendrogram to a heatmap
__10.2.4 Applying merge clustering in scikit-learn
10.3 Finding dense areas using DBSCAN
10.4 Summary

Chapter 11.
Implementing a multilayer artificial neural network from scratch


11.1 Modeling Complex Functions with Artificial Neural Networks
__11.1.1 Summary of Single-Layer Neural Networks
__11.1.2 Multilayer neural network structure
__11.1.3 Calculating neural network activation output using forward computation
11.2 Handwritten Number Classification
__11.2.1 Obtaining the MNIST dataset
__11.2.2 Implementation of a multilayer perceptron
__11.2.3 Coding the Neural Network Training Loop
__11.2.4 Performance Evaluation of Neural Network Models
11.3 Training artificial neural networks
__11.3.1 Calculating the loss function
__11.3.2 Understanding the Backpropagation Algorithm
__11.3.3 Training a Neural Network with the Backpropagation Algorithm
11.4 Convergence of Neural Networks
11.5 Some Notes on Neural Network Implementation
11.6 Summary

Chapter 12.
Training Neural Networks with PyTorch


12.1 PyTorch and Training Performance
__12.1.1 Performance Issues
__12.1.2 What is PyTorch?
__12.1.3 How to learn PyTorch
12.2 Getting Started with PyTorch
__12.2.1 Installing PyTorch
__12.2.2 Creating Tensors in PyTorch
__12.2.3 Manipulating Tensor Data Types and Sizes
__12.2.4 Applying Mathematical Operations to Tensors
__12.2.5 chunk( ), stack( ), cat( ) functions
12.3 Building a PyTorch Input Pipeline
__12.3.1 Creating a PyTorch DataLoader from a Tensor
__12.3.2 Concatenating two tensors into one dataset
__12.3.3 Shuffle, batch, and repeat
__12.3.4 Creating a dataset from a file on the local disk
__12.3.5 Loading datasets from the torchvision.datasets library
12.4 Building a Neural Network Model with PyTorch
__12.4.1 PyTorch Neural Network Module (torch.nn)
__12.4.2 Creating a Linear Regression Model
__12.4.3 Training a Model with the torch.nn and torch.optim Modules
__12.4.4 Building a multilayer perceptron to classify the iris dataset
__12.4.5 Evaluating the Model on the Test Dataset
__12.4.6 Saving and Loading Trained Models
12.5 Choosing an Activation Function for a Multilayer Neural Network
__12.5.1 Summary of Logistic Functions
__12.5.2 Multi-class probability prediction using the softmax function
__12.5.3 Widening the Output Range with Hyperbolic Tangents
__12.5.4 Relu Activation Function
12.6 Summary

Chapter 13.
Learn more about PyTorch architecture


13.1 Key Features of PyTorch
13.2 PyTorch Computational Graphs
__13.2.1 Understanding Computational Graphs
__13.2.2 Creating graphs with PyTorch
13.3 PyTorch Tensor Objects for Saving and Updating Model Parameters
13.4 Computing gradients using automatic differentiation
__13.4.1 Computing the gradient of the loss with respect to the trainable variables
__13.4.2 Understanding Automatic Differentiation
__13.4.3 Hostile Sample
13.5 Implementing Common Architectures Using the torch.nn Module
__13.5.1 Implementing a model based on nn.Sequential
__13.5.2 Choosing a Loss Function
__13.5.3 Solving the XOR classification problem
__13.5.4 Building Flexible Models with nn.Modules
__13.5.5 Creating Custom Layers in PyTorch
13.6 Project 1: Predicting Automobile Fuel Economy
__13.6.1 Using Attribute Columns
__13.6.2 Training a DNN Regression Model
13.7 Project 2: Classifying Handwritten Digits from MNIST
13.8 High-Level PyTorch API: Introducing PyTorch Lightning
__13.8.1 Preparing the PyTorch Lightning Model
__13.8.2 Preparing the Data Loader for Lightning
__13.8.3 Training a Model Using the Lightning Trainer Class
__13.8.4 Evaluating Models with TensorBoard
13.9 Summary

Chapter 14.
Image classification with deep convolutional neural networks


14.1 Components of a Convolutional Neural Network
__14.1.1 CNN and Feature Layer Learning
__14.1.2 Performing discrete convolution
__14.1.3 Subsampling
14.2 Building a Deep Convolutional Neural Network Using Basic Building Blocks
__14.2.1 Handling Multiple Inputs or Color Channels
__14.2.2 Regularizing Neural Networks with L2 Regularization and Dropout
__14.2.3 Loss function for classification
14.3 Implementing a Deep Convolutional Neural Network Using PyTorch
__14.3.1 Multilayer CNN structure
__14.3.2 Data loading and preprocessing
__14.3.3 Implementing CNN using the torch.nn module
14.4 Classifying Smiling Faces Using Convolutional Neural Networks
__14.4.1 Loading the CelebA dataset
__14.4.2 Image Conversion and Data Augmentation
__14.4.3 Training a CNN Smiley Face Classifier
14.5 Summary

Chapter 15.
Modeling Sequential Data with Recurrent Neural Networks

15.1 Introduction to Sequential Data
__15.1.1 Sequential Data Modeling: Considering Order
__15.1.2 Sequential data vs. time series data
__15.1.3 Sequence Representation
__15.1.4 Types of Sequence Modeling
15.2 RNNs for Sequence Modeling
__15.2.1 Understanding the RNN Repetitive Structure
__15.2.2 Calculating the activation output of the RNN
__15.2.3 Hidden and Output Loops
__15.2.4 The Difficulty of Learning Long Sequences
__15.2.5 LSTM cell
15.3 Implementing RNNs for Sequence Modeling with PyTorch
__15.3.1 First Project: Sentiment Analysis of IMDb Movie Reviews
__15.3.2 Second Project: Implementing a Character-Level Language Model with TensorFlow
15.4 Summary

Chapter 16.
Transformer: Improving Natural Language Processing Performance with Attention Mechanisms


16.1 RNN with added attention mechanism
__16.1.1 Attention to Help RNNs Retrieve Information
__16.1.2 Original Attention Mechanism for RNNs
__16.1.3 Processing input with a bidirectional RNN
__16.1.4 Generating Output from a Context Vector
__16.1.5 Calculating Attention Weights
16.2 Introducing the Self-Attention Mechanism
__16.2.1 Basic forms of self-attention
__16.2.2 Trainable Self-Attention Mechanism: Scaled Dot Product Attention
16.3 All You Need Is Attention: The Original Transformer Architecture
__16.3.1 Encoding contextual embeddings with multi-head attention
__16.3.2 Language Model Training: Decoder and Masked Multi-Head Attention
__16.3.3 Implementation Details: Positional Encoding and Layer Normalization
16.4 Building Large-Scale Language Models Using Unlabeled Data
__16.4.1 Pretraining and Fine-Tuning the Transformer Model
__16.4.2 Using Unlabeled Data with GPT
__16.4.3 Generating new text using GPT-2
__16.4.4 Bidirectional Pretraining with BERT
__16.4.5 BART combines the strengths of both
16.5 Fine-Tuning a BERT Model in PyTorch
__16.5.1 Loading the IMDb Movie Review Dataset
__16.5.2 Dataset Tokenization 715
__16.5.3 Loading and Fine-Tuning a Pretrained BERT Model
__16.5.4 Easily fine-tune transformers using the trainer API
16.6 Summary

Chapter 17.
Generative Adversarial Networks for New Data Synthesis


17.1 Introduction to Generative Adversarial Networks
__17.1.1 Autoencoder
__17.1.2 Generative Model for New Data Synthesis
__17.1.3 Generating new samples with GAN
__17.1.4 Understanding the generator and discriminator loss functions of GANs
17.2 Implementing a GAN Model from Scratch
__17.2.1 Training a GAN Model in Google Colab
__17.2.2 Implementing generator and discriminator neural networks
__17.2.3 Defining the training dataset
__17.2.4 Training a GAN Model
17.3 Improving Synthetic Image Quality with Convolutional GANs and Wasserstein GANs
__17.3.1 Transpose convolution
__17.3.2 Batch Normalization
__17.3.3 Implementing constructors and discriminators
__17.3.4 Measuring the distance between two distributions
__17.3.5 Using EM Distance in GANs
__17.3.6 Gradient Penalty
__17.3.7 Training a DCGAN Model with WGAN-GP
__17.3.8 Mode Collapse
17.4 Other GAN Applications
17.5 Summary

Chapter 18.
Graph neural networks for dependency detection in graph-structured data


18.1 Introduction to Graph Data
__18.1.1 Undirected graph
__18.1.2 Directed Graph
__18.1.3 Label Graph
__18.1.4 Representing Molecules Graphically
18.2 Understanding Graph Convolution
__18.2.1 Motivation for using graph convolution
__18.2.2 Basic Graph Convolution Implementation
18.3 Implementing GNN from Scratch in PyTorch
__18.3.1 Defining the NodeNetwork Model
__18.3.2 Creating a Graph Convolution Layer in NodeNetwork
__18.3.3 Adding a global pooling layer to handle different graph sizes
__18.3.4 Preparing the Data Loader
__18.3.5 Predicting using a node network
18.4 Implementing GNNs Using the PyTorch Geometric Library
18.5 Other GNN Layers and Recent Developments
__18.5.1 Spectral Graph Convolution
__18.5.2 Pooling
__18.5.3 Normalization
__18.5.4 Other advanced graph neural networks
18.6 Summary

Chapter 19.
Decision-making in complex environments with reinforcement learning

19.1 Learning from experience
__19.1.1 Understanding Reinforcement Learning
__19.1.2 Defining the Agent-Environment Interface for Reinforcement Learning Systems
19.2 Basic Theory of Reinforcement Learning
__19.2.1 Markov Decision Process
__19.2.2 Mathematical formula for Markov decision process
__19.2.3 Reinforcement Learning Terminology: Payoff, Policy, and Value Function
__19.2.4 Dynamic programming using Bellman equation
19.3 Reinforcement Learning Algorithms
__19.3.1 Dynamic Programming
__19.3.2 Reinforcement Learning Using Monte Carlo
__19.3.3 Time difference learning
19.4 Implementing Your First Reinforcement Learning Algorithm
__19.4.1 Introducing the OpenAI Gym Toolkit
__19.4.2 Solving Grid World Problems with Q-Learning
19.5 Deep Q-Learning
__19.5.1 Training the DQN model using the Q-learning algorithm
__19.5.2 Implementing a Deep Q-Learning Algorithm
19.6 Overall Summary

Detailed image
Detailed Image 1

Into the book
Whether you're aspiring to become a machine learning engineer with exceptional problem-solving skills or considering gaining experience in machine learning research, this book will help.
Beginners may be overwhelmed by the theoretical background of machine learning.
Recently published tutorials will teach you how to implement high-performance learning algorithms.
Working with practical code examples and machine learning application examples is a great way to get started.
Putting what you've learned into practice with concrete examples helps you understand broader concepts.
But remember, with all that good comes responsibility! This book will help you practice machine learning using the Python programming language and Python-based machine learning libraries.
In addition, we introduce the mathematical theory of machine learning algorithms.
This is an essential part of successfully using machine learning.
Therefore, unlike other practical books, the book explains essential machine learning theory.
It also provides an easy-to-understand explanation of how machine learning algorithms work, how to use them, and how to avoid common mistakes.
This book covers the core topics and concepts you need to get started in this field.
If you're interested in learning more, you can follow the important innovations in this field by referencing the materials presented in this book.
--- From the Author's Note

Publisher's Review
With clear explanations, mathematics and practical examples
I completely understand the fundamental principles!


- Balanced explanation of theory and code!
Running code alone isn't enough to fully understand machine learning and deep learning.
If you want to truly understand machine learning and deep learning, you need to understand the mathematical concepts behind the related theories and algorithms in addition to the code.
This book provides a balanced approach between theory and code, offering clear explanations, explaining how core machine learning and deep learning algorithms work and how to use them, the underlying mathematics, practical examples, and how to avoid common pitfalls.

- From core algorithms to the latest technologies!
Machine learning is explained using Python-based core libraries (SciPy, NumPy, Scikit-Learn, Pandas, etc.) and deep learning is explained using PyTorch.
Because PyTorch is taught in a Python-like manner, it is easier to learn and code more simply.
The book covers the core concepts of PyTorch, as well as GANs and reinforcement learning in detail.
In addition to the content covered in the existing 『Machine Learning Textbook Revised 3rd Edition』, we have added the latest trends such as Transformer, PyTorch Lightning, XGBoost, and graph neural networks.


- Learn with practical examples!
All examples in the book are based on the author's extensive teaching and field experience as a machine learning/deep learning expert.
It is composed of practical and expandable examples rather than simply learning the concepts.
By studying these examples, you will gain a solid understanding of machine learning and deep learning concepts, core algorithms, and application tips. After learning, you will also learn the principles that will allow you to build your own models and applications.

Discord community for readers: https://bit.ly/tensor-discord
Q&A Open Chat Room: https://bit.ly/tensor-chat
GOODS SPECIFICS
- Date of issue: November 30, 2023
- Page count, weight, size: 876 pages | 1,693g | 183*235*36mm
- ISBN13: 9791140707362

You may also like

카테고리