Trial and error
Trial and error is an iterative problem-solving or learning process that tests alternatives, observes their outcomes, and uses feedback to guide subsequent actions.
Grokking AI Algorithms, Second Edition
Trial and error is a problem-solving technique that tests alternative attempts and uses their outcomes to identify a successful solution.
- How it is used
- Frames learning and search as repeated attempts guided by observed outcomes.
- How deep it goes
- Defines the technique through behavioral examples and a maze comparison, but stops short of implementing a search algorithm.
- Examples
- Uses chicks identifying food, chimpanzees choosing sticks, dog training, and competing paths through a maze.
- What you can do after
- Evaluate alternative actions by observing rewards, penalties, success, failure, and effort.
Read how Grokking AI Algorithms, Second Edition explains trial and error →
Evolutionary Deep Learning: Genetic algorithms and neural networks
Trial-and-error learning is a strategy that discovers effective actions by repeatedly testing alternatives and retaining those that produce favorable outcomes.
- How it is used
- Uses repeated environment interaction to solve reinforcement-learning problems when correct actions are discovered through rewards.
- How deep it goes
- Explains states, actions, rewards, exploration, Q-values, and training loops, but stops short of advanced planning mechanisms.
- Examples
- Demonstrates a Frozen Lake grid, Q-table, epsilon-greedy action selection, training episodes, and agent exercises.
- What you can do after
- Apply it via OpenAI Gym by building, training, and exercising a Q-learning agent in a discrete environment.
Related concepts
- reinforcement learningused by · Reinforcement learning is a machine-learning paradigm in which an agent learns actions or a policy through interaction with an environment and evaluative feedback, such as rewards.
- model architectureuses · The structural organization of a computational system’s components, relationships, and operations that determines how it processes information or behaves.
- natural selectionused by · Natural selection is the evolutionary process by which heritable traits affecting survival or reproduction influence which variants become more common in a population.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

