From Fundamentals to Production in JavaScript and TypeScript
Introduction: Why Machine Learning in JavaScript?
- What This Book Covers
- Who Should Read This Book
- How to Use the Code Examples
- A Note on Versions and Changes
Chapter 1: Machine Learning Meets JavaScript
- Why Machine Learning in JavaScript?
- How TensorFlow.js Fits Into the ML Landscape
- Your First Prediction in 30 Seconds
- Browser vs Node.js: Two Environments, One API
- Setting Up Your Development Environment
- Summary
Chapter 2: Tensors, the Building Blocks
- What Is a Tensor?
- Creating Tensors in TensorFlow.js
- Tensor Shapes, Ranks, and Dimensions
- Element-wise Operations and Broadcasting
- Reshaping, Slicing, and Indexing
- The Mathematics Behind the Operations
- Summary
Chapter 3: Memory Management and Performance Basics
- How TensorFlow.js Manages Memory
- Tensors, GPU Buffers, and Garbage Collection
- Disposing Tensors and Avoiding Leaks
- tf.tidy and Automatic Cleanup
- Monitoring Memory Usage
- Performance Profiling Basics
- Summary
Chapter 4: The Sequential API and Core Layers
- Understanding Neural Networks Intuitively
- Building Your First Model with Sequential
- Dense Layers and Linear Transformations
- Activation Functions and Non-linearity
- Convolutional Layers for Spatial Data
- Pooling and Dimensionality Reduction
- Summary
Chapter 5: Training Models from Scratch
- The Training Process Step by Step
- Loss Functions: Measuring Model Quality
- Optimizers and Learning Rate Strategies
- Compiling a Model
- The fit() Method and Training Loop
- Callbacks for Monitoring and Control
- Summary
Chapter 6: Evaluation, Prediction, and Debugging
- Evaluating Model Performance
- Making Predictions with model.predict()
- Understanding Confusion Matrices and Metrics
- Debugging Training Problems
- Overfitting, Underfitting, and Regularization
- Learning Curves and Diagnostics
- Summary
Chapter 7: Advanced Model Architectures
- The Functional API for Complex Graphs
- Recurrent Layers and Sequence Modeling
- LSTM and GRU Networks
- Attention Mechanisms in TensorFlow.js
- Custom Layers and Operations
- Hyperparameter Tuning Strategies
- Summary
Chapter 8: Data Handling and Preprocessing
- The Data Pipeline in TensorFlow.js
- Loading Data from Various Sources
- Normalization and Standardization
- One-hot Encoding and Label Transformation
- Image Preprocessing and Augmentation
- Text Tokenization and Embedding
- Summary
Chapter 9: Computer Vision with TensorFlow.js
- Image Classification Fundamentals
- Using Pretrained Models: MobileNet and ResNet
- Transfer Learning for Custom Classifiers
- Object Detection with COCO-SSD
- Body Pose Estimation and Face Detection
- Building a Custom Vision Application
- Summary
Chapter 10: Natural Language Processing in the Browser
- Representing Text as Numbers
- Sentiment Analysis with Pretrained Models
- Building a Text Classifier from Scratch
- Sequence-to-Sequence Models
- Word Embeddings in TensorFlow.js
- Practical NLP Applications
- Summary
Chapter 11: Time-Series Forecasting and Sequential Data
- Understanding Time-Series Data
- Preparing Sequences for Modeling
- Simple Baseline Models
- LSTM-Based Forecasting
- Evaluating Time-Series Predictions
- Real-World Forecasting Example
- Summary
Chapter 12: Saving, Loading, and Model Formats
- The TensorFlow.js Model Format
- Saving Models in the Browser
- Saving Models in Node.js
- Converting Python Keras Models to TensorFlow.js
- Loading Models from Different Sources
- Quantization and Model Compression
- Summary
Chapter 13: Backend Systems and GPU Acceleration
- How Backends Work in TensorFlow.js
- The WebGL Backend and GPU Compute
- WebGPU Backend and the Future
- CPU Backend Fallbacks
- TensorFlow C++ Backend for Node.js
- Choosing and Configuring Backends
- Summary
Chapter 14: Server-Side Machine Learning with Node.js
- Running TensorFlow.js in Node.js
- Building an Inference API
- Batch Processing and Efficiency
- Scaling Inference Services
- Integration with Web Frameworks
- Production Monitoring and Observability
- Summary
Chapter 15: Deployment, Security, and Best Practices
- Deployment Architectures and Patterns
- Model Security and Protection
- Privacy Considerations in Browser ML
- Interoperability with Other ML Ecosystems
- Testing Machine Learning Code
- The Future of TensorFlow.js
- Summary