Artificial Intelligence 2
Artificial Intelligence 2
The concept of neural networks dates back to the early 1940s with pioneering work
by Warren McCulloch and Walter Pitts. However, limitations in computing power and
theoretical understanding hindered significant progress for decades.
Let's consider the example of determining whether to buy a smartphone based on its
features:
So, in this example, the artificial neuron (your decision-making process) takes in
inputs like camera quality, battery life, storage capacity, and price, weighs them
based on their importance, adds them up, compares the total to a threshold, and
then decides whether to output "buy the smartphone" or "don't buy the
smartphone."
Unit 2
Alright, class, today we'll be diving into the fascinating world of heuristic functions in
AI. Imagine you're lost in a maze, and you need to find the exit. Exhaustively
checking every path would be slow and inefficient. That's where heuristics come in –
they're like experienced guides that help you prioritize which paths to explore first.
What is a Heuristic Function?
A heuristic function, often simply called a heuristic, is an educated guess that
estimates the cost of reaching the goal state from any given state within a problem.
Think of it as a rule of thumb that helps AI algorithms make informed decisions
during the search process.
Here's a diagram to illustrate:
Current State (A)
|
V
State B ----- State C (Goal)
\ /
\ /
State D
The heuristic function, denoted by h(n), takes a state (like A, B, C, or D) as input and
outputs an estimated cost to get from that state to the goal (State C in this case).
While not always perfect, a good heuristic significantly reduces the search space by
prioritizing states closer (according to the estimate) to the goal.
How are Heuristics Calculated?
The way we calculate heuristics depends on the specific problem. Here are some
common approaches:
• Distance-based heuristics: In maze problems, we might use the Manhattan
distance (sum of the absolute differences in coordinates) between the current
state and the goal.
• Misplaced tile heuristic: For an 8-puzzle, this heuristic counts the number of
tiles out of place compared to the goal state.
• Domain-specific knowledge: For chess, a heuristic might evaluate the
material advantage (number of pieces) or the king's safety.
Why Use Heuristics?
There are two main reasons why heuristics are crucial in AI:
• Efficiency: By prioritizing states closer to the goal, heuristics significantly
reduce the number of states explored, leading to faster solutions.
• Intractability: Many real-world problems have enormous search spaces,
making it impossible to explore them all. Heuristics make these problems
tractable by guiding the search towards promising areas.
Hill Climbing algorithm real life use case: