0% found this document useful (0 votes)
82 views57 pages

Artificial Intelligence: Unit-I

Uploaded by

chrohittrar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views57 pages

Artificial Intelligence: Unit-I

Uploaded by

chrohittrar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Artificial Intelligence

UNIT-I
1. AI :-
• It is a branch of computer science by which we can create intelligent machines
which can behave like a human, think like humans, and able to make decisions.

• Artificial Intelligence is a way of making a computer, a computer-controlled


robot, or a software think intelligently, in the similar manner the intelligent
humans think.
• AI is accomplished by studying how human brain thinks, and how humans
learn, decide, and work while trying to solve a problem, and then using the
outcomes of this study as a basis of developing intelligent software and
systems.
• Artificial Intelligence is composed of two words Artificial and Intelligence,
where Artificial defines "man-made," and intelligence defines "thinking
power", hence AI means "a man-made thinking power."
2. Goals of AI :-
• Replicate human intelligence
• Solve Knowledge-intensive tasks
• An intelligent connection of perception and action
• Building a machine which can perform tasks that requires human intelligence
such as:
o Proving a theorem
o Playing chess
o Plan some surgical operation
o Driving a car in traffic
• Creating some system which can exhibit intelligent behavior, learn new things
by itself, demonstrate, explain, and can advise to its user.

3. AI Approaches :-
• Reactive machines : These machines are the most basic form of AI
applications. Examples of reactive machines are Deep Blue, IBM's chess-
playing supercomputer, and the same computer that defeated the then-grand
master of the world. AI teams do not use training sets to feed the machines or
store subsequent data for future references. Based on the move made by the
opponent, the machine decides/predicts the next move.
• Limited memory : These machines belong to the Category II category of AI
applications, and Self-propelled cars are the perfect example. Over time, these
machines are fed with data and trained on the speed and direction of other cars, lane
markings, traffic lights, curves of roads, and other important factors.
• Theory of mind : It is where we are struggling to make this concept work. However,
we are not there yet. Theory of mind is the concept where bots will understand and
react to human emotions, thoughts. If AI-powered machines are always mingling and
moving around with us, then understanding human behavior is imperative. And then,
it is necessary to react to such behaviors accordingly.
• Self-awareness : These machines are an extension of class III type AI, and it is a step
ahead of understanding human emotions. It is the stage where AI teams build
machines with self-awareness factors programmed into them. When someone is
honking the horn from behind, the machines must sense the emotion, and only then
do they understand what it feels like when they horn someone from behind.

4. AI Techniques :-
• Machine Learning : where models learn from experience and evolve their precision
and delivery over a period
• Data Mining : where statistics and artificial intelligence are used for the analysis of
large data sets to discover helpful information
• Machine Vision : where the system can use imaging-based automatic inspection and
analysis for guidance, decisions, automatic inspection, process control, etc.
• Natural Language Processing or NLP : where machines can understand and respond
to text or voice data
• Robotics : where expert systems can perform tasks like a human.

5. Branches of AI :-

• Machine Learning :-
➢ In terms of advanced technology, one of the most demanding fields is Machine
Learning.
➢ Machine Learning is the technique that gives computers the potential to learn
without being programmed.
➢ Moreover, depending on the types of data available, data professionalists
select types of machine learning (algorithms) for what they want to predict
from data,
✓ Supervised Learning: In this type of learning, data experts feed
labelled training data to algorithms and define variables to algorithms
for accessing and finding correlations. Both the input and output of the
algorithm are particularized/defined.
✓ Unsupervised Learning: This type of learning include algorithms that
train on unlabelled data, an algorithm analyzes datasets to draw
meaningful correlations or inferences. For example, one method is
cluster analysis that uses exploratory data analysis to obtain hidden or
grouping patterns or groups in datasets.
✓ Reinforcement Learning: For teaching a computer machine to fulfil a
multi-step process for which there are clearly defined
rules, reinforcement learning is practised. Here, programmers design an
algorithm to perform a task and give it positive and negative signal to
act as algorithm execute to complete the task. Sometimes, the algorithm
even determines on its own what action to take to go ahead.
• Neural Network :-
➢ Incorporating cognitive science and machines to perform tasks, the neural
network is a branch of artificial intelligence that makes use of neurology.
➢ In simple terms, a neural network is a set of algorithms that are used to find
the elemental relationships across the bunches of data via the process that
imitates the human brain operating process.
➢ A neural network refers to a system of neurons that are original or artificial in
nature, where artificial neurons are known as perceptrons.
• Robotics :-
➢ Robotics is an interdisciplinary field of science and engineering incorporated
with mechanical engineering, electrical engineering, computer science, and
many others.
➢ Robotics determines the designing, producing, operating, and usage of robots.
It deals with computer systems for their control, intelligent outcomes, and
information transformation.

• Expert Systems :-
➢ Expert systems were considered amid the first successful model of AI software.
➢ For the first time, they were designed in the 1970s and after that escalated in
the 1980s.
➢ An expert system refers to a computer system that mimics the decision-making
intelligence of a human expert.
➢ It conducts this by deriving knowledge from its knowledge base by
implementing reasoning and insights rules in terms with the user queries.
➢ The effectiveness of the expert system completely relies on the expert’s
knowledge accumulated in a knowledge base.
➢ The more the information collected in it, the more the system enhances its
efficiency.
➢ For example, the expert system provides suggestions for spelling and errors in
Google Search Engine.
• Fuzzy Logic :-
➢ Fuzzy logic is a technique that represents and modifies uncertain information
by measuring the degree to which the hypothesis is correct.
➢ Fuzzy logic is convenient and flexible to implement machine learning
techniques and assist in imitating human thought logically.
➢ It is simply the generalization of the standard logic where a concept exhibits a
degree of truth between 0.0 to 1.0.
➢ If the concept is completely true, standard logic is 1.0 and 0.0 for the
completely false concept.
➢ But in fuzzy logic, there is also an intermediate value too which is partially true
and partially false.
• Natural Language Processing :-
➢ In layman words, NLP is the part of computer science and AI that can help in
communicating between computer and human by natural language.
➢ It is a technique of computational processing of human languages.
➢ It enables a computer to read and understand data by mimicking human
natural language.
➢ NLP is a method that deals in searching, analyzing, understanding and deriving
information from the text form of data.
➢ A common example of NLP is spam detection, computer algorithms can check
whether an email is a junk or not by looking at the subject of a line, or text of
an email.

6. Applications of AI :-
• AI in Astronomy:
o Artificial Intelligence can be very useful to solve complex universe problems. AI
technology can be helpful for understanding the universe such as how it works, origin,
etc.

• AI in Healthcare:
o In the last, five to ten years, AI becoming more advantageous for the healthcare
industry and going to have a significant impact on this industry.
o Healthcare Industries are applying AI to make a better and faster diagnosis than
humans. AI can help doctors with diagnoses and can inform when patients are
worsening so that medical help can reach to the patient before hospitalization.

• AI in Gaming:
o AI can be used for gaming purpose. The AI machines can play strategic games like
chess, where the machine needs to think of a large number of possible places.

• AI in Finance:
o AI and finance industries are the best matches for each other. The finance industry is
implementing automation, chatbot, adaptive intelligence, algorithm trading, and
machine learning into financial processes.
• AI in Data Security:
o The security of data is crucial for every company and cyber-attacks are growing very
rapidly in the digital world. AI can be used to make your data more safe and secure.
Some examples such as AEG bot, AI2 Platform,are used to determine software bug and
cyber-attacks in a better way.

• AI in Social Media:
o Social Media sites such as Facebook, Twitter, and Snapchat contain billions of user
profiles, which need to be stored and managed in a very efficient way. AI can organize
and manage massive amounts of data. AI can analyze lots of data to identify the latest
trends, hashtag, and requirement of different users.

• AI in Travel & Transport:


o AI is becoming highly demanding for travel industries. AI is capable of doing various
travel related works such as from making travel arrangement to suggesting the hotels,
flights, and best routes to the customers. Travel industries are using AI-powered
chatbots which can make human-like interaction with customers for better and fast
response.

• AI in Automotive Industry:
o Some Automotive industries are using AI to provide virtual assistant to their user for
better performance. Such as Tesla has introduced TeslaBot, an intelligent virtual
assistant.
o Various Industries are currently working for developing self-driven cars which can make
your journey more safe and secure.

• AI in Robotics:
o Artificial Intelligence has a remarkable role in Robotics. Usually, general robots are
programmed such that they can perform some repetitive task, but with the help of AI,
we can create intelligent robots which can perform tasks with their own experiences
without pre-programmed.
o Humanoid Robots are best examples for AI in robotics, recently the intelligent
Humanoid robot named as Erica and Sophia has been developed which can talk and
behave like humans.
• AI in Entertainment:
o We are currently using some AI based applications in our daily life with some
entertainment services such as Netflix or Amazon. With the help of ML/AI algorithms,
these services show the recommendations for programs or shows.

• AI in Agriculture:
o Agriculture is an area which requires various resources, labor, money, and time for best
result. Now a day's agriculture is becoming digital, and AI is emerging in this field.
Agriculture is applying AI as agriculture robotics, solid and crop monitoring, predictive
analysis. AI in agriculture can be very helpful for farmers.

• AI in E-commerce:
o AI is providing a competitive edge to the e-commerce industry, and it is becoming
more demanding in the e-commerce business. AI is helping shoppers to discover
associated products with recommended size, color, or even brand.

• AI in education:
o AI can automate grading so that the tutor can have more time to teach. AI chatbot can
communicate with students as a teaching assistant.
o AI in the future can be work as a personal virtual tutor for students, which will be
accessible easily at any time and any place.

7. Agents :-

• An agent can be anything that perceiveits environment through sensors and act upon
that environment through actuators. An Agent runs in the cycle
of perceiving, thinking, and acting. An agent can be:

o Human-Agent: A human agent has eyes, ears, and other organs which work for
sensors and hand, legs, vocal tract work for actuators.
o Robotic Agent: A robotic agent can have cameras, infrared range finder, NLP for
sensors and various motors for actuators.
o Software Agent: Software agent can have keystrokes, file contents as sensory input
and act on those inputs and display output on the screen.

Before moving forward, we should first know about sensors, effectors, and
actuators.

o Sensor: Sensor is a device which detects the change in the environment and sends the
information to other electronic devices. An agent observes its environment through
sensors.
o 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.
o Effectors: Effectors are the devices which affect the environment. Effectors can be
legs, wheels, arms, fingers, wings, fins, and display screen.

8. Types of AI Agents :-

