Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Genetic Algorithms with Python

You're reading from   Hands-On Genetic Algorithms with Python Apply genetic algorithms to solve real-world AI and machine learning problems

Arrow left icon
Product type Paperback
Published in Jul 2024
Publisher Packt
ISBN-13 9781805123798
Length 418 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Eyal Wirsansky Eyal Wirsansky
Author Profile Icon Eyal Wirsansky
Eyal Wirsansky
Arrow right icon
View More author details
Toc

Table of Contents (24) Chapters Close

Preface 1. Part 1: The Basics of Genetic Algorithms FREE CHAPTER
2. Chapter 1: An Introduction to Genetic Algorithms 3. Chapter 2: Understanding the Key Components of Genetic Algorithms 4. Part 2: Solving Problems with Genetic Algorithms
5. Chapter 3: Using the DEAP Framework 6. Chapter 4: Combinatorial Optimization 7. Chapter 5: Constraint Satisfaction 8. Chapter 6: Optimizing Continuous Functions 9. Part 3: Artificial Intelligence Applications of Genetic Algorithms
10. Chapter 7: Enhancing Machine Learning Models Using Feature Selection 11. Chapter 8: Hyperparameter Tuning of Machine Learning Models 12. Chapter 9: Architecture Optimization of Deep Learning Networks 13. Chapter 10: Reinforcement Learning with Genetic Algorithms 14. Chapter 11: Natural Language Processing 15. Chapter 12: Explainable AI, Causality, and Counterfactuals with Genetic Algorithms 16. Part 4: Enhancing Performance with Concurrency and Cloud Strategies
17. Chapter 13: Accelerating Genetic Algorithms – the Power of Concurrency 18. Chapter 14: Beyond Local Resources – Scaling Genetic Algorithms in the Cloud 19. Part 5: Related Technologies
20. Chapter 15: Evolutionary Image Reconstruction with Genetic Algorithms 21. Chapter 16: Other Evolutionary and Bio-Inspired Computation Techniques 22. Index 23. Other Books You May Enjoy

What this book covers

Chapter 1, An Introduction to Genetic Algorithms, introduces the basics and theory of genetic algorithms, drawing parallels with Darwinian evolution. It contrasts these algorithms with traditional ones, discussing their advantages, limitations, and practical applications. The chapter concludes by highlighting scenarios where genetic algorithms are particularly effective.

Chapter 2, Understanding the Key Components of Genetic Algorithms, provides a comprehensive exploration of genetic algorithms, starting with an outline of a genetic algorithm’s basic flow. It then explores its core components and progresses to examine real coded genetic algorithms while covering advanced concepts such as elitism, niching, and sharing. It concludes with insights into the art of problem-solving using genetic algorithms.

Chapter 3, Using the DEAP Framework, introduces the DEAP framework (a versatile tool for solving real-world problems with genetic algorithms), guides you through its main modules, and demonstrates how to construct essential genetic algorithm components. This is demonstrated by programming a solution to the OneMax problem, followed by experiments with different settings of the genetic algorithm, revealing the impact of various modifications.

Chapter 4, Combinatorial Optimization, explores the application of genetic algorithms in combinatorial optimization while providing Python-based solutions using the DEAP framework. Key optimization problems covered include the Knapsack, Traveling Salesman, and Vehicle Routing problems. Additionally, the chapter discusses genotype-to-phenotype mapping and the balance between exploration and exploitation.

Chapter 5, Constraint Satisfaction, starts by defining the concept of constraint satisfaction and its relevance to search problems and combinatorial optimization. It then presents practical examples of these problems and their solutions using the DEAP framework. Key problems explored include the N-Queen, nurse scheduling, and graph coloring problems. Additionally, it explores the distinction between hard and soft constraints and their integration into the solution process.

Chapter 6, Optimizing Continuous Functions, explores the application of genetic algorithms in optimizing continuous search spaces, using real number-based genetic operators and DEAP framework tools. This chapter presents Python-based solutions for optimizing functions such as the Eggholder, Himmelblau’s, and Simionescu’s functions, incorporating techniques such as niching and sharing, and addressing constraints.

