Module 1 Aiml
Module 1 Aiml
Work Economy
Medicine
Mobility
What is Artificial Intelligence?
* In today's world, technology is growing very fast, and we are getting in touch with
different new technologies day by day.
* The Artificial Intelligence is now all around us. It is currently working with a variety
of subfields, ranging from general to specific, such as self-driving cars, playing chess,
proving theorems, playing music, etc.
What is Artificial Intelligence?
* Artificial Intelligence exists when a machine can have human based skills such as
learning, reasoning, and solving problems.
Why Artificial Intelligence?
* Before Learning about Artificial Intelligence, we should know that what is the
importance of AI and why should we learn it. Following are some main reasons
to learn about AI:
* With the help of AI, you can create software or devices which can solve real-
world problems very easily and with accuracy such as health issues, marketing,
traffic issues, etc.
* Withthe help of AI, you can create your personal virtual Assistant, such as
Google Assistant, Siri, etc.
Why Artificial Intelligence?
* With the help of AI, you can build such Robots which can work in an
environment where survival of humans can be at risk.
* AI opens a path for other new technologies, new devices, and new
Opportunities.
Applications of AI
But, What is AI ?
AI can be broadly defined as technology that can learn and
produce intelligent behavior
Input Output
An AI
Pixels: Process “Tuberculosis”
But, What is AI ?
AI can be broadly defined as technology that can learn and
produce intelligent behavior
Input Output
Input Output
Audio Clip: An AI Process “I feel some eye pain”
Speech Recognition
Artificial Intelligence
- 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."
- Enables the machine to think and perform task without any human intervention
- Search based AI
- Statistics based AI
- Using previous history when the computer works -> Machine Learning
Machine Learning is said as a subset of artificial intelligence that is mainly concerned with the development of algorithms which allow a
computer to learn from the data and past experiences on their own. The term machine learning was first introduced by Arthur
Samuel in 1959. We can define it in a summarized way as:
A machine has the ability to learn if it can improve its performance by gaining more data.
1. Supervised learning
2. Unsupervised learning
3. Reinforcement learning
• Supervised learning is a type of machine learning method in which we provide sample of labeled data to the machine learning
system in order to train it, and on that basis, it predicts the output.
• The system creates a model using labeled data to understand the datasets and learn about each data, once the training and
processing are done then we test the model by providing a sample data to check whether it is predicting the exact output or not.
• The goal of supervised learning is to map input data with the output data.
• The supervised learning is based on supervision, and it is the same as when a student learns things in the supervision of the
• Unsupervised learning is a learning method in which a machine learns without any supervision.
• The training is provided to the machine with the set of data that has not been labeled, classified, or categorized, and the algorithm
• The goal of unsupervised learning is to restructure the input data into new features or a group of objects with similar patterns.
• In unsupervised learning, we don't have a predetermined result. The machine tries to find useful insights from the huge amount
of data.
• Reinforcement learning is a feedback-based learning method, in which a learning agent gets a reward for each right action
• The agent learns automatically with these feedbacks and improves its performance. In reinforcement learning, the agent
• The goal of an agent is to get the most reward points, and hence, it improves its performance.
• The robotic dog, which automatically learns the movement of his arms, is an example of Reinforcement learning.
Other Examples:
– Credit assignment problem
– Game playing
– Robotics
– Balance a pole on your hand
Some of the common reinforcement learning algorithms:
1.Q-Learning: Q-Learning is a model-free RL algorithm that learns an action-value function called Q-function. It uses a table or a function
[Link] Q-Network (DQN): DQN is an extension of Q-Learning that uses deep neural networks to estimate the Q-function. It can handle high-
dimensional state spaces and has been successfully applied to complex tasks in Atari games.
[Link] Gradient Methods: Policy gradient methods directly learn a parameterized policy that maps states to actions. They use gradient
ascent to update the policy parameters based on the expected cumulative rewards.
[Link] Policy Optimization (PPO): PPO is a policy optimization algorithm that iteratively updates a policy by maximizing a surrogate
objective function. It aims to strike a balance between policy updates and avoiding large policy changes.
[Link] Deterministic Policy Gradient (DDPG): DDPG is an algorithm that combines deep neural networks with deterministic policy gradient
Computer Science
AI ML DL Statistical tool to learn from data, like; clustering algo, binary classification etc.
What is AI? (Cont’d)
What’s easy and what’s hard?
• It’s been easier to mechanize many of the high level cognitive tasks we usually
associate with “intelligence” in people
– e. g., symbolic integration, proving theorems, playing chess, some aspect of
medical diagnosis, etc.
• It’s been very hard to mechanize tasks that animals can do easily
– walking around without running into things
– catching prey and avoiding predators
– interpreting complex sensory information (visual, aural, …)
– modeling the internal states of other animals from their behavior
– working as a team (ants, bees)
• Why are some complex problems (e.g., solving differential equations, database
operations) are not subjects of AI?
History of AI
• AI has roots in a number of scientific disciplines
– computer science and engineering (hardware and software)
– philosophy (rules of reasoning)
– mathematics (logic, algorithms, optimization)
– cognitive science and psychology (modeling high level human/animal thinking)
– neural science (model low level human/animal brain activity)
– linguistics
• The birth of AI (1943 – 1956)
– McCulloch and Pitts (1943): simplified mathematical model of neurons (resting/firing
states) can realize all propositional logic primitives (can compute all Turing computable
functions)
– Alan Turing: Turing machine and Turing test (1950)
– Claude Shannon: information theory; possibility of chess playing computers
– Boole, Aristotle, Euclid (logics, syllogisms)
• Early enthusiasm (1952 – 1969)
– 1956 Dartmouth conference
John McCarthy (Lisp);
Marvin Minsky (first neural network machine);
Alan Newell and Herbert Simon (GPS);
– Emphasis on intelligent general problem solving
GSP (means-ends analysis);
Lisp (AI programming language);
Resolution by John Robinson (basis for automatic theorem proving);
heuristic search (A*, AO*, game tree search)
• Emphasis on knowledge (1966 – 1974)
– domain specific knowledge is the key to overcome existing difficulties
– knowledge representation (KR) paradigms
– declarative vs. procedural representation
• Knowledge-based systems (1969 – 1999)
– DENDRAL: the first knowledge intensive system (determining 3D structures of complex
chemical compounds)
– MYCIN: first rule-based expert system (containing 450 rules for diagnosing blood
infectious diseases)
EMYCIN: an ES shell
– PROSPECTOR: first knowledge-based system that made significant profit (geological
ES for mineral deposits)
• AI became an industry (1980 – 1989)
– wide applications in various domains
– commercially available tools
– AI winter
• Current trends (1990 – present)
– more realistic goals
– more practical (application oriented)
– distributed AI and intelligent software agents
– resurgence of natural computation - neural networks and emergence of genetic
algorithms – many applications
– dominance of machine learning (big apps)
Agents in Artificial Intelligence
An AI system can be defined as the study of the rational agent and its environment. The
agents sense the environment through sensors and act on their environment through actuators.
An AI agent can have mental properties such as knowledge, belief, intention, etc.
What is an Agent?
An agent can be anything that perceives the 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:-
• Human-Agent: A human agent has eyes, ears, and other organs which work for sensors and
hand, legs, vocal tract work for actuators.
• Robotic Agent: A robotic agent can have cameras, infrared range finder, NLP for sensors
and various motors for actuators.
• Software Agent: Software agent can have keystrokes, file contents as sensory input and act
on those inputs and display output on the screen.
Agents in Artificial Intelligence
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.
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.
Agents in Artificial Intelligence
Effectors: Effectors are the devices which affect the environment. Effectors
can be legs, wheels, arms, fingers, wings, fins, and display screen.
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:
f:P* → A
Here performance measure is the objective for the success of an agent's behavior.
PEAS for self-driving cars:
Performance
Agent Environment Actuator Sensor
Measure
• Healthy
Patient • Hospital • Prescription, • Symptoms
Medical
• Minimized • Doctors Diagnosis, • Patient’s
Diagnosis
Cost • Patients • Scan report response
Example of Agents with their PEAS
representation
Performance
Agent Environment Actuator Sensor
Measure
Classroom,
Subject • Maximize Desk, Chair, Smart displays, Eyes, Ears,
Tutoring scores Board, Staff, Corrections Notebooks
Students
Example of Agents with their PEAS
representation
Performance
Agent Environment Actuator Sensor
Measure
Vacuum • Cleanness • Room • Wheels • Camera
Cleaner • Efficiency • Table • Brushes • Dirt detection
• Battery life • Wood floor • Vacuum sensor
• Security • Carpet Extractor • Cliff sensor
• Various • Bump Sensor
obstacles • Infrared Wall
Sensor
PEAS Examples
Intelligent Agents:
* An intelligent agent is an autonomous entity which act upon an environment using
sensors and actuators for achieving goals. An intelligent agent may learn from the
environment to achieve their goals. A thermostat is an example of an intelligent agent.
* All these agents can improve their performance and generate better action over the time.
These are given below:
* Simple Reflex Agent
* Goal-based agents
* Utility-based agent
* Learning agent
Types of AI Agents
1. Simple Reflex agent:
* The Simple reflex agents are the simplest agents. These agents take decisions based on the
current percepts and ignore the rest of the past history.
* 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.
1. Simple Reflex agent:
* These agents have the model, "which is knowledge of the world" and based on the model they perform
actions.
* The knowledge of the current state environment is not always sufficient to decide for
an agent to what to do.
* Their every action is intended to minimize their distance from the goal.
* This agent is more flexible and the agent develops the decision making skill by
choosing the right from the various option available.
* 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.
* Utility-based agent act based not only goals but also the best way to achieve the goal.
* 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.
* The utility function maps each state to a real number to check how efficiently each action
achieves the goals.
* Critic: Learning element takes feedback from critic which describes that how well the agent is doing with
respect to a fixed performance standard
* Problem generator: This component is responsible for suggesting actions that will lead to new and
informative experiences
5. Learning Agents
* Hence, learning agents are able to learn, analyze performance, and look for new ways to
improve the performance.
Rational Agents
An agent should strive to "do the right thing", based on what:
The right action is the one that will cause the agent to be most successful
• Rationality is distinct from omniscience (“all knowing”). We can behave rationally even when faced
with incomplete information.
• For each possible percept sequence, a rational agent should select an action that maximizes its
performance measure (in expectation) given the evidence provided by the percept sequence and
whatever built- in knowledge the agent has.
Rational Agents
In AI, rational agents are closely related to intelligent agents or autonomous programs that mimic
human intelligence.
Rational Agents
• Performance measures of a vacuum-cleaner agent: amount of dirt cleaned up, amount of time
taken, amount of electricity consumed, level of noise generated, etc.
• Performance measures self-driving car: time to reach destination (minimize), safety, predictability
of behavior for other agents, reliability, etc.
In a fully observable, deterministic environment, the agent need not deal with uncertainty.
3) Episodic / Sequential
5) Discrete / Continuous
○ If the number of distinct percepts and actions is limited, the environment
is discrete, otherwise it is continuous.
6) Single agent / Multi-agent
• Whenever these agents fail to operate in an environment where the state of mapping is too large
and not easily performed by the agent, then the stated problem dissolves and sent to a problem-
solving domain which breaks the large stored problem into the smaller storage area and resolves
one by one. The final integrated action will be the desired outcomes.
• The problem-solving agent performs precisely by defining problems and several solutions. So we
can say that problem solving is a part of artificial intelligence that encompasses a number of
• We can also say that a problem-solving agent is a result-driven agent and always focuses on
Steps problem-solving in AI: The problem of AI is directly associated with the nature of humans and their
activities. So we need a number of finite steps to solve a problem which makes human easy works.
Initial State: This state requires an initial state for the problem which starts the AI agent towards a
specified goal. In this state new methods also initialize problem domain solving by a specific class.
Action: This stage of problem formulation works with function with a specific class taken from the initial
Transition: This stage of problem formulation integrates the actual action done by the previous action
stage and collects the final stage to forward it to their next stage.
Goal test: This stage determines that the specified goal achieved by the integrated transition model or
not, whenever the goal achieves stop the action and forward into the next stage to determines the cost to
Path costing: This component of problem-solving numerical assigned what will be the cost to achieve
the goal. It requires all hardware software and human working cost.
Problem Solving -Toy Problem – Vacuum World Problem
• There are two dirty square blocks and we need to clean these dirty square blocks by
using vacuum cleaner. (Agent)
• Percepts : Location (eg, left or right) and content e.g. (Dirty or not)
• 3. Suck (S)
• 4. No Operation (NoOp)
Vacuum World Problem…
Initial State:
• Vacuum Agent can be in any states (Left or Right) shown in the picture.
Successor function:
• Successor function generates legal states resulting from applying the three actions {Left, Right, and Suck}
• The states space is shown in the picture, there are 8 world states (23 ) two state and three action.
Goal test:
Path cost:
• Each step costs 1, so the path cost is the sum of steps in the path from Initial state to goal state.
Path cost is 3 in our problem.
Toy Problem – 8 Puzzle Problem
• It consists of 3 x 3 board with 8 numbered tiles and a blank space.
• A tile adjacent to the blank space can slide into the blank space.
Initial State:
• Any state can be initial, (no fixed state for initial state)(Initial state)
Successor Function:
• Generates legal states that result from trying the four actions to move the blank
Goal Test:
Path Cost:
• Each step costs 1, so the path cost is the number of steps in the path.
•
•
N-Queens Problem
N - Queens problem is to place n - queens in such a manner on an n x n chessboard that no queens attack
each other by being in the same row, column or diagonal.
It can be seen that for n =1, the problem has a trivial solution, and no solution exists for n =2 and n =3. So
first we will consider the 4 queens problem and then generate it to n - queens problem.
Given a 4 x 4 chessboard and number the rows and column of the chessboard 1 through 4.