• Simple Reflex agent:


o The Simple reflex agents are the simplest agents. These agents take decisions on the
basis of the current percepts and ignore the rest of the percept history.
o These agents only succeed in the fully observable environment.
o The Simple reflex agent does not consider any part of percepts history during their
decision and action process.
o The Simple reflex agent works on Condition-action rule, which means it maps the
current state to action. Such as a Room Cleaner agent, it works only if there is dirt in
the room.
o Problems for the simple reflex agent design approach:
o They have very limited intelligence
o Not adaptive to changes in the environment.
o They do not have knowledge of non-perceptual parts of the current state
o Mostly too big to generate and to store.
• Model-based reflex agent:
o The Model-based agent can work in a partially observable environment, and track the
situation.
o A model-based agent has two important factors:
o Model: It is knowledge about "how things happen in the world," so it is called
a Model-based agent.
o Internal State: It is a representation of the current state based on percept
history.
o These agents have the model, "which is knowledge of the world" and based on the
model they perform actions.
o Updating the agent state requires information about:
o How the world evolves
o How the agent's action affects the world.

• Goal-based agents:
o The knowledge of the current state environment is not always sufficient to decide for an agent
to what to do.
o The agent needs to know its goal which describes desirable situations.
o Goal-based agents expand the capabilities of the model-based agent by having the "goal"
information.
o They choose an action, so that they can achieve the goal.
o These agents may have to consider a long sequence of possible actions before deciding
whether the goal is achieved or not. Such considerations of different scenario are called
searching and planning, which makes an agent proactive.
• Utility-based agents:
o These agents are similar to the goal-based agent but provide an extra component of
utility measurement which makes them different by providing a measure of success
at a given state.
o Utility-based agent act based not only goals but also the best way to achieve the goal.
o The Utility-based agent is useful when there are multiple possible alternatives, and an
agent has to choose in order to perform the best action.
o The utility function maps each state to a real number to check how efficiently each
action achieves the goals.
• Learning Agents:
o A learning agent in AI is the type of agent which can learn from its past experiences,
or it has learning capabilities.
o It starts to act with basic knowledge and then able to act and adapt automatically
through learning.
o A learning agent has mainly four conceptual components, which are:
a. Learning element: It is responsible for making improvements by
learning from environment
b. Critic: Learning element takes feedback from critic which describes
that how well the agent is doing with respect to a fixed performance
standard.
c. Performance element: It is responsible for selecting external action
d. Problem generator: This component is responsible for suggesting
actions that will lead to new and informative experiences.
o Hence, learning agents are able to learn, analyze performance, and look for new ways
to improve the performance.

9. Rules for an AI Agent :-

Following are the main four rules for an AI agent:

o Rule 1: An AI agent must have the ability to perceive the environment.


o Rule 2: The observation must be used to make decisions.
o Rule 3: Decision should result in an action.
o Rule 4: The action taken by an AI agent must be a rational action.
10.Agent Environment in AI :-
• An environment can be described as a situation in which an agent is present.
• The environment is where agent lives, operate and provide the agent with something
to sense and act upon it. An environment is mostly said to be non-feministic.
• An environment is everything in the world which surrounds the agent, but it is not a
part of an agent itself.

11.Features of Environment :-
• Fully observable vs Partially Observable:
o If an agent sensor can sense or access the complete state of an environment at each
point of time then it is a fully observable environment, else it is partially observable.
o A fully observable environment is easy as there is no need to maintain the internal
state to keep track history of the world.
o An agent with no sensors in all environments then such an environment is called
as unobservable.

• Deterministic vs Stochastic:
o If an agent's current state and selected action can completely determine the next state
of the environment, then such environment is called a deterministic environment.
o A stochastic environment is random in nature and cannot be determined completely
by an agent.
o In a deterministic, fully observable environment, agent does not need to worry about
uncertainty.

• Episodic vs Sequential:
o In an episodic environment, there is a series of one-shot actions, and only the current
percept is required for the action.
o However, in Sequential environment, an agent requires memory of past actions to
determine the next best actions.

• Single-agent vs Multi-agent
o If only one agent is involved in an environment, and operating by itself then such an
environment is called single agent environment.
o However, if multiple agents are operating in an environment, then such an
environment is called a multi-agent environment.
o The agent design problems in the multi-agent environment are different from single
agent environment.

• Static vs Dynamic:
o If the environment can change itself while an agent is deliberating then such
environment is called a dynamic environment else it is called a static environment.
o Static environments are easy to deal because an agent does not need to continue
looking at the world while deciding for an action.
o However for dynamic environment, agents need to keep looking at the world at each
action.
o Taxi driving is an example of a dynamic environment whereas Crossword puzzles are
an example of a static environment.

• Discrete vs Continuous:
o If in an environment there are a finite number of percepts and actions that can be
performed within it, then such an environment is called a discrete environment else it
is called continuous environment.
o A chess gamecomes under discrete environment as there is a finite number of moves
that can be performed.
o A self-driving car is an example of a continuous environment.

• Known vs Unknown:
o Known and unknown are not actually a feature of an environment, but it is an agent's
state of knowledge to perform an action.
o In a known environment, the results for all actions are known to the agent. While in
unknown environment, agent needs to learn how it works in order to perform an
action.
o It is quite possible that a known environment to be partially observable and an
Unknown environment to be fully observable.

• Accessible vs Inaccessible:
o If an agent can obtain complete and accurate information about the state's
environment, then such an environment is called an Accessible environment else it is
called inaccessible.
o An empty room whose state can be defined by its temperature is an example of an
accessible environment.
o Information about an event on earth is an example of Inaccessible environment.

12.Rational Agent :-
• A rational agent is an agent which has clear preference, models uncertainty, and acts
in a way to maximize its performance measure with all possible actions.
• A rational agent is said to perform the right things.
• AI is about creating rational agents to use for game theory and decision theory for
various real-world scenarios.
• For an AI agent, the rational action is most important because in AI reinforcement
learning algorithm, for each best possible action, agent gets the positive reward and
for each wrong action, an agent gets a negative reward.
• Rational agents in AI is very similar to intelligent agent.
13.Rationality :-

• The rationality of an agent is measured by its performance measure. Rationality can


be judged on the basis of following points:

o Performance measure which defines the success criterion.


o Agent prior knowledge of its environment.
o Best possible actions that an agent can perform.
o The sequence of percepts.

14.Structure of an AI Agent :-
• The task of AI is to design an agent program which implements the agent
function.
• The structure of an intelligent agent is a combination of architecture and
agent program. It can be viewed as:
Agent = Architecture + Agent program

Following are the main three terms involved in the structure of an AI agent:

Architecture: Architecture is machinery that an AI agent executes on.

Agent Function: Agent function is used to map a percept to an action.

Agent program: Agent program is an implementation of agent function. An agent


program executes on the physical architecture to produce function f.

15.PEAS :-

• 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:

o P: Performance measure
o E: Environment
o A: Actuators
o S: Sensors

Here performance measure is the objective for the success of an agent's behavior.
UNIT-II

1. Solving Problems by Searching :-


• Searching is the universal technique of problem solving in AI.
• There are some single-player games such as tile games, Sudoku, crossword,
etc.
• The search algorithms help you to search for a particular position in such
games.
• Rational agents or Problem-solving agents in AI mostly used these search
strategies or algorithms to solve a specific problem and provide the best result.
• Problem-solving agents are the goal-based agents and use atomic
representation.

2. Search Algorithm Terminologies :-


o Search: Searching is a step by step procedure to solve a search-problem in a given
search space. A search problem can have three main factors:
a. Search Space: Search space represents a set of possible solutions,
which a system may have.
b. Start State: It is a state from where agent begins the search.
c. Goal test: It is a function which observe the current state and returns
whether the goal state is achieved or not.
o Search tree: A tree representation of search problem is called Search tree. The root of
the search tree is the root node which is corresponding to the initial state.
o Actions: It gives the description of all the available actions to the agent.
o Transition model: A description of what each action do, can be represented as a
transition model.
o Path Cost: It is a function which assigns a numeric cost to each path.
o Solution: It is an action sequence which leads from the start node to the goal node.
o Optimal Solution: If a solution has the lowest cost among all solutions.

3. Properties of Search Algorithms :-

• Completeness: A search algorithm is said to be complete if it guarantees to return a


solution if at least any solution exists for any random input.
• Optimality: If a solution found for an algorithm is guaranteed to be the best solution
(lowest path cost) among all other solutions, then such a solution for is said to be an
optimal solution.
• Time Complexity: Time complexity is a measure of time for an algorithm to complete
its task.
• Space Complexity: It is the maximum storage space required at any point during the
search, as the complexity of the problem.
4. Problem solving techniques :-

a. Single Agent Pathfinding Problems :


• The games such as 3X3 eight-tile, 4X4 fifteen-tile, and 5X5 twenty four tile puzzles are
single-agent-path-finding challenges.
• They consist of a matrix of tiles with a blank tile.
• The player is required to arrange the tiles by sliding a tile either vertically or
horizontally into a blank space with the aim of accomplishing some objective.
• The other examples of single agent pathfinding problems are Travelling Salesman
Problem, Rubik’s Cube, and Theorem Proving.
Search Terminology
✓ Problem Space − It is the environment in which the search takes place. (A set of states
and set of operators to change those states)
✓ Problem Instance − It is Initial state + Goal state.
✓ Problem Space Graph − It represents problem state. States are shown by nodes and
operators are shown by edges.
✓ Depth of a problem − Length of a shortest path or shortest sequence of operators
from Initial State to goal state.
✓ Space Complexity − The maximum number of nodes that are stored in memory.
✓ Time Complexity − The maximum number of nodes that are created.
✓ Admissibility − A property of an algorithm to always find an optimal solution.
✓ Branching Factor − The average number of child nodes in the problem space graph.
✓ Depth − Length of the shortest path from initial state to goal state.
b. Brute-Force Search Strategies :
• They are most simple, as they do not need any domain-specific knowledge.
• They work fine with small number of possible states.
Requirements −
• State description
• A set of valid operators
• Initial state
• Goal state description

5. Types of Search Algorithm :-


i. Uninformed Search Algorithm
• The uninformed search does not contain any domain knowledge such as
closeness, the location of the goal.
• It operates in a brute-force way as it only includes information about how to
traverse the tree and how to identify leaf and goal nodes.
• Uninformed search applies a way in which search tree is searched without
any information about the search space like initial state operators and test
for the goal, so it is also called blind search.
• It examines each node of the tree until it achieves the goal node.
Following are the various types of uninformed search algorithms:
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:

