2
CHAPTER-ONE
Introduction to Artificial Intelligence
3
1.1 Goals of AI
❑The goal of Artificial Intelligence is to create intelligent
machines.
4
1.2 What is AI?
• Intelligence:
✓ Intelligence is the capability of observing, learning,
remembering & reasoning.
✓Intelligence is not to make no mistakes but quickly to
understand how to make them good.
Characteristics of Intelligent system
5
✓ Use vast amount of knowledge.
✓ Learn from experience and adopt to changing environment.
✓ Interact with human using language and speech.
✓ Respond in real time.
✓ Tolerate error and ambiguity in communication.
What Is Artificial Intelligence ?
6
✓ The science of making computers intelligent
✓ The study of ideas that enable computers to be intelligent.
✓ Attempts to develop intelligent agents.
✓ The concern of AI :- to develop computer based system that
behave like human and emulate the reasoning power of humans
Approaches to AI – making computer:
1. Think like a human: The Cognitive Modeling
7
❑ Reasons like humans do
✓ Programs that behave like humans
❑ Requires understanding of the internal activities of the brain.
2. Act like a human: The Turing Test
8
❑ Can machines act like human do? Can machines behave intelligently?
❑ Turing Test: Operational test for intelligent behavior
✓ Do experiments on the ability to achieve human-level performance.
✓ Acting like humans requires AI programs to interact with people.
❑Major components of AI: knowledge, reasoning, language
understanding, learning.
3. Think rationally: The Laws of Thought
9
❑ A system is rational if it thinks the right thing through correct reasoning.
❑ Aristotle: provided the correct arguments/ thought structures that
always gave correct conclusions given correct premises.
✓ Abebe is a man; all men are mortal; therefore Abebe is mortal
✓ These Laws of thought governed the operation of the mind and initiated the field of
Logic.
4. Acting rationally: The rational agent Approach
10
❑Doing the right thing:
❑AI is the study and construction of rational agents.
❑ Rational action requires the ability to represent knowledge and
reason with it so as to reach good decision.
11
Why AI?
"AI can have two purposes”
✓Use the power of computers to augment human thinking,
- just as we use motors to augment human or horse power.
- Robotics and expert systems are major branches of that.
✓To understand how humans think in a humanoid way.
12
Applications of AI
Solving problems that required thinking by humans:
• Playing games (chess, checker, cards, ...)
• Proving theorems (mathematical theorems, laws of physics, …)
• Classification of text (Politics, Economic, Social, Sports, etc.,)
• Information filtering and summarization of text
• Writing story and poems, solving puzzles
• Giving advice in Medical diagnosis, Equipment repair, Computer configuration and
Financial planning.
How to make computers act like humans?
13
The following sub-fields are emerged
✓ Natural Language processing: (enable computers
communicate in human language, English, Amharic, ..)
✓ Knowledge representation:
✓ Automated reasoning: (use stored information to answer
questions and to draw new conclusions)
14
Con’t…
✓ Machine learning: (adapt to new circumstances and accumulate
knowledge)
✓ Computer vision: (recognize objects based on patterns in the same
way as the human visual system does)
✓Robotics: (produce mechanical device capable of controlled motion with the
ability to move, see, hear, and accordingly take actions in the world, possibly
responding to new perceptions)
History of AI
15
• Maturation of Artificial Intelligence (1943-1952)
➢ 1943: The first work (AI ) was done by Warren McCulloch and Walter pits in 1943.
They proposed a model of artificial neurons.
➢ 1949: Donald Hebb demonstrated an updating rule for modifying the connection
strength between neurons. His rule is now called Hebbian learning.
➢ 1950: The Alan Turing who was an English mathematician and pioneered Machine
learning in 1950.
16
Cont’d…
• The birth of Artificial Intelligence (1952-1956)
➢ 1955: Allen Newell and Herbert A. Simon created the "first artificial intelligence program"
Which was named "Logic Theorist".
This program had proved 38 of 52 Mathematics theorems.
➢ 1956: The word "Artificial Intelligence" first adopted by American Computer scientist John
McCarthy at the Dartmouth Conference.
• FORTRAN, LISP, or COBOL were invented
17
Cont’d…
• The golden years-Early enthusiasm (1956-1974)
➢ 1966: The researchers emphasized developing algorithms that can solve mathematical problems.
➢ 1972: The first intelligent humanoid robot was built in Japan which was named WABOT-1
• The first AI winter (1974-1980)
➢ The time period where computer scientists dealt with a severe shortage of funding from the
government for AI researches.
➢ During AI winters, an interest in publicity on artificial intelligence was decreased
18
Cont’d…
• A boom of AI (1980-1987)
▪ 1980: AI came back with "Expert System".
▪ 1980, the first national conference of the American Association AI was held at Stanford University.
• The second AI winter (1987-1993)
▪ Again, Investors and government stopped in funding for AI research due to high cost but not efficient
results.
▪ The expert system such as XCON was very cost-effective.
19
Cont’d…
• The emergence of intelligent agents (1993-2011)
➢1997: IBM Deep Blue beats world chess champion, Gary Kasparov, became the first
computer to beat a world chess champion.
➢2002: for the first time, AI entered the home in the form of Roomba, a vacuum cleaner
➢ 2006: AI came into the Business world.
➢ Companies like Facebook, Twitter, and Netflix also started using AI.
20
Cont’d…
• Deep learning, big data and artificial general intelligence (2011-present)
➢ 2011: IBM's Watson won jeopardy, a quiz show, where it had to solve complex questions as well
as riddles. .
➢ 2012: Google has launched an Android app feature "Google now", which was able to provide
information to the user as a prediction.
➢ 2014: Chatbot "Eugene Goostman" won a competition in the infamous "Turing test."
CHAPTER : 2
Intelligent Agents
21
22
Agents and Environments
• An agent: is anything that can be viewed as perceiving its environment
through sensors and acting upon that environment through
actuators/effectors.
Figure 1:Agents interact with environments through sensors and effectors.
23
Con’t…
• A human agent: has eyes, ears, and other organs for sensors and hands,
legs, vocal tract, and so on for actuators.
• A robotic agent: might have cameras and infrared range finders for
sensors and various motors for actuators.
• A software agent:
24
Intelligent agents
• An intelligent agent: is a system that perceives its environment,
learns from it, and interacts with it intelligently.
• Intelligent agents can be divided into two broad categories:
software agents and physical agents.
25
Software agent
• A software agent is a set of programs that are designed
to do particular tasks.
• For example, a software agent is a search engine used to
search the World Wide Web and find sites that can
provide information about a requested subject.
26
Physical agent
• A physical agent (robot) is a programmable system that can be
used to perform a variety of tasks.
• Simple robots can be used in manufacturing to do routine
jobs such as assembling, welding, or painting.
• Some organizations use mobile robots that do routine delivery
jobs such as distributing mail or correspondence to different
rooms.
Acting of Intelligent Agents (Rationality)
27
• An agent should strive to "do the right thing", based on
what it can perceive and the actions it can perform.
• The right action is the one that will cause the agent to be
most successful.
• Performance measure: An objective criterion for success of
an agent's behavior.
28
Con’t…
• E.g. performance measure of a vacuum-cleaner agent could be
amount of dirt cleaned up, amount of time taken, amount of
electricity consumed, amount of noise generated, etc.
• Rational Agent: For each possible percept sequence, a rational agent
should select an action that is expected to maximize its performance
measure, given the evidence provided by the percept sequence and
whatever built-in knowledge the agent has.
29
Con’t…
• An agent is autonomous if its behavior is determined by its
own experience (with ability to learn and adapt)
30
Con’t…
• In summary what is rational at any given point depends on
PEAS (Performance measure, Environment, Actuators,
Sensors) framework.
• Performance measure
• The performance measure that defines degrees of
success of the agent
31
Con’t…
• Environment
• Knowledge: What an agent already knows about the environment
• Actuators – generating actions
• The actions that the agent can perform back to the environment
• Sensors – receiving percepts
• Perception: Everything that the agent has perceived so far
concerning the current scenario in the environment
Example: PEAS
32
• Consider the task of designing an automated taxi driver agent:
✓ Performance measure: Safe, fast, legal, comfortable trip, maximize
profits.
✓ Environment: Roads, other traffic, pedestrians, customers
✓ Actuators: Artificial legs & hands, Speaker
✓ Sensors: Cameras, GPS, engine sensors, recorder (microphone)
✓Goal: driving safely from source to destination point
Structure of agents
33
• Agent = architecture + program
• Architecture = some sort of computing device (sensors + actuators)
• (Agent) Program = some function that implements the agent
mapping.
• Agent Program = Job of AI
34
Types of agent programs
1. Simple Reflex Agents
2. Model-Based Reflex Agent
3. Goal based agents
4. Utility based agents
5. Learning Agents
1. Simple Reflex Agents
35
• It works by finding a rule whose condition matches the current situation (as
defined by the percept) and then doing the action associated with that rule.
• These agents select actions on the basis of the current percept, ignoring the
rest of the percept history.
• It uses just condition-action rules
• The rules are like the form “if … then …”
• Because knowledge sometimes cannot be stated explicitly
• Work only
• if the environment is fully observable
36
Con’t…
Example: Automated taxi driving agent.
• If the car in front brakes and its brake lights on, then you should notice this
and initiate braking. This can be written as condition-action rule:
• If car-in-front-is-braking then initiate-braking;
• Humans also have many such connections, some of which are learned
responses (as for driving) and some of which are innate reflexes (such as
blinking when something approaches the eye).
2. Model-Based Reflex Agent
37
• These agents have the model, "which is knowledge of the world" and based on
the model they perform actions.
• It works by finding a rule whose condition matches the current situation/state.
3. Goal based agents
38
• Knowing something about the current state of the environment is not always
enough to decide what to do.
• Example: At a road junction, the taxi can turn left, turn right, or go straight on.
The correct decision depends on where the taxi is trying to get it.
• The goal is another issue to achieve
✓ Judgment of rationality / correctness
39
Con’t…
• Conclusion
• Goal-based agents are less efficient
• but more flexible, because the knowledge that supports its
decision is represented explicitly and can be modified.
• Agent Different goals different tasks
4. Utility based agents
40
• Goals alone are not enough to generate high-quality behavior in most environments.
Example: Many action sequences will get the taxi to its destination (thereby achieving the
goal) but some are quicker, safer, more reliable, or cheaper than others.
• Many action sequences → the goals
• Some are better and some worse
• If goal means success.
• Then utility means the degree of success (how successful it is)
Cont.…
• A goal-based navigation agent is tasked with getting from point A to
point B. If the agent succeeds, the goal has been satisfied.
• A utility-based navigation agent could seek to get from point A to
point B in the shortest amount of time, with the minimum
expenditure of fuel, or both.
• Both goal-based and utility-based agents have goals. However, having
goals isn't effective (or efficient) enough, given that a goal-based
agent may have several actions that can lead to the goals, but not all
these actions are equally effective. So there's the need for an agent to
perform the most effective action. And this is done by a utility-based
agent
5. Learning Agents
42
• Four conceptual components
✓ Learning element: Responsible for making improvements.
✓Performance element: Responsible for selecting external actions.
✓Critic: Tells the Learning element how well the agent is doing with
respect to fixed performance standard.
✓ Problem generator: Suggest actions that will lead to new and
informative experiences.
Structure of Learning Agents
43
44
THANK YOU
Introduction
What is a Problem?
✓ It is a gap between what actually is and what is desired.
✓ A problem exists when an individual becomes aware of the existence
of a significant difference between the expected and the actual
situation
✓An obstacle and makes it difficult to achieve a desired goal or
objective.
Problem solving agent
• It is known as, if the agent can adopt a goal and satisfying it.
• Goals help to organize behavior by limiting the objectives that the agent is trying to achieve
and hence the actions it needs to consider.
Problem formulation
• It is the process of deciding what actions and states to consider, given a
goal.
Search:
• The process of looking for a sequence of actions that reaches the goal is
called search.
Well-defined problems and solutions
A problem can be defined formally by five components.
1. Initial State: That the agent starts in.
✓ In our example, the initial state for our agent in Romania might be described as In
(Arad).
2. Actions: A description of possible actions available to the agent.
✓ Given a particular state s, ACTIONS (s) returns the set of actions that can be executed in
s. We say that each of these actions is applicable in s.
✓ In our example, from the state In (Arad), the applicable actions are
{Go (Sibiu), Go (Timisoara), Go (Zerind)}
…
3. Transition model or Successor: A description of what each action
does, specified by a function.
✓ RESULT (s, a) that returns the state that results from doing action a
in state s.
✓ In our example, RESULT (In (Arad), Go (Zerind)) = In (Zerind).
▪ Together the initial state, actions and transition model implicitly define the state
space of the problem the set of all states reachable from the initial state by any
sequence of actions.
…
4. Goal Test: Which determines whether a given state is a goal state.
✓ Sometimes there is an explicit set of possible goal states, and the test simply
checks whether the given state is one of them.
✓ In our example, the agent’s goal in Romania is the singleton set {In (Bucharest)}.
5. Path Cost: A function that assigns a numeric cost to each path.
✓ For the agent trying to get to Bucharest, time is of the essence, so the cost of a
path might be its length in kilometers.
✓ We assume that the cost of a path can be described as the sum of the costs of
the individual actions along the path. The step cost of taking action a in state s to
reach state s1 is denoted by c(s, a, s1).
….
Solution:
• A search algorithm takes a problem as input and returns a solution in the form of an
action sequence.
Execution:
• Once a solution is found, the action it recommends can be carried out. This is called the
execution phase.
Open-Loop:
• While the agent is executing the solution sequence it ignores its percepts when choosing
an action because it knows in advance what they will be is called open-loop system,
because ignoring the percepts breaks the loop between agent and environment.
The problem formulation is therefore:
Initial state: at Arad
Actions: the successor function S:
• S(Arad) = {<Arad→Zerind, Zerind>, <Arad→Sibiu, Sibiu>,<Arad→Timisoara,
Timisoara}
• S(Sibiu) = {<Sibiu→Arad, Arad>, <Sibiu→Oradea, Oradea>, < Sibiu→ Fagaras,
Fagaras>, Sibiu→Rimnicu Vilcea, Rimnicu Vilcea>}, etc.
Goal test: at Bucharest
Path cost: c(Arad, Arad→Zerind, Zerind) = 75, c(Arad, Arad→Sibiu, Sibiu) = 140,
c(Arad, Arad→ Timisoara, Timisoara) = 118, etc.
…..
✓ For example, if the agent is in the state Arad, there are 3 possible
actions, Arad → Zerind, Arad → Sibiu and Arad → Timisoara,
resulting in the states Zerind, Sibiu and Timisoara respectively.
✓ The solution to drive from Arad to Bucharest is Arad to Sibiu to
Rimnicu Vicea to Pitesti to Bucharest must be a solution.
Example problems:
• Toy problem: is intended to illustrate or exercise various problem solving
methods.
It can be given a brief, exact description and hence is usable by different
researchers to compare the performance of algorithms.
• Real world problems: is one whose solutions people actually care about.
✓ Such problem tends not to have a single agreed-upon description, but
we can give the general flavor/taste of their formulations.
55
Toy problems:
1. 8-Puzzle: Consists of a 3×3 board with eight numbered tiles and a
blank space. A tile adjacent to the blank space can slide into the space.
The objective is to reach a specified goal state.
56
Con’t…
• States: A state description specifies the location of each of the eight tiles and
the blank in one of the nine squares.
• Initial State: Any state can be designated as the initial state. Note that any
given goal can be reached from exactly half of the possible initial states.
• Actions: The simplest formulation defines the action on movements of the
blank space Left, Right, Up or Down.
• Transition Model: Given a state and action, this returns the resulting state.
Example: If we apply left to the start state in figure, the resulting state has the
5 and the blank switched. 57
Con’t…
• Goal Test: This checks whether the state matches the goal
configuration as shown in figure.
• Path cost: Each cost costs 1, so the path cost in the number of steps
in the path.
Note: The 8-puzzle belongs to the family of sliding-block puzzles,
which are often used as test problems for new search algorithms in
AI. 58
Real World problems:
1. Route-finding problem: is defined in terms of specified
locations and transitions along links between them.
✓ Route-finding algorithms are used in a variety of applications
such as, websites, in car systems to provide driving directions,
routing video streams in computer networks, military operations
planning, airline travel planning systems.
59
Consider the air line travel problems: that must be solved by a travel-
planning web site:
States: Each state obviously includes a location (airport) and the
current time. Furthermore, the state must record extra information
like, base fare, flight segment, their status as domestic or
international, to decide the cost of an action.
Initial state: This is specified by the user’s query.
Actions: Take any flight from the current location, in any seat
class, leaving the current time, leaving enough time for within
airport transfer if needed. 60
Con’t…
Transition model: The state resulting from taking a flight will have the
flight’s destination as the current location and the flight’s arrival time
as the current time.
Goal Test: Are the final destination specified by the user?
Path cost: This depends on monetary cost, waiting time, flight time,
customs and immigration procedures, seat quality, time of day, type
of airplane, frequent flyer mileage awards and so on.
61
.
63
Chapter 4
Knowledge and Reasoning
Knowledge: What and Why?
64 Knowledge:
✓ facts about the real world entities and the relationship between them.
✓Information after process.
Why Knowledge is important?
✓ We are living in complex environment
✓It enables to:
✓Automate reasoning
✓Make quality decisions.
Knowledge Base Agent
➢ Knowledge base agent is an agent that perform action using the
65
knowledge it has and reason about their action using its inference
procedure.
➢Consists of two parts:
✓ knowledge base: contains the domain-specific knowledge that the agent
has of its environment. This can consist of facts, but also rules that describe
the structure of the environment.
✓ Inference engine: It consists of algorithms that take the contents of the
knowledge base and infer (i.e. deduce) new knowledge about the world.
Con’t…
66
➢ Knowledge base is a set of facts and their relation ships called rules
about the world
➢ Each fact/rules are called sentences which is represented using a
language called knowledge representation language.
Logical Agents
67 Logic
• The study of principles of reasoning and arguments towards the truth of a
given conclusion given premises.
Con’t…
• A logic consists of a syntax and some semantics.
68
✓ The syntax defines what an allowable sentence is in the language, whereas
the semantics defines the meaning of the sentences.
• There are many different logics. For example, integer arithmetic is a logic. The
syntax of integer arithmetic states that the following are all legal sentences:
1+4=x
x–4>2
x2 – 2x = 0
• whereas the following are illegal sentences:
1+*2=
x2 + y > {}
Entailment
69
✓ The idea that a sentence follows logically from another sentence.
✓ α╞ β (i.e, the sentence α entails the sentence β; (or) the
sentence β logically follows from sentence α)
✓ The formal definition of entailment is this: α ╞ β if and only if, in
every model in which α is true, β is also true.
It can be written as, α ╞ β if and only if m(α) m (β).
Models
70 ✓ The semantics of a logic define the truth (or otherwise) of sentences in
possible worlds.
✓A model/world is an assignment of values to variables.
For example: we can say that the integer arithmetic sentence “x + y = 4” is
true in the model/world where x = 2 and y = 2.
- Logicians often refer to models rather than worlds, but the meaning is the
same: an assignment of values to variables.
Definition: A model M is a model of a sentence α if α is true in M
Con’t…
71
For example: The model {x = 2, y = 2} is a model of the sentence
“x + y = 4”.
✓ In addition, the model {x = 1, y = 3} is also a model of the
sentence “x + y = 4”. In fact, because there are an infinite
number of integers, there are an infinite number of models of
this sentence.
Definition: M(α) is the set of all models of α
Propositional(Boolean) Logic
72
Proposition is statement which is either true or false but not both at
any time.
A statement is a sentence which is either true or false.
PL uses declarative sentences only
PL doesn’t involve quantifiers.
Not all sentences are statement (interrogatives, imperatives and
exclamatory)
Con’t…
73
➢Preposition can be conditional or unconditional
➢Examples
✓ Socrates is mortal (uncoditional)
✓ If the winter is severe, students will not succeed. (conditional)
✓ All are the same if their color is black (conditional)
Some terms
74
✓A model for a KB is a “possible world” (assignment of truth values to
propositional symbols) in which each sentence in the KB is True.
Knowledge Representation and reasoning
75
✓ Knowledge Representation: express knowledge explicitly in a
computer-tractable way such that the agent can reason out.
✓ Parts of KR language:
• Syntax of a language: describes the possible configuration to form
sentences.
E.g. if x & y denote numbers, then x > y is a sentence about numbers
Con’t…
76
• Semantics: determines the facts in the world to which the sentences
refer.
E.g. x > y is false when y is greater than x and true otherwise
Reasoning: is the process of constructing new sentences from existing
facts in the KB.
Knowledge-based Systems and Knowledge
77
What is a knowledge-based system?
✓ A system which is built around a knowledge base. i.e. a
collection of knowledge, taken from a human, and stored in
such a way that the system can reason with it.
What is knowledge?
✓ Knowledge is the sort of information that people use to
solve problems.
.
Chapter 5
LEARNING
Learning from Examples:
80
✓Improve behavior through diligent study of their own
experiences.
✓Improves its performance on future tasks after making
observations about the world.
Why would we want an agent to learn?
81
There are three main reasons:
✓ The designers cannot anticipate all possible situations that the
agent might find itself in.
✓The designers cannot anticipate all changes over time.
✓ Sometimes human programmers have no idea how to program a
solution themselves.
Learning
82
essential for unknown environments.
useful as a system construction method.
modifies the agent's decision mechanisms to improve
performance
Learning agents
83
Learning agents consist of four main components:
84
• Learning element: the part of the agent responsible for
improving its performance
• Performance element: the part that chooses the actions to take
• Critic: provides feedback for the learning element how the agent
is doing with respect to a performance standard
• Problem generator: suggests actions that could lead to new,
informative experiences
Forms of learning: (factors for designing a learning agent)
85
• Any component of an agent can be improved by learning from
data. The improvements depend on four major factors.
Which components of the performance element are to be
learned.
What prior knowledge the agent already has.
What feedback is available to learn these components.
What representation is used for the components.
Types of Learning
86
• Supervised learning: The agent observes some example input-output pairs
and learns a function that maps from input to output, correct answer for
each.
Example. Answer can be a numeric variable, categorical variable etc.
M M F F M F
• Unsupervised learning: correct answers not given – just examples (e.g. – the
same figures as above , without the labels)
• Reinforcement learning: the agent learns from a series of reinforcements-
rewards or punishments.
87
ARTIFICIAL NEURAL NETWORKS
Features of the Brain
88
✓ ten billion (1010) neurons in our brain
✓ Neuron switching time >10-3secs
✓ Face Recognition ~0.1secs
✓ each neuron has several thousand connections
✓ Hundreds of operations per second
✓ High degree of parallel computation
Neural Network
89 layered set of interconnected processors.
These processor nodes has a relationship with the
neurons of the brain.
Each node has a weighted connection to several other
nodes in adjacent layers.
Individual nodes take the input received from connected
nodes and use the weights together to compute output
values.
Con’t…
90
✓ The inputs are fed simultaneously
into the input layer.
✓ The weighted outputs of these units
are fed into hidden layer.
✓ The weighted outputs of the last
hidden layer are inputs to units making
up the output layer.
Architecture of Neural network
91
• Neural networks are used to look for patterns in data, learn
these patterns, and then classify new patterns & make
forecasts
• single-layered neural network: A NW with the input and output
layer only
• multilayer neural network is a generalized one with one or more
hidden layer.
Con’t…
92
• A network containing two hidden layers is called a three-
layer neural network, and so on.
A Multilayer Neural Network
93
INPUT: records with class attribute with
normalized attributes values.
✓ INPUT VECTOR: X = { x1, x2, …. xn}, where
n is the number of attributes.
✓INPUT LAYER – there are as many nodes as
class attributes i.e. as the length of the input
vector.
Con’t…
94
HIDDEN LAYER – neither its input nor its output can be
observed from outside.
OUTPUT LAYER – corresponds to the class attribute.
Pros and Cons of Neural Network
95
• Useful for learning complex data like handwriting, speech and image
recognition
Pros Cons
+ Can learn more complicated class ▪ Slow training time
+ Fast application ▪ Hard to interpret
+ Can handle large number of features ▪ Hard to implement.
Neural Network has a high tolerance to noisy and Neural Network needs long time for
training.
incomplete data
More about ANN(Artificial neural network)
Application area of ANN(Artificial neural network)
Image recognition
➢Suppose an image with 28*28 pixel is going to identified as rectangle, circle or triangle
➢Then 784 (28*28) pixels are feed as input to the input layer.
➢Each input is assigned a numerical value (between 0 and 1) what we call it weight.
…
• Input x1 and x3 are connected with hidden layer neuron B1 ;
x1*w1+x2*w2 =B1(this known as activation function )
• It continuous in such away for each other neurons in the next layer.
• Finally, the output with probability value is obtained.
• The forward direction by doing this process Is known as forward
propagation.
• Backward propagation is the reverse process of forward program.
Activation function
• One of an activation function is sigmoid function.
• Defined as :
Where x is net input , e (Euler number) is a constant (2.718)
Example
103
CHAPTER-SIX
COMMUNICATING, PERCEIVING, AND ACTING
Natural Language Processing (NLP)
104
The process of computer analysis of input provided in a human
language (natural language), and conversion of this input into a
useful form of representation.
NLP is primarily concerned with getting computers to perform
useful and interesting tasks with human languages.
NLP is secondarily concerned with helping us come to a
better understanding of human language.
Forms of Natural Language
105
➢ The input/output of a NLP system can be:
written text
speech
➢ We will mostly concerned with written text (not speech).
➢To process written text, we need:
Lexical, syntactic, semantic knowledge about the language
➢To process spoken language, we need everything required to
process written text, plus the challenges of speech recognition
and speech synthesis.
Components of NLP
106
1. Natural Language Understanding
✓ Taking some spoken/typed sentence and working out what it means
✓ Mapping the given input in the natural language into a useful
representation.
✓ Different level of analysis required:
morphological analysis,
syntactic analysis,
semantic analysis,
discourse analysis, …
Con’t…
107
Con’t…
108
2. Natural Language Generation
Taking some formal representation of what you want to say and
working out a way to express it in a natural (human) language (e.g.,
English).
NLG can be viewed as the reverse process of NL understanding.
Lexical Selection - selecting the correct words describing
the concepts.
Con’t…
109
Applications of NLP
110
✓ Machine Translation
✓Database Access
✓Information Retrieval
Selecting from a set of documents the ones that are relevant to a query
✓Text Categorization
Sorting text into fixed topic categories
✓ Extracting data from text
Converting unstructured text into structure data
✓Spelling and grammar checkers
Why NL Understanding is hard?
111
Natural language is extremely rich in form and structure, and very ambiguous.
✓ How to represent meaning,
✓ Which structures map to which meaning structures.
One input can mean many different things. Ambiguity can be at different levels..
Many input can mean the same thing.
Interaction among components of the input is not clear.
Ambiguity
112
I made her duck.
✓ How many different interpretations does this sentence have?
✓ What are the reasons for the ambiguity?
✓ The categories of knowledge of language can be thought of as
ambiguity resolving components.
✓ How can each ambiguous piece be resolved?
✓ Does speech input make the sentence even more ambiguous?
• Yes – deciding word boundaries
Con’t…
✓ Some interpretations of : I made her duck.
113
1. I cooked duck for her.
2. I cooked duck belonging to her.
3. I created a toy duck which she owns.
4. I caused her to quickly lower her head or body.
5. I used magic and turned her into a duck.
✓ duck – morphologically and syntactically ambiguous: noun or verb.
✓ her – syntactically ambiguous: dative or possessive.
✓ make – semantically ambiguous: cook or create.
✓ make – syntactically ambiguous:
Natural Language for Communication
114
• The goal in the production and comprehension of natural language is for
communication.
❑ Communication for the speaker:
Intention: Decide when and what information should be transmitted (strategic
generation).
- May require planning and reasoning about agents’ goals and beliefs.
Generation: Translate the information to be communicated into string of words in
desired natural language (tactical generation).
Synthesis: Output the string in desired modality, text or speech.
Con’t…
115 ❑ Communication for the hearer:
Perception: Map input modality to a string of words, e.g. optical character
recognition (OCR) or speech recognition.
Analysis: Determine the information content of the string.
Syntactic Interpretation (parsing): Find the correct parse tree showing the phrase
structure of the string.
Semantic Interpretation: Extract the (literal) meaning of the string (logical form).
Speech Recognition
Speech is the dominant modality for communication between humans,
116
and promises to be important for communication between humans and
machines.
Speech recognition: is the task of mapping from a digitally encoded
acoustic signal to a string of words.
Speech understanding: is the task of mapping from the acoustic
signal all the way to an interpretation of the meaning of the word.
Con’t…
117
A speech understanding system must answer three questions:
1. What speech sounds did the speaker utter?
2. What words did the speaker intend to express with those
speech sounds?
3. What meaning did the speaker intend to express with those
words?
Con’t…
118
Speech Recognition-Complications
119
• No simple mapping between sounds and words
• Variance in pronunciation due to gender, dialect, …
✓ Restriction to handle just one speaker
• Same sound corresponding to different words
✓ e.g. bear, bare
• Finding gaps between words
✓ “how to recognize speech”
✓ “how to wreck a nice beach”
• Noise
Machine translation
• To translate one language to an other language, a person who is
bilingual is required . This is known as human translation.
• But, human translation is not addressable.
• At this time machine translation is needed.
• Machine translation is the translation of one language to an other
language(from source language to target language ).
Steps:
1. The text from source language is segmented to a segment of words.
2. Each segment is translated to the target language
3. The translated segment is aggregated together to have full meaning
Sentiment analysis(opinion mining technique)
• An NLP technique used to determine whether the expression is
negative ,positive or sarcasm (opinion classification).
• Example in community standard violence in facebook, youTube .
Steps:
Data preprocessing
✓Tokenization – break a sentences into several elements(tokens)
✓Lemmatization – convert words to root word.
✓Stop word removal (removing stop words like at ,with,for, and of )
How speech recognition works?
1. When sounds come out of someone’s mouth to create words, it
makes a series of vibrations. Speech to text technology works by
picking up on these vibrations and translating them into a digital
language through an analogue to digital converter.
2. The analogue to digital converter takes sounds from an audio files,
measures the waves in great detail, filter them to distinguish the
relevant sounds.
3. The sounds are then segmented into hundredth or thousandth of
seconds and are then matched them to phonemes. A phoneme is a
unit of sound that distinguishes one word from an other in any
given language.
4. The phonemes are then compared with well known words, phrases
and sentences.
….
5. The text is then presented as text/computer based demands based
on the given audio.
Robotic
124
Robots are physical agents that perform tasks by manipulating the
physical world.
- Equipped with Effectors such as legs, wheels, joints, and grippers.
- Also equipped with Sensors to perceive their environment, sensors
include cameras and ultrasound to measure the environment’.
Types of Robots
125
[Link]: Manipulators or robot arms are physically anchored to
their workplace, for example robots in a factory assembly line.
[Link] robots: Mobile robots move around their environment using
wheels, legs or similar mechanisms.
[Link] type robots: Mobile robot equipped with manipulators, these
include the humanoid robot, whose physical design mimics the human
torso.
Modern uses of Robots
126
1. Explorations:
127
2. Industry Robots: Con’t…
Con’t…
128 4. In Military and Police corps:
5. Entertainment Robots:
Robot hardware
129
• The success of real robots depends at least as
much on the design of sensors and effectors that
are appropriate for the task.
Fig: Robot hardware
Review Question
130
1. What do you learn in general from this course?
2. What is the importance of NLP?
3. Why NL Understanding is hard?
4. Define the following terms
- lexical selection
- speech recognition
About Your feeling
131
1. What do you feel about the course?
2. How do you see the teaching learning process?
3. Do you have any comment/suggestion?