Artificial Intelligence
Artificial Intelligence
Chess (Static): Chess can be considered a static Self-Driving Cars (Continuous): Self-driving cars
environment. Once the game begins, the operate in a continuous environment. The driving
chessboard and the pieces remain unchanged environment is not limited to a finite set of
unless a player makes a move. The positions of distinct states or actions. Instead, it involves a
the chess pieces do not change autonomously continuous range of possibilities and variables.
during the game. The state of the chessboard The car's perception of the environment, such as
the positions of other vehicles, pedestrians, or training. This is typically used when
objects, as well as the car's own motion, is obtaining a fully labeled dataset is time-
represented in continuous spaces. The car's consuming or costly.
actions, such as steering, acceleration, and
2. Deep Learning (DL)
braking, can be smoothly varied within
continuous ranges. The continuous nature of the Deep Learning is a subset of machine learning
driving environment requires more complex that is based on artificial neural networks with
computations and algorithms to process and make representation learning. Representation learning is
decisions based on the continuous data. the ability of a machine to automatically find the
features needed for data classification. DL is
TECHNIQUES OF ARTIFICIAL INTELLIGENCE
especially good at identifying patterns in
let's delve deeper into the main techniques of AI, unstructured data, such as images, sound, and
namely Machine Learning, Deep Learning, and text.
Reinforcement Learning :-
The "deep" in deep learning denotes the depth of
1. Machine Learning (ML) layers in a neural network. A typical deep
learning model consists of many layers of
Machine Learning is a subfield of AI that
artificial neurons, also known as nodes. These
provides systems the ability to learn and improve
layers are interconnected in a way that mimics
from experience without being explicitly
the structure of a human brain. Each node in a
programmed. It centers on the development of
layer uses input from nodes in the previous layer,
algorithms that can modify themselves to improve
performs a computation, and passes the result to
over time. There are three primary types of
nodes in the next layer.
machine learning:
One crucial aspect of deep learning is its ability
• Supervised Learning: In this method, the
to automatically learn feature representations
machine is taught using labeled data. For
from raw data, eliminating the need for manual
instance, if we're trying to create an
feature extraction. Applications of deep learning
algorithm that can identify cats in images,
include image recognition, natural language
we'd train the algorithm using a large
processing, speech recognition, and more.
number of images that are labeled either
"cat" (positive examples) or "not cat" 3. Reinforcement Learning (RL)
(negative examples). The algorithm would
Reinforcement Learning is another subfield of
then learn the characteristics that
machine learning where an agent learns to
differentiate a cat from other entities.
behave in an environment, by performing certain
• Unsupervised Learning: This is a type of actions and observing the results/rewards of those
machine learning where the algorithm is actions. It is about taking suitable action to
not provided with labeled data. The goal maximize reward in a particular situation. It is
is to find hidden patterns or intrinsic employed by various software and machines to
structures from unlabeled data. Common find the best possible behavior or path it should
unsupervised learning methods include take in a specific context.
clustering (grouping similar instances
Reinforcement learning differs from supervised
together) and dimensionality reduction
learning in that it doesn't need labelled
(simplifying input data without losing too
input/output pairs to be explicitly provided, and
much information).
it doesn't need sub-optimal actions to be
• Semi-supervised Learning: As the name explicitly corrected. Instead, the focus is on
suggests, this is a hybrid approach that exploring the environment, taking actions, and
uses both labeled and unlabeled data for learning from the feedback.
A good example of reinforcement learning is a reasoning helps us make sure that if the
chess engine. Here, the agent decides upon a rule is true and the facts are true, then
series of moves depending on the state of the our conclusion will also be true.
board (the environment), and learns optimal
2. Inductive Reasoning :- Inductive reasoning
strategies by playing numerous games and
involves drawing conclusions based on
adjusting its policies based on the game results
patterns or trends observed in specific
(win, lose, or draw).
examples. It's like making educated
In conclusion, all these techniques constitute the guesses. For example, if we observe that
bedrock of AI. Machine Learning provides the every cat we've seen so far has been
foundational principles and methods that allow black, we might generalize and guess that
systems to learn from data. Deep Learning takes all cats are black. Inductive reasoning
these concepts further by enabling the suggests that the conclusion is likely, but
construction of neural networks that can process not guaranteed to be true.
complex, unstructured data. Finally,
Inductive reasoning is like making guesses
Reinforcement Learning focuses on decision-
based on patterns you've noticed. For
making and the optimization of sequences of
example, if you see your friend playing
actions for an agent operating in an environment.
with three green toys, and then you see
These fields continue to evolve, driven by another friend playing with three green
advancements in computational power and the toys too, you might guess that all your
ever-increasing availability of data, and they are friends like to play with three green toys.
finding applications across a wide range of It's not always guaranteed to be true, but
domains, including healthcare, finance, it gives you a good guess based on what
autonomous vehicles, and more. you've seen.
Let's assume we're building a recommendation Thus, the choice of knowledge representation and
system for an e-commerce platform. We could learning technique depends on the specific
represent knowledge using a graph-based model. requirements of your problem and the nature of
Products can be nodes in the graph, and your data. Making the right choice is a critical
step in developing effective AI solutions
The Role of AI in Gaining Insight into AI plays a crucial role in both these fields. In
Intelligence and Perception cognitive science, AI models can be used to
simulate cognitive processes, helping to test
1. How AI Models Mimic or Enhance Human
hypotheses about how the mind works. For
Intelligence and Perception
instance, AI models can simulate how humans
Artificial Intelligence (AI) models have process language, providing insights into how we
increasingly been developed to imitate and understand and generate speech.
enhance human cognitive abilities, which are the
In neuroscience, AI can help in understanding
mental skills and processes that allow us to
how the brain works at a deeper level. For
acquire and apply knowledge. These cognitive
instance, neural networks, a type of AI model,
abilities include learning from experiences,
are inspired by the structure and function of the
understanding complex concepts, reasoning,
brain. These models have layers of interconnected
problem-solving, decision-making, and adjusting
nodes, or "neurons," that process and pass on
to new situations.
information, similar to how neurons work in the
AI systems can mimic human intelligence in brain. By studying these models, neuroscientists
numerous ways. One prominent method is can gain insights into how complex brain
Machine Learning (ML), a subset of AI that networks function.
provides systems the ability to learn and improve
3. Analysis of AI Use Cases in Areas such as
from experience without being explicitly
Natural Language Processing, Image Recognition,
programmed. Much like how a child learns to
etc.
differentiate between various animals, ML
algorithms can be trained on large datasets to AI has numerous practical applications across
identify patterns and make decisions. For various fields, including natural language
instance, a machine learning model can learn to processing (NLP) and image recognition.
differentiate between spam and non-spam emails
NLP is a subfield of AI that focuses on the
based on a training dataset.
interaction between computers and humans
AI not only mimics human intelligence but can through natural language. It enables computers to
also enhance it. For instance, AI can process vast understand, interpret, and generate human
amounts of data much quicker than a human, language in a valuable way. Use cases of NLP
identifying patterns and relationships that might include voice assistants like Siri and Alexa,
be missed by human analysts. This ability can be machine translation tools like Google Translate,
used in numerous fields, from healthcare to and sentiment analysis in social media
finance, to improve decision-making and monitoring.
predictions.
Image recognition, another application of AI,
2. The Role of AI in Cognitive Science and involves teaching computers to recognize images.
Neuroscience This technology is commonly used in a variety of
fields, including healthcare, where it can help
Cognitive science is an interdisciplinary field that
diagnose diseases; in autonomous vehicles, where
studies how information is represented and
it enables the vehicle to recognize obstacles; and
transformed in the brain. It involves research
in social media, for tagging and categorizing
from psychology, linguistics, philosophy, and
photos. AI models, particularly Convolutional
computer science. Neuroscience, on the other
Neural Networks (CNNs), are at the core of these
hand, is a discipline that studies the structure
image recognition tasks.
and function of the nervous system, focusing on
the brain and its impact on behavior and AI's ability to mimic and enhance human
cognitive functions. intelligence and perception, its role in cognitive
science and neuroscience, and its wide range of
applications are significant aspects of the field. search algorithm to prioritize certain actions or
These topics provide a deeper understanding of paths over others.
how AI functions, its potential, and its impact
Informed search algorithms make use of heuristic
across various sectors.
functions that estimate the desirability or quality
SEARCHING ALGORITHMS of states or actions based on the available
information. These functions provide a measure of
how close a state or action is to the goal.
In the field of Artificial Intelligence (AI), search
Examples of informed search strategies include
strategies are algorithms or methods used to
Best-First Search, Greedy Search, and A* (A-Star)
explore and traverse a problem space in order to
Search.
find a solution. These strategies are employed
when there is a need to navigate through a set of Informed search strategies leverage heuristics to
possible states, actions, or paths to reach a make more informed decisions and focus the
desired goal or solution. search on paths that are likely to lead to the goal
state more efficiently. However, the effectiveness
Now, let's define informed and uninformed search
of informed search heavily depends on the quality
strategies in detail :-
and accuracy of the heuristic function employed.
Uninformed Search: Uninformed search, also
known as blind search, refers to search strategies
that do not have any additional information
about the problem other than the available
actions and the current state. These strategies BREADTH FIRST SEARCH
explore the problem space in a systematic manner
Breadth-First Search (BFS) is an uninformed
without utilizing any heuristics or prior
search algorithm used to traverse or explore a
knowledge specific to the problem.
graph or tree in a breadth-wise manner. It
Uninformed search algorithms typically involve systematically explores all the nodes at the same
visiting and expanding nodes in a search tree or depth level before moving on to nodes at the
graph based solely on the available actions and next depth level. BFS ensures that all nodes at a
the order in which they are encountered. given depth are visited before moving to nodes at
Examples of uninformed search strategies include the next depth level.
➢ Breadth-First Search (BFS), Breadth-First Search guarantees that nodes at
➢ Depth-First Search (DFS), each depth level are visited before moving on to
deeper levels. BFS explores the graph in a level-
➢ Uniform Cost Search (UCS). by-level manner, gradually moving away from the
➢ Depth-limited search (DLS) starting node.
➢ Iterative deepening search (IDS) Breadth-First Search is often used to find the
shortest path or the minimum number of steps
Uninformed search is generally more time-
required to reach a goal state in an unweighted
consuming and less efficient compared to
graph. It can also be used to explore or traverse
informed search, especially for complex problems.
a tree or graph systematically in a breadth-first
Informed Search: Informed search, also known as fashion.
heuristic search, involves utilizing additional
Note :- Breadth-First Search is an uninformed
knowledge or heuristics to guide the search
search algorithm, which means it does not
process towards more promising paths or
consider any additional information or heuristics
solutions. Heuristics are rules or estimates based
specific to the problem. It simply explores the
on domain-specific knowledge that can guide the
graph in a systematic manner based on the
available connections and does not prioritize any 5. You continue this process, always
particular path or node. selecting the path with the lowest cost,
until you reach your destination (the goal
node).
b. Memory Efficiency: IDS retains the 2. Heuristics and Focused Search: Informed
memory efficiency of DFS since it only search relies on domain knowledge or
needs to store information about the heuristics, which are rules, estimates, or
current path being explored. It does not insights that provide information about
require the extensive memory usage of the problem domain. These heuristics help
BFS, which stores all nodes at each depth in determining which choices or paths are
level. more likely to lead to the goal state,
allowing for a focused search.
Heuristic functions play a crucial role in informed This equation is used in informed search
search by imparting additional knowledge about algorithms like A* search, where the algorithm
the problem. They estimate the goodness of a aims to minimize the total path cost by
considering both the cost incurred so far and the
estimated cost remaining. The algorithm evaluates In the steps of the Best-First Search algorithm,
and selects nodes based on their f(n) values to several key concepts are involved. Let's go
efficiently find the shortest path to the goal state. through them one by one:
Explored and Expanded Nodes 1. Initial State: This is the starting point of
the search. It represents the state from
Here's a simplified explanation of the terms which the search process begins.
"explored" and "expanded" nodes:
2. Goal State: This is the desired state that
1. Explored Node: An explored node refers the search aims to reach. It defines the
to a node that has been visited during the condition that signifies the solution to the
search process. When the search algorithm problem.
encounters a node, it examines or
evaluates it to determine its 3. Heuristic Function: A heuristic function is
characteristics, such as its state, cost, or used to estimate how close a given node
heuristic value. Once a node has been is to the goal state. It provides a measure
indicating that it has been visited and its The heuristic function guides the search
information has been taken into account. by prioritizing nodes based on their
heuristic values.
2. Expanded Node: An expanded node refers
to a node that has been selected for 4. Priority Queue: The priority queue is a
further exploration or expansion during data structure that stores the nodes during
the search process. When the search the search process. Nodes are inserted
algorithm expands a node, it generates or into the priority queue based on their
creates its neighboring nodes based on the heuristic values. The node with the
next steps in the search. The expanded 5. Expansion: When a node is selected from
node becomes a parent node to its the priority queue, it is expanded.
generated neighboring nodes. Expansion involves generating the
In simpler terms, an explored node is a node that neighboring nodes or states from the
has been visited and examined during the search current node. These neighboring nodes
process. It means that the search algorithm has represent the possible next steps in the
other hand, an expanded node is a node that has 6. Evaluation: Each generated neighboring
been selected for further exploration, and its node is evaluated using the heuristic
neighboring nodes have been generated. The function. The heuristic value is computed
expanded node becomes the parent of its to estimate the desirability of the node in
generated neighboring nodes. reaching the goal state.
Both explored and expanded nodes are essential 7. Insertion: The evaluated neighboring
in search algorithms as they help keep track of nodes are inserted into the priority queue,
the progress of the search and guide the based on their heuristic values. The
exploration of the search space. priority queue maintains the order of
nodes, ensuring that the most promising
1. Initialize the open list with the initial By considering both the actual cost and the
state and set its cost to zero. estimated cost, A* can explore the search space
2. Initialize the closed list as an empty set. efficiently and converge towards the optimal
3. While the open list is not empty: a. Select path. It intelligently prioritizes nodes with lower
the node with the lowest cost from the costs, making it more efficient than uninformed
open list. This is determined by the sum search algorithms like Breadth-First Search or
of the cost to reach that node (known as Depth-First Search.
g(n)) and the estimated cost from that
node to the goal state (known as h(n)). b.
If the selected node is the goal state,
terminate the search and return the
solution. c. Move the selected node from
the open list to the closed list to mark it
as visited. d. Generate the neighboring Example :-
nodes from the selected node. e. For each
neighboring node:
• Calculate its cost to reach (g(n))
by adding the cost from the initial
state to the selected node and the
cost from the selected node to the
neighboring node.
• If the neighboring node is already
in the closed list and the new cost
required grows exponentially with the size
of the problem. The actual time and space
complexity depend on the specific
problem and the quality of the heuristic
function used.
both players. Positive values indicate a a grid of squares, typically a 3x3 grid. The
position favorable to one player, negative objective of the game is to be the first player to
values indicate a position favorable to the create a straight line of three of their own
other player, and values near zero symbols in a row, column, or diagonal.
4. +Infinity and -Infinity: In the context of referred to as player X and player O. Player X
the evaluation function, +infinity always makes the first move by placing an X
represents a winning position for one symbol in any of the open squares on the board.
player (Player A), and -infinity represents Then, player O takes their turn and places an O
a winning position for the other player symbol in any remaining open square. The
(Player B). These values indicate an players continue taking turns, each marking their
information games, players take turns board, the game continues until a winning
line is formed or the board is filled,
resulting in a draw.
MIN-MAX ALGORITHM
ALPHA-BETA PRUNING