o BFS will provide a solution if any solution exists.


o If there are more than one solutions for a given problem, then BFS will provide
the minimal solution which requires the least number of steps.

Disadvantages:

o It requires lots of memory since each level of the tree must be saved into
memory to expand the next level.
o BFS needs lots of time if the solution is far away from the root node.

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:

o 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.
o It takes less time to reach to the goal node than BFS algorithm (if it traverses in the
right path).
Disadvantage:

o There is the possibility that many states keep re-occurring, and there is no guarantee
of finding the solution.
o DFS algorithm goes for deep down searching and sometime it may go to the infinite
loop.

Depth-Limited Search Algorithm:

• A depth-limited search algorithm is similar to depth-first search with a predetermined


limit.
• Depth-limited search can solve the drawback of the infinite path in the Depth-first
search. In this algorithm, the node at the depth limit will treat as it has no successor
nodes further.

Depth-limited search can be terminated with two Conditions of failure:

o Standard failure value: It indicates that problem does not have any solution.
o Cut off failure value: It defines no solution for the problem within a given depth limit.

Advantages:

o Depth-limited search is Memory efficient.

Disadvantages:

o Depth-limited search also has a disadvantage of incompleteness.


o It may not be optimal if the problem has more than one solution.

Uniform-cost Search Algorithm:

• Uniform-cost search is a searching algorithm used for traversing a weighted tree or


graph.
• This algorithm comes into play when a different cost is available for each edge. The
primary goal of the uniform-cost search is to find a path to the goal node which has
the lowest cumulative cost.
• Uniform-cost search expands nodes according to their path costs form the root node.
It can be used to solve any graph/tree where the optimal cost is in demand.
• A uniform-cost search algorithm is implemented by the priority queue. It gives
maximum priority to the lowest cumulative cost.
• Uniform cost search is equivalent to BFS algorithm if the path cost of all edges is the
same.
Advantages:

o Uniform cost search is optimal because at every state the path with the least cost is
chosen.

Disadvantages:

o It does not care about the number of steps involve in searching and only concerned
about path cost. Due to which this algorithm may be stuck in an infinite loop.

Iterative deepening depth-first Search:

• The iterative deepening algorithm is a combination of DFS and BFS algorithms. This
search algorithm finds out the best depth limit and does it by gradually increasing the
limit until a goal is found.
• This algorithm performs depth-first search up to a certain "depth limit", and it keeps
increasing the depth limit after each iteration until the goal node is found.
• This Search algorithm combines the benefits of Breadth-first search's fast search and
depth-first search's memory efficiency.
• The iterative search algorithm is useful uninformed search when search space is large,
and depth of goal node is unknown.

Advantages:

o It combines the benefits of BFS and DFS search algorithm in terms of fast search and
memory efficiency.

Disadvantages:

o The main drawback of IDDFS is that it repeats all the work of the previous phase.

Bidirectional Search Algorithm:

• Bidirectional search algorithm runs two simultaneous searches, one form initial state
called as forward-search and other from goal node called as backward-search, to find
the goal node.
• Bidirectional search replaces one single search graph with two small subgraphs in
which one starts the search from an initial vertex and other starts from goal vertex.
The search stops when these two graphs intersect each other.

Bidirectional search can use search techniques such as BFS, DFS, DLS, etc.

Advantages:

o Bidirectional search is fast.


o Bidirectional search requires less memory
Disadvantages:

o Implementation of the bidirectional search tree is difficult.


o In bidirectional search, one should know the goal state in advance.

ii. Informed Search

• Informed search algorithms use domain knowledge.


• In an informed search, problem information is available which can guide the search.
• Informed search can solve much complex problem which could not be solved
in another way.
• Informed search strategies can find a solution more efficiently than an uninformed
search strategy. Informed search is also called a Heuristic search.

Note : Heuristic is a function which is used in Informed Search, and it finds the most
promising path. It takes the current state of the agent as its input and produces the
estimation of how close agent is from the goal. The heuristic method, however, might not
always give the best solution, but it guaranteed to find a good solution in reasonable time.
Heuristic function estimates how close a state is to the goal. It is represented by h(n), and it
calculates the cost of an optimal path between the pair of states. The value of the heuristic
function is always positive.

Admissibility of the heuristic function is given as:

h(n) <= h*(n)

Following are the various types of uninformed search algorithms:


Best-first Search Algorithm (Greedy Search):

• Greedy best-first search algorithm always selects the path which appears best at that
moment.
• It is the combination of depth-first search and breadth-first search algorithms.
• It uses the heuristic function and search. Best-first search allows us to take the
advantages of both algorithms.
• With the help of best-first search, at each step, we can choose the most promising
node.
• In the best first search algorithm, we expand the node which is closest to the goal
node and the closest cost is estimated by heuristic function, i.e.
Advantages:
o Best first search can switch between BFS and DFS by gaining the advantages of both
the algorithms.
o This algorithm is more efficient than BFS and DFS algorithms.

Disadvantages:
o It can behave as an unguided depth-first search in the worst case scenario.
o It can get stuck in a loop as DFS.
o This algorithm is not optimal.

A* Search Algorithm:

• A* search is the most commonly known form of best-first search.


• It uses heuristic function h(n), and cost to reach the node n from the start state g(n).
• It has combined features of UCS and greedy best-first search, by which it solve the
problem efficiently. A* search algorithm finds the shortest path through the search
space using the heuristic function.
• This search algorithm expands less search tree and provides optimal result faster.
• A* algorithm is similar to UCS except that it uses g(n)+h(n) instead of g(n).
• In A* search algorithm, we use search heuristic as well as the cost to reach the node.
Hence we can combine both costs as following, and this sum is called as a fitness
number.

Advantages:
o A* search algorithm is the best algorithm than other search algorithms.
o A* search algorithm is optimal and complete.
o This algorithm can solve very complex problems.

Disadvantages:
o It does not always produce the shortest path as it mostly based on heuristics and
approximation.
o A* search algorithm has some complexity issues.
o The main drawback of A* is memory requirement as it keeps all generated nodes in
the memory, so it is not practical for various large-scale problems.

Points to remember:

o A* algorithm returns the path which occurred first, and it does not search for all
remaining paths.
o The efficiency of A* algorithm depends on the quality of heuristic.
o A* algorithm expands all nodes which satisfy the condition f(n)<="" li="">

Complete: A* algorithm is complete as long as:

o Branching factor is finite.


o Cost at every action is fixed.

Optimal: A* search algorithm is optimal if it follows below two conditions:

o Admissible: the first condition requires for optimality is that h(n) should be an
admissible heuristic for A* tree search. An admissible heuristic is optimistic in nature.
o Consistency: Second required condition is consistency for only A* graph-search.

If the heuristic function is admissible, then A* tree search will always find the least cost path.

Time Complexity: The time complexity of A* search algorithm depends on heuristic function,
and the number of nodes expanded is exponential to the depth of solution d. So the time
complexity is O(b^d), where b is the branching factor.

Space Complexity: The space complexity of A* search algorithm is O(b^d)

iv. Local Search Algorithm


• Local search algorithms work by keeping a single “current” state or small set
of states and iteratively trying to improve them.
• The best advantage of Local search is that we can control how much memory
we use; hence, this is a very memory-efficient strategy.
• These strategies are highly used for examples like N-Queens, VLSI layout, and
airline flight schedules.

Following are the various types of uninformed search algorithms:

Hill Climbing Algorithm :-

• Hill climbing algorithm is a local search algorithm which continuously moves in the
direction of increasing elevation/value to find the peak of the mountain or best
solution to the problem. It terminates when it reaches a peak value where no neighbor
has a higher value.
• Hill climbing algorithm is a technique which is used for optimizing the mathematical
problems. One of the widely discussed examples of Hill climbing algorithm is Traveling-
salesman Problem in which we need to minimize the distance traveled by the
salesman.
• It is also called greedy local search as it only looks to its good immediate neighbor state
and not beyond that.
• A node of hill climbing algorithm has two components which are state and value.
• Hill Climbing is mostly used when a good heuristic is available.
• In this algorithm, we don't need to maintain and handle the search tree or graph as it
only keeps a single current state.

Features of Hill Climbing:


o Generate and Test variant: Hill Climbing is the variant of Generate and Test method.
The Generate and Test method produce feedback which helps to decide which
direction to move in the search space.
o Greedy approach: Hill-climbing algorithm search moves in the direction which
optimizes the cost.
o No backtracking: It does not backtrack the search space, as it does not remember the
previous states.

Types of Hill Climbing Algorithm


a. Simple Hill Climbing:

Simple hill climbing is the simplest way to implement a hill climbing algorithm. It only
evaluates the neighbor node state at a time and selects the first one which optimizes current
cost and set it as a current state. It only checks it's one successor state, and if it finds better
than the current state, then move else be in the same state. This algorithm has the following
features:

o Less time consuming


o Less optimal solution and the solution is not guaranteed

b. Steepest-Ascent hill climbing:

The steepest-Ascent algorithm is a variation of simple hill climbing algorithm. This algorithm
examines all the neighboring nodes of the current state and selects one neighbor node which
is closest to the goal state. This algorithm consumes more time as it searches for multiple
neighbors

c. Stochastic hill climbing:

Stochastic hill climbing does not examine for all its neighbor before moving. Rather, this
search algorithm selects one neighbor node at random and decides whether to choose it as a
current state or examine another state.

Problems in Hill Climbing Algorithm:

1. Local Maximum: A local maximum is a peak state in the landscape which is better than
each of its neighboring states, but there is another state also present which is higher than the
local maximum.
Solution: Backtracking technique can be a solution of the local maximum in state space
landscape. Create a list of the promising path so that the algorithm can backtrack the search
space and explore other paths as well.

2. Plateau: A plateau is the flat area of the search space in which all the neighbor states of
the current state contains the same value, because of this algorithm does not find any best
direction to move. A hill-climbing search might be lost in the plateau area.

Solution: The solution for the plateau is to take big steps or very little steps while searching,
to solve the problem. Randomly select a state which is far away from the current state so it is
possible that the algorithm could find non-plateau region.

3. Ridges: A ridge is a special form of the local maximum. It has an area which is higher than
its surrounding areas, but itself has a slope, and cannot be reached in a single move.

Solution: With the use of bidirectional search, or by moving in different directions, we can
improve this problem.
Simulated Annealing:

A hill-climbing algorithm which never makes a move towards a lower value guaranteed to be
incomplete because it can get stuck on a local maximum. And if algorithm applies a random
walk, by moving a successor, then it may complete but not efficient. Simulated Annealing is
an algorithm which yields both efficiency and completeness.

