Utilize this easy-to-follow beginner's guide to understand how deep learning can be applied to the task of anomaly detection. Using Keras and PyTorch in Python, the book focuses on how various deep learning models can be applied to semi-supervised and unsupervised anomaly detection tasks.This book begins with an explanation of what anomaly detection is, what it is used for, and its importance. After covering statistical and traditional machine learning methods for anomaly detection using Scikit-Learn in Python, the book then provides an introduction to deep learning with details on how to build and train a deep learning model in both Keras and PyTorch before shifting the focus to applications of the following deep learning models to anomaly detection: various types of Autoencoders, Restricted Boltzmann Machines, RNNs & LSTMs, and Temporal Convolutional Networks. The book explores unsupervised and semi-supervised anomaly detection along with the basics of time series-based anomaly detection.By the end of the book you will have a thorough understanding of the basic task of anomaly detection as well as an assortment of methods to approach anomaly detection, ranging from traditional methods to deep learning. Additionally, you are introduced to Scikit-Learn and are able to create deep learning models in Keras and PyTorch.**What You Will Learn** * Understand what anomaly detection is and why it is important in today's world * Become familiar with statistical and traditional machine learning approaches to anomaly detection using Scikit-Learn * Know the basics of deep learning in Python using Keras and PyTorch * Be aware of basic data science concepts for measuring a model's performance: understand what AUC is, what precision and recall mean, and more * Apply deep learning to semi-supervised and unsupervised anomaly detection **Who This Book Is For**Data scientists and machine learning engineers interested in learning the basics of deep learning applications in anomaly detection Table of Contents 4 About the Authors 9 About the Technical Reviewers 10 Acknowledgments 12 Introduction 13 Chapter 1: What Is Anomaly Detection? 15 What Is an Anomaly? 15 Anomalous Swans 15 Anomalies as Data Points 19 Anomalies in a Time Series 23 Taxi Cabs 25 Categories of Anomalies 29 Data Point-Based Anomalies 30 Context-Based Anomalies 30 Pattern-Based Anomalies 31 Anomaly Detection 31 Outlier Detection 32 Noise Removal 32 Novelty Detection 32 The Three Styles of Anomaly Detection 33 Where Is Anomaly Detection Used? 34 Data Breaches 34 Identity Theft 35 Manufacturing 35 Networking 36 Medicine 36 Video Surveillance 37 Summary 37 Chapter 2: Traditional Methods of Anomaly Detection 38 Data Science Review 38 Isolation Forest 47 Mutant Fish 47 Anomaly Detection with Isolation Forest 49 One-Class Support Vector Machine 64 Anomaly Detection with OC-SVM 76 Summary 84 Chapter 3: Introduction to Deep Learning 85 What Is Deep Learning? 85 Artificial Neural Networks 86 Intro to Keras: A Simple Classifier Model 96 Intro to PyTorch: A Simple Classifier Model 123 Summary 134 Chapter 4: Autoencoders 135 What Are Autoencoders? 135 Simple Autoencoders 137 Sparse Autoencoders 152 Deep Autoencoders 154 Convolutional Autoencoders 156 Denoising Autoencoders 165 Variational Autoencoders 175 Summary 190 Chapter 5: Boltzmann Machines 191 What Is a Boltzmann Machine? 191 Restricted Boltzmann Machine (RBM) 193 Anomaly Detection with the RBM - Credit Card Data Set 199 Anomaly Detection with the RBM - KDDCUP Data Set 209 Summary 224 Chapter 6: Long Short-Term Memory Models 225 Sequences and Time Series Analysis 225 What Is a RNN? 228 What Is an LSTM? 230 LSTM for Anomaly Detection 235 Examples of Time Series 255 art_daily_no_noise 255 art_daily_nojump 256 art_daily_jumpsdown 258 art_daily_perfect_square_wave 260 art_load_balancer_spikes 262 ambient_temperature_system_failure 263 ec2_cpu_utilization 265 rds_cpu_utilization 266 Summary 268 Chapter 7: Temporal Convolutional Networks 269 What Is a Temporal Convolutional Network? 269 Dilated Temporal Convolutional Network 274 Anomaly Detection with the Dilated TCN 279 Encoder-Decoder Temporal Convolutional Network 295 Anomaly Detection with the ED-TCN 298 Summary 307 Chapter 8: Practical Use Cases of Anomaly Detection 308 Anomaly Detection 309 Real-World Use Cases of Anomaly Detection 310 Telecom 311 Banking 313 Environmental 314 Healthcare 315 Transportation 317 Social Media 318 Finance and Insurance 319 Cybersecurity 320 Video Surveillance 323 Manufacturing 324 Smart Home 326 Retail 326 Implementation of Deep Learning-Based Anomaly Detection 327 Summary 328 Appendix A: Intro to Keras 330 What Is Keras? 330 Using Keras 331 Model Creation 332 Model Compilation and Training 333 Model Evaluation and Prediction 337 Layers 339 Input Layer 339 Dense Layer 340 Activation 342 Dropout 342 Flatten 343 Spatial Dropout 1D 344 Spatial Dropout 2D 345 Conv1D 345 Conv2D 347 UpSampling 1D 348 UpSampling 2D 348 ZeroPadding1D 349 ZeroPadding2D 349 MaxPooling1D 350 MaxPooling2D 350 Loss Functions 351 Mean Squared Error 351 Categorical Cross Entropy 352 Sparse Categorical Cross Entropy 353 Metrics 354 Binary Accuracy 354 Categorical Accuracy 355 Optimizers 356 SGD 356 Adam 357 RMSprop 358 Activations 359 Softmax 359 ReLU 360 Sigmoid 361 Callbacks 362 ModelCheckpoint 362 TensorBoard 363 Back End (TensorFlow Operations) 369 Summary 371 Appendix B: Intro to PyTorch 372 What Is PyTorch? 372 Using PyTorch 373 Sequential vs. ModuleList 387 Layers 388 Conv1d 388 Conv2d 389 Linear 391 MaxPooling1D 391 MaxPooling2D 392 ZeroPadding2D 392 Dropout 393 ReLU 394 Softmax 395 Log_Softmax 396 Sigmoid 397 Loss Functions 398 MSE 398 Cross Entropy 399 Optimizers 401 SGD 401 Adam 402 RMSProp 402 Temporal Convolutional Network in PyTorch 403 Dilated Temporal Convolutional Network 404 Summary 419 Index 420 Utilize this easy-to-follow beginner's guide to understand how deep learning can be applied to the task of anomaly detection. Using Keras and PyTorch in Python, the book focuses on how various deep learning models can be applied to semi-supervised and unsupervised anomaly detection tasks. This book begins with an explanation of what anomaly detection is, what it is used for, and its importance. After covering statistical and traditional machine learning methods for anomaly detection using Scikit-Learn in Python, the book then provides an introduction to deep learning with details on how to build and train a deep learning model in both Keras and PyTorch before shifting the focus to applications of the following deep learning models to anomaly detection: various types of Autoencoders, Restricted Boltzmann Machines, RNNs & LSTMs, and Temporal Convolutional Networks. The book explores unsupervised and semi-supervised anomaly detection along with the basics of time series-based anomaly detection. By the end of the book you will have a thorough understanding of the basic task of anomaly detection as well as an assortment of methods to approach anomaly detection, ranging from traditional methods to deep learning. Additionally, you are introduced to Scikit-Learn and are able to create deep learning models in Keras and PyTorch. What You Will Learn Understand what anomaly detection is and why it is important in today's world Become familiar with statistical and traditional machine learning approaches to anomaly detection using Scikit-Learn Know the basics of deep learning in Python using Keras and PyTorch Be aware of basic data science concepts for measuring a model's performance: understand what AUC is, what precision and recall mean, and more Apply deep learning to semi-supervised and unsupervised anomaly detection Who This Book Is For Data scientists and machine learning engineers interested in learning the basics of deep learning applications in anomaly detection Utilize this easy-to-follow beginner's guide to understand how deep learning can be applied to the task of anomaly deteciton. Using Keras and PyTorch in Python, the book focuses on how various deep learning models can be applied to semi-supervised and unsupervised anomaly detction tasks. This book begins with an explanation of what anomaly detection is, what it is used for, and its importance. After covering statistical and traditional machine learning methods for anomaly detection using Scikit-Learn in Python, the book then provides an introduction to deep learning with details on how to build and train a deep learning model in both Keras and PyTorch before shifting the focus to applications of the following deep learning models to anomaly detection: various types of Autoencoders, Restricted Boltzmann Machines, RNNs & LSTMs, and Temporal Convolutional Networks. The book explores unsupervised and semi-supervised anomaly detection along with the basics of time series-based anomaly detection. By the end of the book you will have a thorough understanding of the basic task of anomaly detection as well as an assortment of methods to approach anomaly detection, ranging from traditional methods to deep learning. Additionally, you are introduced to Scikit-Learn and are able to create deep learning models in Keras and PyTorch Front Matter ....Pages i-xvi What Is Anomaly Detection? (Sridhar Alla, Suman Kalyan Adari)....Pages 1-23 Traditional Methods of Anomaly Detection (Sridhar Alla, Suman Kalyan Adari)....Pages 25-71 Introduction to Deep Learning (Sridhar Alla, Suman Kalyan Adari)....Pages 73-122 Autoencoders (Sridhar Alla, Suman Kalyan Adari)....Pages 123-178 Boltzmann Machines (Sridhar Alla, Suman Kalyan Adari)....Pages 179-212 Long Short-Term Memory Models (Sridhar Alla, Suman Kalyan Adari)....Pages 213-256 Temporal Convolutional Networks (Sridhar Alla, Suman Kalyan Adari)....Pages 257-295 Practical Use Cases of Anomaly Detection (Sridhar Alla, Suman Kalyan Adari)....Pages 297-318 Back Matter ....Pages 319-416