Chapter 7, Enhancing Machine Learning Models Using Feature Selection, explains the use of genetic algorithms to enhance supervised machine learning models through feature selection. It begins with an introduction to machine learning, focusing on regression and classification tasks, and discusses the benefits of feature selection in improving model performance. The chapter then demonstrates the use of genetic algorithms in identifying key features in a test regression problem and in optimizing a classification model using the Zoo dataset by isolating the most effective features.

Chapter 8, Hyperparameter Tuning of Machine Learning Models, explores the enhancement of supervised machine learning models through genetic algorithm-based hyperparameter tuning. After introducing hyperparameter tuning and the grid search concept in machine learning, it uses the Wine dataset and the adaptive boosting classifier as case studies. The chapter compares conventional grid search with a genetic algorithm-driven grid search for hyperparameter tuning, concluding with an attempt to further refine results using a direct genetic algorithm approach.

Chapter 9, Architecture Optimization of Deep Learning Networks, focuses on enhancing artificial neural network-based models through genetic algorithm-driven optimization of network architecture. It begins with an introduction to neural networks and deep learning, followed by a case study using the Iris dataset and the Multilayer Perceptron classifier. The chapter demonstrates network architecture optimization through a genetic algorithm-based solution and extends this approach to include simultaneous optimization of network architecture and model hyperparameters.

Chapter 10, Reinforcement Learning with Genetic Algorithms, illustrates the application of genetic algorithms in reinforcement learning, using two benchmark environments from the Gymnasium toolkit. It begins with an overview of reinforcement learning and an introduction to the Gymnasium toolkit and its Python interface. The focus then shifts to tackling the MountainCar and CartPole environments, developing genetic algorithm-based solutions for these specific challenges.

Chapter 11, Natural Language Processing, dives into the intersection of genetic algorithms and NLP. It introduces NLP and word embeddings and demonstrates their use in a Semantle-like mystery-word game where a genetic algorithm guesses the mystery word. The chapter also examines n-grams and document classification, employing genetic algorithms to select a concise and efficient feature subset, thereby enhancing understanding of the classifier’s functionality.

Chapter 12, Explainable AI, Causality, and Counterfactuals with Genetic Algorithms, investigates the use of genetic algorithms for generating “what if” scenarios in explainable AI and causality, emphasizing counterfactual analysis. It introduces these fields and the concept of counterfactuals, followed by a practical application of the German Credit Risk dataset using genetic algorithms, uncovering valuable insights through counterfactual analysis.

Chapter 13, Accelerating Genetic Algorithms – the Power of Concurrency, explores enhancing genetic algorithms’ performance using concurrency, focusing on multiprocessing. It discusses the benefits of applying concurrency and demonstrates it through Python’s built-in functionalities as well as an external library. Various multiprocessing approaches are tested on a CPU-intensive variant of the OneMax problem, evaluating the performance improvements achieved.

Chapter 14, Beyond Local Resources – Scaling Genetic Algorithms in the Cloud, expands on enhancing genetic algorithm performance through a client-server model, using asynchronous I/O and cloud-based server computations on AWS Lambda. It discusses the split-architecture benefits, applies it to the OneMax problem, and guides through deploying a Flask server and an asyncio client, culminating in AWS Lambda deployment to showcase cloud-enhanced genetic algorithm efficiency.

Chapter 15, Evolutionary Image Reconstruction with Genetic Algorithms, explores genetic algorithms in image processing, focusing on reconstructing images with semi-transparent polygons. It starts with an overview of image processing in Python and explains creating images from scratch with polygons and calculating image differences. It concludes with developing a genetic algorithm-based program to reconstruct a famous painting using polygons, examining the evolutionary process and results.

Chapter 16, Other Evolutionary and Bio-Inspired Computation Techniques, introduces a variety of problem-solving and optimization techniques related to genetic algorithms. It covers genetic programming, NeuroEvolution of Augmenting Topologies (NEAT), and particle swarm optimization, demonstrating each through problem-solving Python programs. The chapter concludes with an overview of several other related computation paradigms.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image