In mechanical term Annealing is a process of hardening a metal or glass to a high temperature


then cooling gradually, so this allows the metal to reach a low-energy crystalline state. The
same process is used in simulated annealing in which the algorithm picks a random move,
instead of picking the best move. If the random move improves the state, then it follows the
same path. Otherwise, the algorithm follows the path which has a probability of less than 1
or it moves downhill and chooses another path.

Genetic Algorithm :-
• A Genetic algorithm is a local search technique used in computing to find true or
approximate solutions to optimization and state space search problems.
• This algorithm is a class of evolutionary algorithms that uses techniques like
inheritance, mutation, selection, and crossover inspired by evolutionary biology.
• The idea is taken from natural selection. i.e. Favourable traits become common and
unfavorable traits become uncommon in successive generations.
• The solution is given by the survival of the fittest(Best solution).

Understanding the terms of GA:

Individual: Any possible solution.


Population: Group of all individuals
Fitness: Each individual has a fitness value that helps determine the best solution.
Traits: Features of the individual.

Beam Search :-

• Beam search is a heuristic search algorithm that explores a graph by expanding the
most optimistic node in a limited set.
• Beam search is an optimization of best-first search that reduces its memory
requirements.
• Best-first search is a graph search that orders all partial solutions according to some
heuristic. But in beam search, only a predetermined number of best partial solutions
are kept as candidates. Therefore, it is a greedy algorithm.
• Beam search uses breadth-first search to build its search tree. The beam width can
either be fixed or variable.
• If no solution is found, the beam is widened, and the procedure is repeated.

Components of Beam Search

A beam search takes three components as its input:


1. A problem to be solved,
2. A set of heuristic rules for pruning,
3. And a memory with a limited available capacity.

Uses of Beam Search

A beam search is most often used to maintain tractability in large systems with insufficient
memory to store the entire search tree. For example,

o It has been used in many machine translation systems.


o Each part is processed to select the best translation, and many different ways of
translating the words appear.
o According to their sentence structures, the top best translations are kept, and the rest
are discarded. The translator then evaluates the translations according to a given
criterion, choosing the translation which best keeps the goals.
o The first use of a beam search was in the Harpy Speech Recognition System, CMU
1976.

Drawbacks of Beam Search

Here is a drawback of the Beam Search with an example:

o In general, the Beam Search Algorithm is not complete. Despite these disadvantages,
beam search has found success in the practical areas of speech recognition, vision,
planning, and machine learning.
o The main disadvantages of a beam search are that the search may not result in an
optimal goal and may not even reach a goal at all after given unlimited time and
memory when there is a path from the start node to the goal node.
o The beam search algorithm terminates for two cases: a required goal node is reached,
or a goal node is not reached, and there are no nodes left to be explored.
o A more accurate heuristic function and a larger beam width can improve Beam
Search's chances of finding the goal.
UNIT- III
1. Knowledge-Based Agent in Artificial intelligence :-
• An intelligent agent needs knowledge about the real world for taking decisions
and reasoning to act efficiently.
• Knowledge-based agents are those agents who have the capability of maintaining an
internal state of knowledge, reason over that knowledge, update their knowledge
after observations and take actions. These agents can represent the world with some
formal representation and act intelligently.
• Knowledge-based agents are composed of two main parts:
o Knowledge-base and
o Inference system.

A knowledge-based agent must able to do the following:

o An agent should be able to represent states, actions, etc.


o An agent Should be able to incorporate new percepts
o An agent can update the internal representation of the world
o An agent can deduce the internal representation of the world
o An agent can deduce appropriate actions.

2. The architecture of knowledge-based agent :-

The above diagram is representing a generalized architecture for a knowledge-based agent.


The knowledge-based agent (KBA) take input from the environment by perceiving the
environment. The input is taken by the inference engine of the agent and which also
communicate with KB to decide as per the knowledge store in KB. The learning element of
KBA regularly updates the KB by learning new knowledge.
Knowledge base: Knowledge-base is a central component of a knowledge-based agent, it is
also known as KB. It is a collection of sentences (here 'sentence' is a technical term and it is
not identical to sentence in English). These sentences are expressed in a language which is
called a knowledge representation language. The Knowledge-base of KBA stores fact about
the world.

➢ Why use a knowledge base?

Knowledge-base is required for updating knowledge for an agent to learn with experiences
and take action as per the knowledge.

➢ Inference system

Inference means deriving new sentences from old. Inference system allows us to add a new
sentence to the knowledge base. A sentence is a proposition about the world. Inference
system applies logical rules to the KB to deduce new information.

Inference system generates new facts so that an agent can update the KB. An inference
system works mainly in two rules which are given as:

❖ Forward chaining :- Forward chaining is also known as a forward deduction or forward


reasoning method when using an inference engine. Forward chaining is a form of
reasoning which start with atomic sentences in the knowledge base and applies inference
rules (Modus Ponens) in the forward direction to extract more data until a goal is reached.

The Forward-chaining algorithm starts from known facts, triggers all rules whose premises
are satisfied, and add their conclusion to the known facts. This process repeats until the
problem is solved.

Properties of Forward-Chaining:

o It is a down-up approach, as it moves from bottom to top.


o It is a process of making a conclusion based on known facts or data, by starting from
the initial state and reaches the goal state.
o Forward-chaining approach is also called as data-driven as we reach to the goal using
available data.
o Forward -chaining approach is commonly used in the expert system, such as CLIPS,
business, and production rule systems.

❖ Backward chaining :- Backward-chaining is also known as a backward deduction or


backward reasoning method when using an inference engine. A backward chaining
algorithm is a form of reasoning, which starts with the goal and works backward, chaining
through rules to find known facts that support the goal.

Properties of backward chaining:

o It is known as a top-down approach.


o Backward-chaining is based on modus ponens inference rule.
o In backward chaining, the goal is broken into sub-goal or sub-goals to prove the facts
true.
o It is called a goal-driven approach, as a list of goals decides which rules are selected
and used.
o Backward -chaining algorithm is used in game theory, automated theorem proving
tools, inference engines, proof assistants, and various AI applications.
o The backward-chaining method mostly used a depth-first search strategy for proof.

3. Operations Performed by KBA :-

Following are three operations which are performed by KBA in order to show the intelligent
behavior:

1. TELL: This operation tells the knowledge base what it perceives from the environment.
2. ASK: This operation asks the knowledge base what action it should perform.
3. Perform: It performs the selected action.

4. Various levels of knowledge-based agent :-

A knowledge-based agent can be viewed at different levels which are given below:

i. Knowledge level

Knowledge level is the first level of knowledge-based agent, and in this level, we need to
specify what the agent knows, and what the agent goals are. With these specifications, we
can fix its behavior. For example, suppose an automated taxi agent needs to go from a station
A to station B, and he knows the way from A to B, so this comes at the knowledge level.

ii. Logical level:

At this level, we understand that how the knowledge representation of knowledge is stored.
At this level, sentences are encoded into different logics. At the logical level, an encoding of
knowledge into logical sentences occurs. At the logical level we can expect to the automated
taxi agent to reach to the destination B.

iii. Implementation level:

This is the physical representation of logic and knowledge. At the implementation level agent
perform actions as per logical and knowledge level. At this level, an automated taxi agent
actually implement his knowledge and logic so that he can reach to the destination.
5. Knowledge Representation :-

o Knowledge representation and reasoning (KR, KRR) is the part of Artificial intelligence
which concerned with AI agents thinking and how thinking contributes to intelligent
behavior of agents.
o It is responsible for representing information about the real world so that a computer
can understand and can utilize this knowledge to solve the complex real world
problems such as diagnosis a medical condition or communicating with humans in
natural language.
o It is also a way which describes how we can represent knowledge in artificial
intelligence. Knowledge representation is not just storing data into some database,
but it also enables an intelligent machine to learn from that knowledge and
experiences so that it can behave intelligently like a human.

6. What to Represent:

Following are the kind of knowledge which needs to be represented in AI systems:

o Object: All the facts about objects in our world domain. E.g., Guitars contains strings,
trumpets are brass instruments.
o Events: Events are the actions which occur in our world.
o Performance: It describe behavior which involves knowledge about how to do things.
o Meta-knowledge: It is knowledge about what we know.
o Facts: Facts are the truths about the real world and what we represent.
o Knowledge-Base: The central component of the knowledge-based agents is the
knowledge base. It is represented as KB. The Knowledgebase is a group of the
Sentences (Here, sentences are used as a technical term and not identical with the
English language).

Knowledge: Knowledge is awareness or familiarity gained by experiences of facts, data, and


situations. Following are the types of knowledge in artificial intelligence:
7. Types of Knowledge :-

i. Declarative Knowledge:

o Declarative knowledge is to know about something.


o It includes concepts, facts, and objects.
o It is also called descriptive knowledge and expressed in declarative sentences.
o It is simpler than procedural language.

ii. Procedural Knowledge

o It is also known as imperative knowledge.


o Procedural knowledge is a type of knowledge which is responsible for knowing how to
do something.
o It can be directly applied to any task.
o It includes rules, strategies, procedures, agendas, etc.
o Procedural knowledge depends on the task on which it can be applied.

iii. Meta-knowledge:

o Knowledge about the other types of knowledge is called Meta-knowledge.


iv. Heuristic knowledge:

o Heuristic knowledge is representing knowledge of some experts in a filed or subject.


o Heuristic knowledge is rules of thumb based on previous experiences, awareness of
approaches, and which are good to work but not guaranteed.

v. Structural knowledge:

o Structural knowledge is basic knowledge to problem-solving.


o It describes relationships between various concepts such as kind of, part of, and
grouping of something.
o It describes the relationship that exists between concepts or objects.

8. Requirements for knowledge Representation system :-

A good knowledge representation system must possess the following properties.

1. 1. Representational Accuracy : KR system should have the ability to represent all kind
of required knowledge.
2. 2. Inferential Adequacy : KR system should have ability to manipulate the
representational structures to produce new knowledge corresponding to existing
structure.
3. 3. Inferential Efficiency : The ability to direct the inferential knowledge mechanism
into the most productive directions by storing appropriate guides.
4. 4. Acquisitional Efficiency : The ability to acquire the new knowledge easily using
automatic methods.

9. AI knowledge cycle:

An Artificial intelligence system has the following components for displaying intelligent
behavior:

