Ai - 501unit 1 and 2
Ai - 501unit 1 and 2
Artificial Intelligence has many subsets that focus on different aspects of mimicking
human beings. Machine learning is one of the popular subsets, whereas the
others included are Deep Learning, Natural Language Processing, and
Robotics.
Historical Context :
The root of Ai trace back to Alan turing , who in 1950 posed the quetion ,”Can
machines think ?“ His development of the Turing test set a foundation for thinking
about machine intelligence .
Importance of AI:
Artificial Intelligence is not just a part of computer science even it's so vast and
requires lots of other factors which can contribute to it. To create the AI first we should
know that how intelligence is composed, so the Intelligence is an intangible part of
our brain which is a combination of Reasoning, learning, problem-solving
perception, language understanding, etc.
To achieve the above factors for a machine or software Artificial Intelligence requires
the following discipline:
• Mathematics
• Biology
• Psychology
• Sociology
• Computer Science
• Neurons Study
• Statistics
AI type:
1. Weak AI or Narrow AI:
• Narrow AI is a type of AI which is able to perform a dedicated task with
intelligence.The most common and currently available AI is Narrow AI in
the world of Artificial Intelligence.
• Narrow AI cannot perform beyond its field or limitations, as it is only
trained for one specific task. Hence it is also termed as weak AI. Narrow
AI can fail in unpredictable ways if it goes beyond its limits.
• Apple Siriis a good example of Narrow AI, but it operates with a limited
pre-defined range of functions.
• IBM's Watson supercomputer also comes under Narrow AI, as it uses an
Expert system approach combined with Machine learning and natural
language processing.
• Some Examples of Narrow AI are playing chess, purchasing suggestions
on e-commerce site, self-driving cars, speech recognition, and image
recognition.
2. General AI:
• General AI is a type of intelligence which could perform any intellectual
task with efficiency like a human.
• The idea behind the general AI to make such a system which could be
smarter and think like a human by its own.
• Currently, there is no such system exist which could come under general
AI and can perform any task as perfect as a human.
• The worldwide researchers are now focused on developing machines
with General AI.
• As systems with general AI are still under research, and it will take lots of
efforts and time to develop such systems.
3. Super AI:
• Super AI is a level of Intelligence of Systems at which machines could
surpass human intelligence, and can perform any task better than
human with cognitive properties. It is an outcome of general AI.
• Some key characteristics of strong AI include capability include the
ability to think, to reason,solve the puzzle, make judgments, plan, learn,
and communicate by its own.
• Super AI is still a hypothetical concept of Artificial Intelligence.
Development of such systems in real is still world changing task.
Types of AI Agents
Agents can be grouped into five classes based on their degree of perceived intelligence and
capability. All these agents can improve their performance and generate better action over the time.
These are given below:
Actuators: Actuators are the component of machines that converts energy into
motion. The actuators are only responsible for moving and controlling a system. An
actuator can be an electric motor, gears, rails, etc.
Effectors: Effectors are the devices which affect the environment. Effectors can be
legs, wheels, arms, fingers, wings, fins, and display screen.
PEAS Representation
PEAS is a type of model on which an AI agent works upon. When we define an AI
agent or rational agent, then we can group its properties under PEAS representation
model. It is made up of four words:
• P: Performance measure
• E: Environment
• A: Actuators
• S: Sensors
Here performance measure is the objective for the success of an agent's behavior.
1. Perception: The agent collects information from its environment through sensors.
2. Decision-Making: Based on the information gathered, the agent processes the data and
decides on a course of action.
3. Action: The agent executes actions in the environment through actuators to achieve its
goals.
4. Learning: Some agents can learn from experience, improving their decision making over
time. Different Types of Intelligent Agents:
ENVIRONMENT In AI :
An environment refers to everything external to the intelligent agent that the agent interacts
with. The environment provides the conditions and stimuli that the agent perceives through
sensors and responds to through actuators. It plays a crucial role in determining how an
agent behaves, as the agent's actions and decisions are based on the state of the
environment and the information it receives from it.
e->• Discrete: The environment consists of a limited set of distinct states or actions. For
example, a turn-based game like tic-tac-toe, where each move is discrete.
• Continuous: The environment has a range of possible states or actions. For example,
controlling a robot arm, where movements occur in continuous space.
• Actions: It gives the description of all the available actions to the agent.
• Solution: It is an action sequence which leads from the start node to the
goal node.
• Optimal Solution: If a solution has the lowest cost among all solutions.
Following are the four essential properties of search algorithms to compare the
efficiency of these algorithms:
Space Complexity: It is the maximum storage space required at any point during the
search, as the complexity of the problem.
• Breadth-first search
• Uniform cost search
• Depth-first search
• Depth limited search
• Iterative deepening depth-first search
• Bidirectional Search
1.Breadth-first Search:
• Breadth-first search is the most common search strategy for traversing
a tree or graph. This algorithm searches breadthwise in a tree or graph,
so it is called breadth-first search.
• BFS algorithm starts searching from the root node of the tree and
expands all successor node at the current level before moving to nodes
of next level.
• The breadth-first search algorithm is an example of a general-graph
search algorithm.
• Breadth-first search implemented using FIFO queue data structure.
Advantages:
• It requires lots of memory since each level of the tree must be saved into
memory to expand the next level.
• BFS needs lots of time if the solution is far away from the root node.
• It can be very inefficient approach for searching through deeply layered
spaces, as it needs to thoroughly explore all nodes at each level before
moving on to the next
Example:
In the below tree structure, we have shown the traversing of the tree using BFS
algorithm from the root node S to goal node K. BFS search algorithm traverse in layers,
so it will follow the path which is shown by the dotted arrow, and the traversed path
will be:
S---> A--->B---->C--->D---->G--->H--->E---->F---->I---->K
Time Complexity: Time Complexity of BFS algorithm can be obtained by the number
of nodes traversed in BFS until the shallowest Node. Where the d= depth of shallowest
solution and b is a node at every state.
Space Complexity: Space complexity of BFS algorithm is given by the Memory size of
frontier which is O(bd).
Completeness: BFS is complete, which means if the shallowest goal node is at some
finite depth, then BFS will find a solution.
2. Depth-first Search
• Depth-first search isa recursive algorithm for traversing a tree or graph
data structure.
• It is called the depth-first search because it starts from the root node and
follows each path to its greatest depth node before moving to the next
path.
• DFS uses a stack data structure for its implementation.
• The process of the DFS algorithm is similar to the BFS algorithm.
Note: Backtracking is an algorithm technique for finding all possible solutions using
recursion.
Advantage:
• DFS requires very less memory as it only needs to store a stack of the
nodes on the path from root node to the current node.
• It takes less time to reach to the goal node than BFS algorithm (if it
traverses in the right path).
• With the help of this we can stores the route which is being tracked in
memory to save time as it only needs to keep one at a particular time.
Disadvantage:
• There is the possibility that many states keep re-occurring, and there is
no guarantee of finding the solution.
• DFS algorithm goes for deep down searching and sometime it may go
to the infinite loop.
• The depth-first search (DFS) algorithm does not always find the shortest
path to a solution.
Example:
In the below search tree, we have shown the flow of depth-first search, and it will
follow the order as:
It will start searching from root node S, and traverse A, then B, then D and E, after
traversing E, it will backtrack the tree as E has no other successor and still goal node
is not found. After backtracking it will traverse node C and then G, and here it will
terminate as it found goal node.
Completeness: DFS search algorithm is complete within finite state space as it will
expand every node within a limited search tree.
Time Complexity: Time complexity of DFS will be equivalent to the node traversed by
the algorithm. It is given by:
Where, m= maximum depth of any node and this can be much larger than d
(Shallowest solution depth)
Space Complexity: DFS algorithm needs to store only single path from the root node,
hence space complexity of DFS is equivalent to the size of the fringe set, which is
O(bm).
A heuristic is a way which might not always be guaranteed for best solutions but
guaranteed to find a good solution in reasonable time.
Informed search can solve much complex problem which could not be solved in
another way.
1. Greedy Search
2. A* Search
1. g(n): the actual cost to get from the initial node to node n. It represents the sum
of the costs of node n outgoing edges.
2. h(n): Heuristic cost (also known as "estimation cost") from node n to destination
node n. This problem-specific heuristic function must be acceptable, meaning
it never overestimates the actual cost of achieving the goal. The evaluation
function of node n is defined as f(n) = g(n) h(n).
Algorithm A* selects the nodes to be explored based on the lowest value of f(n),
preferring the nodes with the lowest estimated total cost to reach the goal. The A*
algorithm works:
Ne
← prevnext →