Author(s): Rishal Hurbans
Edition: 0
Publisher: Manning Publications
Year: 2020
Language: English
City: New York
Grokking Artificial Intelligence Algorithms MEAP V05
Copyright
Welcome
Brief contents
Preface
0.1 Our obsession with technology and automation
0.1.1 We’re wired to automate
0.2 Ethics, legal matters, and our responsibility
0.2.1 Intention and impact: Understanding your vision and goals
0.2.2 Unintended use: Protecting against malicious use
0.2.3 Unintended bias: Building solutions for everyone
0.2.4 The law, privacy, and consent: Knowing the importance of core values
0.2.5 Singularity: Exploring the unknown
1: Intuition of artificial intelligence
1.1 What is artificial intelligence?
1.1.1 Defining AI
1.1.2 Understanding that data is core to AI algorithms
1.1.3 Viewing algorithms as instructions in recipes
1.2 A brief history of artificial intelligence
1.3 Problem types and problem-solving paradigms
1.3.1 Search problems: Find a path to a solution
1.3.2 Optimization problems: Find a good solution
1.3.3 Prediction and classification problems: Learn from patterns in data
1.3.4 Clustering problems: Identify patterns in data
1.3.5 Deterministic models: Same result each time it’s calculated
1.3.6 Stochastic/probabilistic models: Potentially different result each time it’s calculated
1.4 Intuition of artificial intelligence concepts
1.4.1 Narrow intelligence: Specific-purpose solutions
1.4.2 General intelligence: Humanlike solutions
1.4.3 Super intelligence: The great unknown
1.4.4 Old AI and new AI
1.4.5 Search algorithms
1.4.6 Biology-inspired algorithms
1.4.7 Machine learning algorithms
1.4.8 Deep learning algorithms
1.5 Uses for artificial intelligence algorithms
1.5.1 Agriculture: Optimal plant growth
1.5.2 Banking: Fraud detection
1.5.3 Cybersecurity: Attack detection and handling
1.5.4 Health care: Diagnosis of patients
1.5.5 Logistics: Routing and optimization
1.5.6 Telecoms: Optimizing networks
1.5.7 Games: Creating AI agents
1.5.8 Art: Creating masterpieces
2: Search fundamentals
2.1 What is planning and searching?
2.2 Cost of computation: The reason for smart algorithms
2.3 Problems applicable to searching algorithms
2.4 Representing state: Creating a framework to represent problem spaces and solutions
2.4.1 Graphs: Representing search problems and solutions
2.4.2 Representing a graph as a concrete data structure
Exercise: Represent a Graph as a Matrix
Solution: Represent a Graph as a Matrix
2.4.3 Trees: The concrete structures used to represent search solutions
2.5 Uninformed search: Looking blindly for solutions
2.6 Breadth-first search: Looking wide before looking deep
Exercise: Determine the path to the solution
Solution: Determine the path to the solution
2.7 Depth-first search: Looking deep before looking wide
Exercise: Determine the path to the solution
Solution: Determine the path to the solution
2.8 Use cases for uninformed search algorithms
2.9 Optional: More about graph categories
2.10 Optional: More ways to represent graphs
2.10.1 Incidence matrix
2.10.2 Adjacency list
3: Intelligent search
3.1 Defining heuristics: Designing educated guesses
Thought Experiment: Given the following scenario, what heuristic can you imagine?
Thought Experiment: Possible solution
3.2 Informed search: Looking for solutions with guidance
3.2.1 A* search
3.2.2 Use cases for informed search algorithms
3.3 Adversarial search: Looking for solutions in a changing environment
3.3.1 A simple adversarial problem
3.3.2 Min-max search: Simulate actions and choose the best future
Heuristics
Exercise: What values would propagate in the following Min-max tree?
Solution: What values would propagate in the following Min-max tree?
3.3.3 Alpha-beta pruning: Optimize by exploring the sensible paths only
3.3.4 Use cases for adversarial search algorithms
4: Evolutionary algorithms
4.1 What is evolution?
4.2 Problems applicable to evolutionary algorithms
4.3 Genetic algorithm: Life cycle
4.4 Encoding the solution space
4.4.1 Binary encoding: Representing possible solutions with zeros and ones
Exercise: What is a possible encoding for the following problem?
Solution: What is a possible encoding for the following problem?
4.5 Creating a population of solutions
4.6 Measuring fitness of individuals in a population
4.7 Selecting parents based on their fitness
4.7.1 Steady state: Replacing a portion of the population each generation
4.7.2 Generational: Replacing the entire population each generation
4.7.3 Roulette Wheel: Selecting parents and surviving individuals
4.8 Reproducing individuals from parents
4.8.1 Single-point crossover: Inheriting one part from each parent
4.8.2 Two-point crossover: Inheriting more parts from each parent
4.8.3 Uniform crossover: Inheriting many parts from each parent
Exercise: What outcome would uniform crossover generate for these chromosomes?
Solution: What outcome would uniform crossover generate for these chromosomes?
4.8.4 Bit-string mutation for binary encoding
4.8.5 Flip-bit mutation for binary encoding
4.9 Populating the next generation
4.9.1 Exploration vs. exploitation
4.9.2 Stopping conditions
4.10 Configuring the parameters of a genetic algorithm
4.11 Use cases for evolutionary algorithms
5: Advanced evolutionary approaches
5.1 Evolutionary algorithm life cycle
5.2 Alternative selection strategies
5.2.1 Rank selection: Even the playing field
5.2.2 Tournament selection: Let them fight
5.2.3 Elitism selection: Choose only the best
5.3 Real-value encoding: Working with real numbers
5.3.1 Real-value encoding at its core
5.3.2 Arithmetic crossover: Reproduce with math
5.3.3 Boundary mutation
5.3.4 Arithmetic mutation
5.4 Order encoding: Working with sequences
5.4.1 Importance of the fitness function
5.4.2 Order encoding at its core
5.4.3 Order mutation: Order/permutation encoding
5.5 Tree encoding: Working with hierarchies
5.5.1 Tree encoding at its core
5.5.2 Tree crossover: Inheriting portions of a tree
5.5.3 Change node mutation: Changing the value of a node
5.6 Common types of evolutionary algorithms
5.6.1 Genetic programming
5.6.2 Evolutionary programming
5.7 Glossary of evolutionary algorithm terms
5.8 More use cases for evolutionary algorithms
6: Swarm intelligence: Ants
6.1 What is swarm intelligence?
6.2 Problems applicable to ant colony optimization
Exercise: Find the shortest path in this carnival configuration
Solution: Find the shortest path in this carnival configuration by hand
6.3 Representing state: What do paths and ants look like?
6.4 The ant colony optimization algorithm life cycle
6.4.1 Initialize the pheromone trails
6.4.2 Set up the population of ants
6.4.3 Choose the next visit for each ant
The stochastic nature of ants
Selecting destination based on a heuristic
Exercise: Determine the probabilities of visiting the attractions with the following information
Solution: Determine the probabilities of visiting the attractions with the following information
6.4.4 Update the pheromone trails
Updating pheromones due to evaporation
Updating pheromones based on ant tours
Exercise: Calculate the pheromone update given the following scenario
Solution: Calculate the pheromone update given the following scenario
6.4.5 Update the best solution
6.4.6 Determine the stopping criteria
6.5 Use cases for ant colony optimization algorithms
7: Swarm intelligence: Particles
7.1 What is particle swarm optimization?
7.2 Optimization problems: A slightly more technical perspective
Exercise: How many dimensions will the search space for the following scenario be?
Solution: How many dimensions will the search space for the following scenario be?
7.3 Problems applicable to particle swarm optimization
7.4 Representing state: What do particles look like?
7.5 Particle swarm optimization life cycle
7.5.1 Initialize the population of particles
7.5.2 Calculate the fitness of each particle
Exercise: What would the fitness be for the following inputs given the drone fitness function?
Solution: What would the fitness be for the following inputs given the drone fitness function?
7.5.3 Update the position of each particle
The components of updating velocity
Updating velocity
Position update
Exercise: Calculate the new velocity and position for particle 1 given the following information about the particles
Solution: Calculate the new velocity and position for particle 1 given the following information about the particles
7.5.4 Determine the stopping criteria
7.6 Use cases for particle swarm optimization algorithms
8: Machine learning
8.1 What is machine learning?
8.2 Problems applicable to machine learning
8.2.1 Supervised learning
8.2.2 Unsupervised learning
8.2.3 Reinforcement learning
8.3 A machine learning workflow
8.3.1 Collecting and understanding data: Know your context
8.3.2 Preparing data: Clean and wrangle
Missing data
Ambiguous values
Encoding categorical data
Exercise: Identify and fix the problem data in this example
Solution: Identify and fix the problem data in this example
Testing and training data
8.3.3 Training a model: Predict with linear regression
Fitting a line to the data
Finding the mean of the features
Finding regression lines with the least-squares method
Exercise: Calculate a regression line using the least-squares method
Solution: Calculate a regression line using the least-squares method
8.3.4 Testing the model: Determine the accuracy of the model
Separating training and testing data
Measuring performance of the line
8.3.5 Improving accuracy
8.4 Classification with decision trees
8.4.1 Classification problems: Either this or that
Exercise: Regression vs Classification
Solution: Regression vs Classification
8.4.2 The basics of decision trees
8.4.3 Training decision trees
Data structures for decision trees
Decision-tree learning life cycle
Exercise: Calculating uncertainty and information gain for a question
Solution: Calculating uncertainty and information gain for a question
8.4.4 Classifying examples with decision trees
8.5 Other popular machine learning algorithms
8.6 Use cases for machine learning algorithms
9: Artificial neural networks
9.1 What are artificial neural networks?
9.2 The perceptron: A representation of a neuron
Exercise: Calculate the output of the following input for the Perceptron
Solution: Calculate the output of the following input for the Perceptron
9.3 Defining artificial neural networks
9.4 Forward propagation: Using a trained ANN
Exercise: Calculate the prediction for the example BY using forward propagation with the following ANN
Solution: Calculate the prediction for the example BY using forward propagation with the following ANN
9.5 Back propagation: Training an ANN
9.5.1 Phase A: Setup
9.5.2 Phase B: Forward propagation
9.5.3 Phase C: Training
Exercise: Calculate the new weights for the highlighted weights
Solution: Calculate the new weights for the highlighted weights
9.6 Options for activation functions
9.7 Designing artificial neural networks
9.7.1 Inputs and outputs
9.7.2 Hidden layers and nodes
9.7.3 Weights
9.7.4 Bias
9.7.5 Activation functions
9.7.6 Cost function and learning rate
9.8 Artificial neural network types and use cases
9.8.1 Convolutional neural network
9.8.2 Recurrent neural network
9.8.3 Generative adversarial network
10: Reinforcement learning with Q-learning
10.1 What is reinforcement learning?
10.1.1 The inspiration for reinforcement learning
10.2 Problems applicable to reinforcement learning
10.3 The life cycle of reinforcement learning
10.3.1 Simulation and data: Make the environment come alive
10.3.2 Training with the simulation using Q-learning
Exercise: Calculate the change in values for the Q-table
Solution: Calculate the change in values for the Q-table
10.3.3 Testing with the simulation and Q-table
10.3.4 Measuring the performance of training
10.3.5 Model-free and model-based learning
10.4 Deep learning approaches to reinforcement learning
10.5 Use cases for reinforcement learning
10.5.1 Robotics
10.5.2 Recommendation engines
10.5.3 Financial trading
10.5.4 Game playing