o Perception
o Learning
o Knowledge Representation and Reasoning
o Planning
o Execution
The above diagram is showing how an AI system can interact with the real world and what
components help it to show intelligence. AI system has Perception component by which it
retrieves information from its environment. It can be visual, audio or another form of sensory
input. The learning component is responsible for learning from data captured by Perception
comportment. In the complete cycle, the main components are knowledge representation
and Reasoning. These two components are involved in showing the intelligence in machine-
like humans. These two components are independent with each other but also coupled
together. The planning and execution depend on analysis of Knowledge representation and
reasoning.

10.Approaches to knowledge representation:

There are mainly four approaches to knowledge representation, which are given below:

i. Simple relational knowledge:


o It is the simplest way of storing facts which uses the relational method, and each fact
about a set of the object is set out systematically in columns.
o This approach of knowledge representation is famous in database systems where the
relationship between different entities is represented.
o This approach has little opportunity for inference.

ii. Inheritable knowledge:


o In the inheritable knowledge approach, all data must be stored into a hierarchy of
classes.
o All classes should be arranged in a generalized form or a hierarchal manner.
o In this approach, we apply inheritance property.
o Elements inherit values from other members of a class.
o This approach contains inheritable knowledge which shows a relation between
instance and class, and it is called instance relation.
o Every individual frame can represent the collection of attributes and its value.
o In this approach, objects and values are represented in Boxed nodes.
o We use Arrows which point from objects to their values.
iii. Inferential knowledge:
o Inferential knowledge approach represents knowledge in the form of formal logics.
o This approach can be used to derive more facts.
o It guaranteed correctness.

iv. Procedural knowledge:


o Procedural knowledge approach uses small programs and codes which describes how
to do specific things, and how to proceed.
o In this approach, one important rule is used which is If-Then rule.
o In this knowledge, we can use various coding languages such as LISP
language and Prolog language.
o We can easily represent heuristic or domain-specific knowledge using this approach.
o But it is not necessary that we can represent all cases in this approach.

11.First-Order logic :-
• First-order logic is another way of knowledge representation in artificial intelligence.
It is an extension to propositional logic.
• FOL is sufficiently expressive to represent the natural language statements in a concise
way.
• First-order logic is also known as Predicate logic or First-order predicate logic. First-
order logic is a powerful language that develops information about the objects in a
more easy way and can also express the relationship between those objects.
• First-order logic (like natural language) does not only assume that the world contains
facts like propositional logic but also assumes the following things in the world:
o Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus,
o Relations: It can be unary relation such as: red, round, is adjacent, or n-any
relation such as: the sister of, brother of, has color, comes between
o Function: Father of, best friend, third inning of, end of, ......
• As a natural language, first-order logic also has three main parts:
o Syntax : Specifies the symbols in the language about how they can be
combined to form sentences. The facts about the world are represented as
sentences in logic.
o Semantics : Specifies how to assign a truth value to a sentence based on
its meaning in the world. It Specifies what facts a sentence refers to.
A fact is a claim about the world, and it may be TRUE or FALSE.
o Inference Procedure : Specifies methods for computing new sentences from
the existing sentences.
12. KR using Rules :-
• Knowledge representation using rules in AI involves expressing knowledge about
the world in the form of logical rules.
• These rules typically consist of an antecedent (also known as the condition or
premise) and a consequent (also known as the action or conclusion). They specify
conditions under which certain actions or conclusions can be inferred.
• Rules-based knowledge representation is often used in expert systems, which are
AI systems designed to mimic the decision-making capabilities of human experts
in specific domains.
• The knowledge in expert systems is encoded as a set of rules that can be applied
to solve problems or provide advice in the domain of expertise.

Let's take a simple example to illustrate rules-based knowledge representation:

Rule 1: If it is raining, then take an umbrella.

Rule 2: If it is cold and it is raining, then wear a coat.

In this example, we have two rules. Rule 1 states that if it is raining, the action to be taken
is to take an umbrella. Rule 2 states that if it is both cold and raining, the action to be
taken is to wear a coat.

To represent and utilize this knowledge, an AI system can match the conditions in the
rules with the available information or input. If the conditions are satisfied, the system
can apply the corresponding actions or draw conclusions. For instance, if the system
determines that it is both cold and raining, it can infer that wearing a coat is necessary
based on Rule 2.

Rules can be combined using logical connectives like AND, OR, and NOT to express more
complex relationships and conditions. They can also involve variables to represent
unknown or generic entities.

Rules-based knowledge representation offers a clear and intuitive way to encode and
reason with domain-specific knowledge. However, as the number of rules increases or
when rules interact in complex ways, it can become challenging to manage and reason
with the knowledge effectively. Therefore, other knowledge representation formalisms,
such as ontologies and probabilistic models, are also used in AI to address the limitations
of rules-based approaches in certain scenarios.

13. Symbolic AI :-
• Symbolic AI is an approach that trains Artificial Intelligence (AI) the same way
human brain learns.
• It learns to understand the world by forming internal symbolic representations of
its “world”.
• Symbols play a vital role in the human thought and reasoning process. We learn
both objects and abstract concepts, then create rules for dealing with these
concepts. These rules can be formalized in a way that captures everyday
knowledge.
• Symbolic AI mimics this mechanism and attempts to explicitly represent human
knowledge through human-readable symbols and rules that enable the
manipulation of those symbols.
• Symbolic AI entails embedding human knowledge and behavior rules into
computer programs.

14. Applications of Symbolic AI :-

• Siri and other digital assistants use Symbolic AI to understand natural language and provide
responses.
• Medical diagnosis systems use Symbolic AI to provide recommendations to doctors based on
patient symptoms (as demonstrated earlier).
• Autonomous cars use Symbolic AI to make decisions based on the environment, such as
recognizing stop signs and traffic lights.
• Computer vision systems use Symbolic AI to recognize objects and patterns in images.

15. Benefits of Symbolic AI :-

• Interpretability: Symbolic AI provides transparency in the reasoning process, making it easier


to understand how a system arrived at a conclusion.
• Knowledge representation: Symbolic AI can represent complex knowledge in a formal and
structured way, allowing for easy manipulation and reasoning.
• Flexibility: Symbolic AI is highly flexible and can be adapted to different domains by modifying
the rules and knowledge base.

16. Limitations of Symbolic AI :-

• Incomplete knowledge: Symbolic AI requires complete and well-defined knowledge to


function correctly. In domains where knowledge is incomplete, Symbolic AI may not be
effective.
• Scalability: Symbolic AI can become computationally expensive as the number of symbols and
rules increases, making it difficult to scale to large domains.
• Difficulty with handling uncertain or ambiguous information: Symbolic AI relies on precise
and unambiguous representations of knowledge, limiting its ability to reason effectively with
uncertain or ambiguous data.
• Limited ability to learn and adapt: Symbolic AI systems require manual programming and
may not allow for real-time learning and adaptation.
17.Symbolic Reasoning :-
• Symbolic reasoning, also known as symbolic AI or symbolic logic
• It is an approach that focuses on manipulating and reasoning about symbols or
discrete entities.
• It is based on formal logic and uses symbols to represent knowledge, rules, and
relationships.
• In symbolic reasoning, knowledge is typically represented using symbolic
languages such as predicate logic or first-order logic. These representations allow
for precise and explicit reasoning about the relationships and properties of the
symbols.
• Symbolic reasoning systems excel at tasks that require logical inference, deductive
reasoning, and rule-based decision-making.
• They are good at representing and manipulating structured knowledge but may
struggle with handling uncertainty and dealing with large amounts of data.
• Expert systems, knowledge bases, and rule-based systems are examples of
applications that employ symbolic reasoning.
18.Applications of Symbolic Reasoning :-
❖ Expert Systems: Expert systems are designed to emulate the decision-making capabilities
of human experts in specific domains. They use symbolic representations of knowledge
and rules to reason and provide advice or solutions. Expert systems have been used in
fields such as medicine, engineering, finance, and troubleshooting.

❖ Knowledge Representation and Reasoning: Symbolic reasoning is often employed in


knowledge representation and reasoning tasks. It involves representing knowledge about
a domain using symbolic languages and using logical inference to draw conclusions and
make decisions based on that knowledge. This is useful in areas like semantic web, natural
language processing, and intelligent tutoring systems.

❖ Automated Planning: Symbolic reasoning is used in automated planning systems to


generate sequences of actions to achieve specific goals or objectives. These systems
typically represent the state of the world and use symbolic representations of actions,
preconditions, and effects to reason about possible plans. Automated planning is utilized
in areas like robotics, logistics, and scheduling.

❖ Natural Language Understanding: Symbolic reasoning techniques are used in natural


language understanding tasks to interpret and extract meaning from textual data.
Symbolic representations, such as semantic networks or ontologies, are employed to
capture the semantics of words, sentences, and discourse structures. This enables
applications like question-answering systems, information extraction, and sentiment
analysis.

❖ Computer-Assisted Reasoning: Symbolic reasoning is used in computer-assisted


reasoning systems, which aim to assist humans in complex reasoning tasks. These systems
often employ formal logic and proof techniques to verify the correctness of mathematical
proofs, analyze software programs, or reason about the properties of complex systems.
❖ Legal Reasoning: Symbolic reasoning has been used in legal applications to model and
reason about legal principles, statutes, and case law. Legal expert systems utilize symbolic
representations to provide legal advice, assist in legal research, or generate legal
arguments.

19.Statistical Reasoning :-
• Statistical reasoning, also known as statistical AI or machine learning.
• It is an approach that focuses on learning patterns and making predictions from
data through statistical techniques.
• It involves the use of algorithms that can automatically learn from examples or
data without being explicitly programmed with rules.
• Statistical reasoning systems learn from training data to identify patterns,
relationships, and statistical regularities in the data.
• These systems use statistical models, such as neural networks, decision trees, or
support vector machines, to generalize from the training data and make
predictions or decisions on new, unseen data.
• Statistical reasoning is well-suited for tasks such as pattern recognition,
classification, regression, clustering, and reinforcement learning.
• It can handle large amounts of data and can capture complex patterns and
relationships, but it may lack explainability and interpretability compared to
symbolic reasoning.
20.Applications of Statistical Reasoning :-
❖ Image and Object Recognition: Statistical reasoning techniques, particularly deep
learning algorithms, have revolutionized image and object recognition tasks.
Convolutional neural networks (CNNs) are used to learn and recognize patterns,
features, and objects within images. Applications include facial recognition, object
detection, image classification, and autonomous vehicles.

❖ Natural Language Processing: Statistical reasoning techniques are used in various


natural language processing (NLP) tasks. This includes tasks such as text
classification, sentiment analysis, named entity recognition, machine translation,
and language generation. Techniques like recurrent neural networks (RNNs) and
transformers are employed to capture the statistical patterns and structures in
language data.

❖ Recommendation Systems: Statistical reasoning is used in recommendation


systems to provide personalized suggestions and recommendations to users.
Collaborative filtering and content-based filtering methods leverage statistical
techniques to analyze user behavior, preferences, and item features to generate
relevant recommendations. Examples include movie recommendations, product
recommendations, and personalized content recommendations.

❖ Speech Recognition and Synthesis: Statistical reasoning is instrumental in speech


recognition and speech synthesis applications. Hidden Markov Models (HMMs)
and deep learning-based models, such as recurrent neural networks (RNNs) and
attention-based models, are used to convert speech signals to text and vice versa.
Speech recognition is used in voice assistants, transcription services, and dictation
systems.

❖ Anomaly Detection: Statistical reasoning techniques are utilized in anomaly


detection tasks, where the goal is to identify unusual patterns or outliers in data.
Statistical models, such as Gaussian mixture models (GMMs), support vector
machines (SVMs), or autoencoders, are trained on normal data and then used to
detect deviations from the learned statistical patterns. Anomaly detection finds
applications in fraud detection, network intrusion detection, and system
monitoring.

❖ Predictive Analytics: Statistical reasoning is widely used in predictive analytics to


make predictions and forecasts based on historical data. Techniques like
regression analysis, time series analysis, and ensemble models are employed to
identify trends, patterns, and relationships in the data to make future predictions.
Applications include sales forecasting, demand prediction, stock market analysis,
and weather forecasting.
UNIT-V
1. Expert System :-
• An expert system is a computer program that is designed to solve complex
problems and to provide decision-making ability like a human expert.
• It performs this by extracting knowledge from its knowledge base using the
reasoning and inference rules according to the user queries.
• The expert system is a part of AI, and the first ES was developed in the year 1970,
which was the first successful approach of artificial intelligence.
• It solves the most complex issue as an expert by extracting the knowledge stored
in its knowledge base. The system helps in decision making for complex problems
using both facts and heuristics like a human expert.
• It is called so because it contains the expert knowledge of a specific domain and
can solve any complex problem of that particular domain. These systems are
designed for a specific domain, such as medicine, science, etc.
• The performance of an expert system is based on the expert's knowledge stored in
its knowledge base. The more knowledge stored in the KB, the more that system
improves its performance.
• One of the common examples of an ES is a suggestion of spelling errors while
typing in the Google search box.

2. Components of Expert System :-


i. User Interface
With the help of a user interface, the expert system interacts with the user, takes
queries as an input in a readable format, and passes it to the inference engine. After
getting the response from the inference engine, it displays the output to the user. In
other words, it is an interface that helps a non-expert user to communicate with the
expert system to find a solution.
ii. Inference Engine(Rules of Engine)
o The inference engine is known as the brain of the expert system as it is the main processing
unit of the system. It applies inference rules to the knowledge base to derive a conclusion or
deduce new information. It helps in deriving an error-free solution of queries asked by the
user.
o With the help of an inference engine, the system extracts the knowledge from the knowledge
base.
o There are two types of inference engine:
o Deterministic Inference engine: The conclusions drawn from this type of inference engine are
assumed to be true. It is based on facts and rules.
o Probabilistic Inference engine: This type of inference engine contains uncertainty in
conclusions, and based on the probability.

Inference engine uses the below modes to derive the solutions:

o Forward Chaining: It starts from the known facts and rules, and applies the inference rules to
add their conclusion to the known facts.

o Backward Chaining: It is a backward reasoning method that starts from the goal and works
backward to prove the known facts.

iii. Knowledge Base


o The knowledgebase is a type of storage that stores knowledge acquired from the different
experts of the particular domain. It is considered as big storage of knowledge. The more the
knowledge base, the more precise will be the Expert System.
o It is similar to a database that contains information and rules of a particular domain or subject.
o One can also view the knowledge base as collections of objects and their attributes. Such as a
Lion is an object and its attributes are it is a mammal, it is not a domestic animal, etc.

Components of Knowledge Base

o Factual Knowledge: The knowledge which is based on facts and accepted by knowledge
engineers comes under factual knowledge.
o Heuristic Knowledge: This knowledge is based on practice, the ability to guess, evaluation,
and experiences.

Knowledge Representation: It is used to formalize the knowledge stored in the knowledge


base using the If-else rules.

Knowledge Acquisitions: It is the process of extracting, organizing, and structuring the


domain knowledge, specifying the rules to acquire the knowledge from various experts, and
store that knowledge into the knowledge base.

3. Development of Expert Systems :-


The process of ES development is iterative. Steps in developing the ES include −
Identify Problem Domain
• The problem must be suitable for an expert system to solve it.
• Find the experts in task domain for the ES project.
• Establish cost-effectiveness of the system.
Design the System
• Identify the ES Technology
• Know and establish the degree of integration with the other systems and databases.
• Realize how the concepts can represent the domain knowledge best.
Develop the Prototype
From Knowledge Base: The knowledge engineer works to −
• Acquire domain knowledge from the expert.
• Represent it in the form of If-THEN-ELSE rules.
Test and Refine the Prototype
• The knowledge engineer uses sample cases to test the prototype for any deficiencies
in performance.
• End users test the prototypes of the ES.
Develop and Complete the ES
• Test and ensure the interaction of the ES with all elements of its environment,
including end users, databases, and other information systems.
• Document the ES project well.
• Train the user to use ES.
Maintain the System
• Keep the knowledge base up-to-date by regular review and update.
• Cater for new interfaces with other information systems, as those systems evolve.

4. Participants in the development of Expert System :-

There are three primary participants in the building of Expert System:

➢ Expert: The success of an ES much depends on the knowledge provided by human


experts. These experts are those persons who are specialized in that specific domain.
➢ Knowledge Engineer: Knowledge engineer is the person who gathers the knowledge
from the domain experts and then codifies that knowledge to the system according to
the formalism.
➢ End-User: This is a particular person or a group of people who may not be experts,
and working on the expert system needs the solution or advice for his queries, which
are complex.

5. Why Expert System?

❖ No memory Limitations: It can store as much data as required and can memorize it at
the time of its application. But for human experts, there are some limitations to
memorize all things at every time.
❖ High Efficiency: If the knowledge base is updated with the correct knowledge, then it
provides a highly efficient output, which may not be possible for a human.
❖ Expertise in a domain: There are lots of human experts in each domain, and they all
have different skills, different experiences, and different skills, so it is not easy to get
a final output for the query. But if we put the knowledge gained from human experts
into the expert system, then it provides an efficient output by mixing all the facts and
knowledge
❖ Not affected by emotions: These systems are not affected by human emotions such
as fatigue, anger, depression, anxiety, etc.. Hence the performance remains constant.
❖ High security: These systems provide high security to resolve any query.
❖ Considers all the facts: To respond to any query, it checks and considers all the
available facts and provides the result accordingly. But it is possible that a human
expert may not consider some facts due to any reason.
❖ Regular updates improve the performance: If there is an issue in the result provided
by the expert systems, we can improve the performance of the system by updating
the knowledge base.

6. Capabilities of the Expert System :-

o Advising: It is capable of advising the human being for the query of any domain from
the particular ES.
o Provide decision-making capabilities: It provides the capability of decision making in
any domain, such as for making any financial decision, decisions in medical science,
etc.
o Demonstrate a device: It is capable of demonstrating any new products such as its
features, specifications, how to use that product, etc.
o Problem-solving: It has problem-solving capabilities.
o Explaining a problem: It is also capable of providing a detailed description of an input
problem.
o Interpreting the input: It is capable of interpreting the input given by the user.
o Predicting results: It can be used for the prediction of a result.
o Diagnosis: An ES designed for the medical field is capable of diagnosing a disease
without using multiple components as it already contains various inbuilt medical tools.

7. Advantages of Expert System :-


o These systems are highly reproducible.
o They can be used for risky places where the human presence is not safe.
o Error possibilities are less if the KB contains correct knowledge.
o The performance of these systems remains steady as it is not affected by emotions,
tension, or fatigue.
o They provide a very high speed to respond to a particular query.

8. Limitations of Expert System :-


o The response of the expert system may get wrong if the knowledge base contains the
wrong information.
o Like a human being, it cannot produce a creative output for different scenarios.
o Its maintenance and development costs are very high.
o Knowledge acquisition for designing is much difficult.
o For each domain, we require a specific ES, which is one of the big limitations.
o It cannot learn from itself and hence requires manual updates.

9. Applications of Expert System :-


o In designing and manufacturing domain
It can be broadly used for designing and manufacturing physical devices such as
camera lenses and automobiles.
o In the knowledge domain
These systems are primarily used for publishing the relevant knowledge to the users.
The two popular ES used for this domain is an advisor and a tax advisor.
o In the finance domain
In the finance industries, it is used to detect any type of possible fraud, suspicious
activity, and advise bankers that if they should provide loans for business or not.
o In the diagnosis and troubleshooting of devices
In medical diagnosis, the ES system is used, and it was the first area where these
systems were used.
o Planning and Scheduling
The expert systems can also be used for planning and scheduling some particular
tasks for achieving the goal of that task.

10. Some popular examples of ES :-

o DENDRAL: It was an artificial intelligence project that was made as a chemical analysis
expert system. It was used in organic chemistry to detect unknown organic molecules
with the help of their mass spectra and knowledge base of chemistry.
o MYCIN: It was one of the earliest backward chaining expert systems that was designed
to find the bacteria causing infections like bacteraemia and meningitis. It was also
used for the recommendation of antibiotics and the diagnosis of blood clotting
diseases.
o PXDES: It is an expert system that is used to determine the type and level of lung
cancer. To determine the disease, it takes a picture from the upper body, which looks
like the shadow. This shadow identifies the type and degree of harm.
o CaDeT: The CaDet expert system is a diagnostic support system that can detect cancer
at early stages.

11.Characteristics of Expert System :-

o High Performance: The expert system provides high performance for solving any type
of complex problem of a specific domain with high efficiency and accuracy.
o Understandable: It responds in a way that can be easily understandable by the user.
It can take input in human language and provides the output in the same way.
o Reliable: It is much reliable for generating an efficient and accurate output.
o Highly responsive: ES provides the result for any complex query within a very short
period of time.

12.Expert System Shells :-


An Expert system shell is a software development environment. It contains the basic
components of expert systems. A shell is associated with a prescribed method for
building applications by configuring and instantiating these components.

13.Shell components and description :-

The generic components of a shell : the knowledge acquisition, the knowledge Base,
the reasoning, the explanation and the user interface are shown below. The
knowledge base and reasoning engine are the core components.
▪ Knowledge Base - A store of factual and heuristic knowledge. Expert system tool
provides one or more knowledge representation schemes for expressing
knowledge about the application domain. Some tools use both Frames (objects)
and IF-THEN rules. In PROLOG the knowledge is represented as logical statements.
▪ Reasoning Engine - Inference mechanisms for manipulating the symbolic
information and knowledge in the knowledge base form a line of reasoning in
solving a problem. The inference mechanism can range from simple modus ponens
backward chaining of IF-THEN rules to Case-Based reasoning.
▪ Knowledge Acquisition subsystem - A subsystem to help experts in build
knowledge bases. However, collecting knowledge, needed to solve problems and
build the knowledge base, is the biggest bottleneck in building expert systems.
▪ Explanation subsystem - A subsystem that explains the system's actions. The
explanation can range from how the final or intermediate solutions were arrived
at justifying the need for additional data.
▪ User Interface - A means of communication with the user. The user interface is
generally not a part of the expert system technology. It was not given much
attention in the past. However, the user interface can make a critical difference in
the pe eived utility of an Expert system.

14.Artificial Neural Network :-


• The term "Artificial Neural Network" is derived from Biological neural networks that
develop the structure of a human brain. Similar to the human brain that has neurons
interconnected to one another, artificial neural networks also have neurons that are
interconnected to one another in various layers of the networks. These neurons are
known as nodes.

The given figure illustrates the typical diagram of Biological Neural Network.

The typical Artificial Neural Network looks something like the given figure.
• Dendrites from Biological Neural Network represent inputs in Artificial Neural
Networks, cell nucleus represents Nodes, synapse represents Weights, and Axon
represents Output

15.Achitecture of an artificial neural network :-

Artificial Neural Network primarily consists of three layers:

Input Layer:As the name suggests, it accepts inputs in several different formats provided
by the programmer.
Hidden Layer:The hidden layer presents in-between input and output layers. It performs
all the calculations to find hidden features and patterns.
Output Layer:The input goes through a series of transformations using the hidden layer,
which finally results in output that is conveyed using this layer.

The artificial neural network takes input and computes the weighted sum of the inputs
and includes a bias. This computation is represented in the form of a transfer function.

It determines weighted total is passed as an input to an activation function to produce the


output. Activation functions choose whether a node should fire or not. Only those who are
fired make it to the output layer. There are distinctive activation functions available that can
be applied upon the sort of task we are performing.

16.Advantages of Artificial Neural Network (ANN) :-

❖ Parallel processing capability : Artificial neural networks have a numerical value that
can perform more than one task simultaneously.
❖ Storing data on the entire network : Data that is used in traditional programming is
stored on the whole network, not on a database. The disappearance of a couple of
pieces of data in one place doesn't prevent the network from working.
❖ Capability to work with incomplete knowledge : After ANN training, the information
may produce output even with inadequate data. The loss of performance here relies
upon the significance of missing data.
❖ Having a memory distribution : For ANN is to be able to adapt, it is important to
determine the examples and to encourage the network according to the desired
output by demonstrating these examples to the network. The succession of the
network is directly proportional to the chosen instances, and if the event can't appear
to the network in all its aspects, it can produce false output
❖ Having fault tolerance:Extortion of one or more cells of ANN does not prohibit
it from generating output, and this feature makes the network fault-tolerance.

17.Disadvantages of Artificial Neural Network :-

❖ Assurance of proper network structure : There is no particular guideline for


determining the structure of artificial neural networks. The appropriate network
structure is accomplished through experience, trial, and error.
❖ Unrecognized behavior of the network : It is the most significant issue of ANN.
When ANN produces a testing solution, it does not provide insight concerning
why and how. It decreases trust in the network.
❖ Hardware dependence : Artificial neural networks need processors with parallel
processing power, as per their structure. Therefore, the realization of the
equipment is dependent.
❖ Difficulty of showing the issue to the network : ANNs can work with numerical
data. Problems must be converted into numerical values before being
introduced to ANN. The presentation mechanism to be resolved here will
directly impact the performance of the network. It relies on the user's abilities.
❖ The duration of the network is unknown : The network is reduced to a specific
value of the error, and this value does not give us optimum results.

18. Model of Artificial Neuron :-

✓ Inputs: The neuron receives inputs from other neurons or directly from the external
environment. Each input is associated with a weight, which determines its
significance in the neuron's computation.
✓ Weights: Each input to the neuron is multiplied by a weight. The weights reflect the
strength or importance of the corresponding inputs in the neuron's computation.
These weights can be adjusted during the training process to optimize the neuron's
performance.
✓ Summation Function: The weighted inputs are summed together using a summation
function. The purpose of this function is to combine the inputs with their respective
weights.
✓ Activation Function: The summation result is then passed through an activation
function, which introduces non-linearity into the neuron's output. The activation
function helps determine whether the neuron should "fire" (produce an output
signal) based on the inputs it receives. The activation function is a critical component
of the artificial neuron model
✓ Bias: A bias term is often added to the neuron's computation. It acts as an additional
input that can shift the activation function's threshold, allowing for more flexibility in
the neuron's response.
✓ Output: The output of the neuron is the result of the activation function applied to
the weighted inputs and bias. This output is then propagated to other neurons in the
network as input.

Overall, the artificial neuron model provides a simplified representation of how individual
neurons in a neural network process inputs, apply weights, and produce outputs. When
combined in layers and interconnected, these artificial neurons form powerful neural
networks capable of learning and making predictions.

19.Types of Artificial Neural Network :

➢ Feedforward Neural Network (FNN): Also known as multilayer perceptrons (MLPs),


FNNs consist of an input layer, one or more hidden layers, and an output layer.
Information flows in one direction, from the input layer through the hidden layers to
the output layer. FNNs are effective for tasks such as classification, regression, and
pattern recognition.
➢ Convolutional Neural Network (CNN): CNNs are specifically designed for processing
grid-like data, such as images or videos. They leverage convolutional layers to
automatically learn and extract hierarchical representations of visual features. CNNs
are widely used in image classification, object detection, and image generation tasks.
➢ Recurrent Neural Network (RNN): RNNs are suited for processing sequential data,
where the order of inputs matters. They have feedback connections that allow them
to maintain memory of past inputs and utilize it for current outputs. RNNs are
commonly used in tasks such as natural language processing, speech recognition, and
time series analysis.
➢ Long Short-Term Memory (LSTM) Network: LSTMs are a specialized type of RNN that
addresses the vanishing gradient problem and can effectively learn long-term
dependencies in sequential data. LSTMs incorporate memory cells and gating
mechanisms that regulate information flow, making them particularly effective for
tasks requiring memory retention and processing of sequential data.
➢ Generative Adversarial Network (GAN): GANs consist of two neural networks, a
generator and a discriminator, trained in a competitive setting. The generator
generates realistic data samples (e.g., images) from random noise, while the
discriminator tries to distinguish between the generated samples and real ones. GANs
are used in tasks such as image synthesis, image-to-image translation, and text
generation.
➢ Autoencoder: Autoencoders are unsupervised learning models that aim to learn
compressed representations or encodings of the input data. They consist of an
encoder that maps the input to a lower-dimensional representation and a decoder
that reconstructs the original input from the encoded representation. Autoencoders
are used for data compression, denoising, and anomaly detection.
➢ Self-Organizing Map (SOM): SOMs are unsupervised learning models used for
clustering and visualization of high-dimensional data. They map the input data onto a
grid of neurons, where each neuron represents a prototype or cluster. SOMs help
identify patterns and relationships in the data and enable visual representation of
complex data distributions.

20.Applications of Neural Networks :-


They can perform tasks that are easy for a human but difficult for a machine −
• Aerospace − Autopilot aircrafts, aircraft fault detection.
• Automotive − Automobile guidance systems.
• Military − Weapon orientation and steering, target tracking, object discrimination,
facial recognition, signal/image identification.
• Electronics − Code sequence prediction, IC chip layout, chip failure analysis, machine
vision, voice synthesis.
• Financial − Real estate appraisal, loan advisor, mortgage screening, corporate bond
rating, portfolio trading program, corporate financial analysis, currency value
prediction, document readers, credit application evaluators.
• Industrial − Manufacturing process control, product design and analysis, quality
inspection systems, welding quality analysis, paper quality prediction, chemical
product design analysis, dynamic modeling of chemical process systems, machine
maintenance analysis, project bidding, planning, and management.
• Medical − Cancer cell analysis, EEG and ECG analysis, prosthetic design, transplant
time optimizer.
• Speech − Speech recognition, speech classification, text to speech conversion.
• Telecommunications − Image and data compression, automated information services,
real-time spoken language translation.
• Transportation − Truck Brake system diagnosis, vehicle scheduling, routing systems.
• Software − Pattern Recognition in facial recognition, optical character recognition, etc.
• Time Series Prediction − ANNs are used to make predictions on stocks and natural
calamities.
• Signal Processing − Neural networks can be trained to process an audio signal and filter
it appropriately in the hearing aids.
• Control − ANNs are often used to make steering decisions of physical vehicles.
• Anomaly Detection − As ANNs are expert at recognizing patterns, they can also be
trained to generate an output when something unusual occurs that misfits the pattern.
21. Learning Methods in Neural Network :-

Neural networks learn through a process called training, where they adjust their internal
parameters (weights and biases) to minimize the difference between their predicted
outputs and the desired outputs. There are several learning methods or algorithms used
in neural networks. Let's explore a few of them:

➢ Supervised Learning: In supervised learning, the neural network is trained using a


labeled dataset where both the inputs and corresponding desired outputs are
provided. The network learns by comparing its predicted outputs with the true labels
and updating its parameters accordingly. Common supervised learning algorithms
include backpropagation and its variants.
➢ Unsupervised Learning: In unsupervised learning, the neural network is trained on
unlabeled data, without explicit target outputs. The network learns to discover
patterns, structures, or relationships in the data without any predefined labels.
Clustering and dimensionality reduction techniques, such as k-means clustering and
autoencoders, are commonly used in unsupervised learning.
➢ Reinforcement Learning: In reinforcement learning, the neural network interacts with
an environment and learns to take actions that maximize a cumulative reward signal.
The network receives feedback in the form of rewards or penalties based on its
actions, enabling it to learn through trial and error. Reinforcement learning
algorithms, such as Q-learning and policy gradients, are commonly used in this
context.
➢ Transfer Learning: Transfer learning involves leveraging knowledge gained from
training on one task to improve performance on a related but different task. The
neural network is initially trained on a large dataset or a complex task, and then the
learned representations or parameters are transferred to a new network for a
different task or a smaller dataset. This approach is particularly useful when there is
limited labeled data for the target task.
➢ Online Learning: Online learning, also known as incremental learning, involves
updating the neural network's parameters continuously as new data becomes
available. The network adapts and learns from each new data point, allowing it to
handle evolving or streaming data. This learning method is commonly used in
applications where the data distribution or patterns change over time.

22.Characteristics of neural network :-

➢ Non-linearity: Neural networks are capable of capturing and modeling non-linear


relationships between inputs and outputs. This is achieved through the use of non-
linear activation functions, allowing them to learn and represent complex patterns
and mappings in data.
➢ Parallel Processing: Neural networks are inherently parallel computing systems.
The computations within individual neurons and across multiple neurons in a layer
can be performed simultaneously. This parallel processing enables efficient
computation and makes neural networks suitable for tasks that involve large-scale
data processing.
➢ Adaptability and Learning: Neural networks are adaptive systems that can learn
from examples and improve their performance over time. By adjusting their
internal parameters (weights and biases) through the learning process, neural
networks can adapt to different data distributions, generalize from training data
to unseen examples, and continually refine their predictions.
➢ Fault Tolerance and Robustness: Neural networks exhibit a degree of fault
tolerance and robustness. Due to their distributed nature, neural networks can
continue to function and provide reasonable outputs even if individual neurons or
connections are damaged or missing. This property enhances their reliability in
real-world scenarios where data may be noisy or incomplete.
➢ Feature Extraction and Representation Learning: Neural networks can
automatically learn and extract relevant features from raw input data. Instead of
relying on manual feature engineering, neural networks can learn hierarchical
representations of data, enabling them to automatically discover and represent
meaningful features at different levels of abstraction.
➢ Scalability: Neural networks can be scaled up to handle large and complex
datasets. By adding more neurons, layers, or utilizing specialized architectures
(e.g., deep neural networks), they can handle increasing amounts of data and learn
intricate relationships within the data.
➢ Generalization: Neural networks have the ability to generalize their learned
knowledge to unseen examples. Through the learning process, neural networks
can capture underlying patterns and regularities in the training data, allowing
them to make accurate predictions on new, unseen data points.
➢ Interpretability Challenges: While neural networks offer powerful predictive
capabilities, their internal workings can be challenging to interpret. The complex
interplay of numerous parameters and the black-box nature of some architectures
can make it difficult to understand how and why the network arrives at a particular
prediction. This interpretability challenge is an active area of research in neural
network development.

23.Single Layered Neural Network :-


• A single-layered neural network often called perceptrons. It is a type of feed-forward
neural network made up of input and output layers. Inputs provided are multi-
dimensional.

• Perceptrons are acyclic in nature. The sum of the product of weights and the inputs
is calculated in each node.

• The input layer transmits the signals to the output layer. The output layer performs
computations.

• Perceptron can learn only a linear function and requires less training output.
• The output can be represented in one or two values(0 or 1).
Advantages of Single-layered Neural Network
• Single layer neural networks are easy to set up and train them as there is absence of
hidden layers
• It has explicit links to statistical models
Disadvantages of Single-layered Neural Network
• It can work better only for linearly separable data.
• Single layer neural network has low accuracy as compared to multi-layer neural
network.

24.Genetic Algorithm :-
• A genetic algorithm is an adaptive heuristic search algorithm inspired by "Darwin's
theory of evolution in Nature." It is used to solve optimization problems in machine
learning.
• It is one of the important algorithms as it helps solve complex problems that would
take a long time to solve. Genetic algorithms are based on the ideas of natural
selection and genetics.
• They are commonly used to generate high-quality solutions for optimization
problems and search problems.
• Genetic algorithms simulate the process of natural selection which means those
species who can adapt to changes in their environment are able to survive and
reproduce and go to next generation. In simple words, they simulate “survival of the
fittest” among individual of consecutive generation for solving a problem.

25.Encoding
• In a genetic algorithm (GA), encoding refers to the representation of candidate
solutions or individuals in a problem space.
• It involves encoding the problem variables or characteristics into a format that can
be manipulated and evolved through genetic operations such as crossover and
mutation.

26.Encoding Methods :-
The choice of encoding scheme greatly influences the performance and efficiency of
a genetic algorithm. Here are a few common encoding methods used in genetic
algorithms:
➢ Binary Encoding: Binary encoding represents each variable or attribute of an
individual as a string of binary bits. Each bit in the string corresponds to a specific
attribute or gene. This encoding is useful for problems with discrete or Boolean
variables.
➢ Integer Encoding: Integer encoding represents each variable as an integer value
within a predefined range. The range of integers represents the possible values that
the variable can take. This encoding is suitable for problems with discrete or integer
variables.
➢ Real-Valued Encoding: Real-valued encoding represents each variable as a floating-
point or real number within a predefined range. The range of real values represents
the possible values that the variable can take. This encoding is suitable for problems
with continuous variables.
➢ Permutation Encoding: Permutation encoding is used for problems involving
permutations, such as the traveling salesman problem. Each individual is
represented as a sequence of integers, where each integer represents a unique
element or position.
➢ Tree Encoding: Tree encoding is used when the solution structure is best
represented as a tree or hierarchical structure. Each individual is encoded as a tree,
with nodes representing different components or attributes of the solution.

Once the encoding is defined, the genetic algorithm can operate on the encoded individuals
by applying genetic operators like crossover (recombination) and mutation. These
operators manipulate the encoded representations to create new individuals and generate
diversity in the population, enabling the algorithm to search for optimal or near-optimal
solutions to the problem at hand.

27.Operators of Genetic Algorithms :-Once the initial generation is created, the


algorithm evolves the generation using following operators –

✓ Selection Operator: The idea is to give preference to the individuals with


good fitness scores and allow them to pass their genes to successive
generations.
✓ Crossover Operator: This represents mating between individuals. Two
individuals are selected using selection operator and crossover sites are
chosen randomly. Then the genes at these crossover sites are exchanged thus
creating a completely new individual (offspring).

Eg.
✓ Mutation Operator: The key idea is to insert random genes in offspring to
maintain the diversity in the population to avoid premature convergence.
For example –
28.Basic genetic algorithms :-
• Basic genetic algorithms (GAs) are a class of optimization algorithms inspired by the
process of natural selection and evolution.
• They mimic the process of natural evolution to search for optimal or near-optimal
solutions to a given problem.

Here are the basic steps involved in a genetic algorithm:

❖ Initialization: The algorithm starts by creating an initial population of potential


solutions (individuals). The individuals are typically randomly generated or initialized
within the problem space.

❖ Evaluation: Each individual in the population is evaluated and assigned a fitness


value based on how well it solves the problem. The fitness value represents the
quality or suitability of the individual as a solution.

❖ Selection: Individuals are selected from the population based on their fitness values.
The selection process is typically biased towards individuals with higher fitness,
allowing them to have a higher chance of being chosen for reproduction.

❖ Reproduction: The selected individuals are used to create offspring for the next
generation. This is done through genetic operators such as crossover and mutation.
Crossover involves combining genetic material from two parent individuals to create
new individuals, while mutation introduces random changes in the genetic material.

❖ Replacement: The new offspring replace a portion of the existing population. The
specific replacement strategy can vary, such as replacing the least fit individuals or
using elitism to preserve the best individuals from the previous generation.

❖ Termination: The algorithm iterates through the steps of selection, reproduction,


and replacement for multiple generations until a termination criterion is met. The
termination criterion can be a maximum number of generations, reaching a desired
fitness threshold, or other conditions specific to the problem.

❖ Solution Extraction: Once the termination condition is met, the algorithm returns
the best individual(s) found during the optimization process as the solution(s) to the
problem.
29.How Genetic Algorithm Work?
1. Initialization : The process of a genetic algorithm starts by generating the set of individuals,
which is called population. Here each individual is the solution for the given problem. An
individual contains or is characterized by a set of parameters called Genes. Genes are
combined into a string and generate chromosomes, which is the solution to the problem. One
of the most popular techniques for initialization is the use of random binary strings.

2. Fitness Assignment : Fitness function is used to determine how fit an individual is? It means
the ability of an individual to compete with other individuals. In every iteration, individuals
are evaluated based on their fitness function. The fitness function provides a fitness score to
each individual. This score further determines the probability of being selected for
reproduction. The high the fitness score, the more chances of getting selected for
reproduction.
3. Selection : The selection phase involves the selection of individuals for the reproduction of
offspring. All the selected individuals are then arranged in a pair of two to increase
reproduction. Then these individuals transfer their genes to the next generation.

There are three types of Selection methods available, which are:

o Roulette wheel selection


o Tournament selection
o Rank-based selection

4. Reproduction : After the selection process, the creation of a child occurs in the
reproduction step. In this step, the genetic algorithm uses two variation operators that are
applied to the parent population. The two operators involved in the reproduction phase are
given below:
o Crossover: The crossover plays a most significant role in the reproduction phase of
the genetic algorithm. In this process, a crossover point is selected at random within
the genes. Then the crossover operator swaps genetic information of two parents
from the current generation to produce a new individual representing the offspring.
The genes of parents are exchanged among themselves until the crossover point is
met. These newly generated offspring are added to the population. This process is
also called or crossover. Types of crossover styles available:
o One point crossover
o Two-point crossover
o Livery crossover
o Inheritable Algorithms crossover
o Mutation
The mutation operator inserts random genes in the offspring (new child) to maintain
the diversity in the population. It can be done by flipping some bits in the
chromosomes.
Mutation helps in solving the issue of premature convergence and enhances
diversification. The below image shows the mutation process:
Types of mutation styles available,
o Flip bit mutation
o Gaussian mutation
o Exchange/Swap mutation

5. Termination : After the reproduction phase, a stopping criterion is applied as a base for
termination. The algorithm terminates after the threshold fitness solution is reached. It will
identify the final solution as the best solution in the population.

30.Advantages of Genetic Algorithm :-


o The parallel capabilities of genetic algorithms are best.
o It helps in optimizing various problems such as discrete functions, multi-objective
problems, and continuous functions.
o It provides a solution for a problem that improves over time.
o A genetic algorithm does not need derivative information.

31.Limitations of Genetic Algorithms :-


o Genetic algorithms are not efficient algorithms for solving simple problems.
o It does not guarantee the quality of the final solution to a problem.
o Repetitive calculation of fitness values may generate some computational challenges.

You might also like