Agent
Agent is a device or an machine that perceive environment through sensors and take action through its actuators.
Logical Agent
Logical agent has complex knowledge about world or its environment and uses inference system to derive new information and make appropriate decision or action.
Knowledge Base
Knowledge base is collection of fact and rules about world or environment.
Use of KB
Knowledge base is required to agent to learn new things and to store it.
Knowledge Based Agent
Knowledge based agent is combination of knowledge base and inference systems. Agent perceive environment then uses its knowledge base and inference system to make appropriate decision & action.
A knowledge based agent is composed of -
- Knowledge base — Knowledge base is collection of fact and rules about world or environment which is domain specific.
- Inference system — Inference system collection of facts and rules about world or environment which is not domain specific. It can update its knowledge base itself.
A knowledge based agent must able to do -
- Able to percept new environment
- Able to represent internal state, action and decision
- Able to maintain internal knowledge base and capable of updating , reasoning
- Able to deduce appropriate decision and action
Architecture of KBA
Operation performed by KBA
Tell : When agent perceive the environment it tells to knowledge base.
Ask : When agent tells to knowledge base about the environment it ask ‘What action & decision should I take?
Perform : It performs selected action.
Level of KBA
- Knowledge level — This is first level of KBA. In this level, We need specify the fact about world and its environment , specs, and goal.
- Logical level — In this level, all sentences are encoded with the help of different logics.
- Implementation level — In this level, Both knowledge level and logical level are used to reach the goal.
Approaches to design KBA
- Declarative approach — It refers to declaring facts & rules to knowledge base which is static in nature.
- Procedural approach — It refers to step sequence such as how to start, how to operate, how to use procedure. For instance how to ride a cycle, how to turn on AC.
Agents in A.I
Agents : In artificial intelligence , There are devices or machines that helps to sense the environment through sensor and act their environment through actuators.
Artificial Intelligence Agent can have mental properties like knowledge , beliefs, intentions etc.
- Human agent — Eyes, Nose , Ear and that works for sensors whereas legs, hand and other works for actuators.
- Robotic agent — Cameras, Infrared range finder
- Software agent — Key strokes
Sensors : It’s device which detects the change in the environment and sends the information to other electronic device.
- An Agent observes the environment through sensors.
Actuators : It’s a component of a machine that converts energy into motion. for instance in self driving car agents maintains speed of a car through wheels (effectors).
Effectors : It can be legs,, wheels, arms, fingers, and display screen.
Agent-> Percept-> Decision-> Action
Goals of Agents
- High performance
- Optimized results
- Rational action
Types of A.I Agents
Agent can be grouped into five classes based on the degree of perceived intelligence and capacity.
Simple reflex agent
- The agent works only on the basis of current perception and it doesn’t bother about the previous state in which the system was.
- This type of agent is based upon the condition — action rule. If the condition is true, action will be taken else not.
- Agent has complete knowledge of environment.
Problems faced :
- Very limited intelligence
- No knowledge about the non-perceptual parts of the state.
- Operating in a partially observable environment, infinite loops are unavoidable.
- Model based reflex agent
- Goal based agent
- Utility based agent
- Learning agent
Propositional Logic
Propositional logic is simple logic statement that is used to declare facts & rules in knowledge base.
Properties
- It’s is declarative statement
- It can only be answered in true and false
- It has different logic e.g. negation, disjunction, conjunction
Limitations of PL
- We can’t represent relation like all, some or none with propositional logic. Propositional logic has limited expressive power
- In programming language we cannot describe in terms of their properties or logical relationship.
Syntax of PL
- Atomic — It consists of single prepositional symbol. e.g. x^y
- Compound — It consists of combination of different logic and connectives e.g. x^y~z
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:
- Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus,
- 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
- Function: Father of, best friend, third inning of, end of, .. As a natural language, first-order logic also has two main parts:
- a. Syntax b. Semantics
Subject is main part of proposition
Predicate bonds the subject and tell something about subject.
For e.g. Cat is black here ‘cat’ is subject and ‘is black’ is a predicate.
Quantifier
Quantifier refers to quantity symbol that’s not specified exactly e.g. All, Some, At least one etc. It tells for how many elements predicate is true.
Quantifiers are the word which refers to quantity such as ‘for all’ and ‘some’. It tells for how many elements predicate is true.
Types
- Universal quantifiers — Universal quantifiers are those that are true for all within its domain.
For instance, All are hungry. ∀x hungry(x)
- Existential quantifiers — Existential quantifiers are those that are true for at least one within its domain.
For instance, Some boys are intelligent. ∃x: boys(x) ∧ intelligent(x)
Points to remember
- The main connective for universal quantifier ∀ is implication →.
- The main connective for existential quantifier ∃ is and ∧.
Free & Bound variable
Free variable occurs outside the domain of quantifier while Bound variable occurs within the domain of quantifiers.
- Definite clause — A disjunction of literal with exact one positive literal. It’s also known as strict horn clause. For e.g. ~a ^ b
- Horn clause — A disjunction of literal with at most one positive literal. For e.g. ~a ^ b, a ^ b
- Forward chaining — Forward chaining is a technique to reach goal. It starts with atomic sentence in the knowledge base then apply inference rules and move forward to extract more data until it reaches goal.
- Backward chaining — Backward chaining is a technique to reach initial. It starts with goal in the knowledge base then apply rules and move backward until it reaches the facts which support goal.
The Wumpus World
Wumpus world is very popular problem in artificial intelligence. In this world There’s a Wumpus some pits, breeze and stench. And one of them has gold.

What’s inside?
- A Wumpus, in some room there are breeze and stench. And one of them has gold.
- Adjacent room to Wumpus are stenchy
- Adjacent room to breeze has pit
Goal
- To grab gold and come out of cave.
How to win
- To find gold without falling into pits and eaten by Wumpus.
Actuators
- Forward, Right, Left , Grab, Shoot
Sensors
- Glitter
- Stench
- Breeze
- Scream
- Bump
Environment
- A 4x4 grid (16 rooms).
- The agent starts with the room square [1, 1] and facing towards the right.
- Wumpus and gold can be anywhere except for the first square [1,1].
- Any room of the cave can be a Pit, except for the first square.
Properties
- It consists of single agent
- All rooms are interconnected
- The agent can perceive the close environment that is the room adjacent to them
- The cave has a room with a Wumpus, and the game is over when the agent enters the room; however, the Wumpus stays in one room.
- The agent is given a single arrow that can be used to kill the Wumpus.
- There are some “Pits” rooms in the cave, and if the agent falls in a Pit, they will be stuck there forever.
Step 1
At present agent is in room [1,1] and he can perceive the adjacent rooms [1,2] is stenchy so adjacent of [1,2] may have Wumpus and room [2,1] is breezy so adjacent of room has pits.
Step 2
He decides to enter [2,1]. he finds there’s pit in [3,1] and [2,2] so he returns to [1,1] and move to [1,2]. he finds because room is stenchy so either [1,3] or [2,2] has Wumpus. Since he visited [2,1] so he deduces if [2,2] room would have Wumpus. Stench can be felt in [2,2] but there’s breeze. So he enters [2,2].
Step 3
In room [2,2] he perceives there’s no stench and no breeze since he guessed either [1,3] or [2,2] has Wumpus. so at present he’s in room [2,2] now he moved to room [2,3] and see glitter and grab gold and come out of cave.
Constraint Satisfaction Problem
Constraint satisfaction problem is one of method to solve problem under constraint. It has three component.
- X is set of variables {X1,X2..Xn}
- D is set of domain values each domain for each variable {D1,D2..Dn}
- C is set of constraint followed by variable {C1,C2..Cn}
Constraint values consists of a pair of {scope, rel}
where scope is set of variable which participate in constraint
rel is a relation which variable can take
{(V1,V2),(V1 ≠ V2)}
{(X,Y),(1,2)
The constraint value consists of a pair of {scope, rel}. The scope is a tuple of variables which participate in the constraint and rel is a relation which includes a list of values which the variables can take to satisfy the constraints of the problem. C1 =((V1, V2) , ( V1 != V2))
Job shop scheduling
Probabilistic Reasoning
Uncertainty — consider association where were not sure about whether it is true or false. This cannot be expressed.
Causes of uncertainty -
- Information occurred from unreliable sources
- Experimental errors
- Equipment fault
- Temperature variation
- Climate change
Probabilistic reasoning — It is a way for knowledge representation where we apply concept of probability to indicate uncertainty in knowledge. In probabilistic theory we combine with logic to handle uncertainty.
Need -
- When there are unpredictable outcomes
- When specs or possibility
- When an unknown errors occurs during an experiment.
P(A) = Number of favorable outcomes / Total number of equally probable outcomes
Learning
Supervised learning
Supervised Learning is the machine learning approach defined by its use of labeled datasets to train algorithms to classify data and predict outcomes.
The labeled dataset has output tagged corresponding to input data for the machine to understand what to search for in the unseen data.
Supervised Machine Learning Methods
There are two main areas where supervised machine learning comes in handy: classification problems and regression problems.
Classification
Classification refers to taking an input value and mapping it to a discrete value. In classification problems, our output typically consists of classes or categories. This could be things like trying to predict what objects are present in an image (a cat/ a dog) or whether it is going to rain today or not.
Regression
Regression is related to continuous data (value functions). In Regression, the predicted output values are real numbers. It deals with problems such as predicting the price of a house or the trend in the stock price at a given time, etc.
Applications
- Predictive analytics (house prices, stock exchange prices, etc.)
- Text recognition
- Spam detection
- Customer sentiment analysis
- Object detection (e.g. face detection)
Unsupervised learning
Unsupervised Learning is a type of machine learning in which the algorithms are provided with data that does not contain any labels or explicit instructions on what to do with it. The goal is for the learning algorithm to find structure in the input data on its own.
To put it simply — Unsupervised Learning is a kind of self-learning where the algorithm can find previously hidden patterns in the unlabeled datasets and give the required output without any interference.
Identifying these hidden patterns helps in clustering, association, and detection of anomalies and errors in data.
Unsupervised Machine Learning Methods
Unsupervised Learning models can perform more complex tasks than Supervised Learning models, but they are also more unpredictable. Here are the main tasks that utilize this approach.
Clustering
Clustering is the type of Unsupervised Learning where we find hidden patterns in the data based on their similarities or differences. These patterns can relate to the shape, size, or color and are used to group data items or create clusters.
There are several types of clustering algorithms, such as exclusive, overlapping, hierarchical, and probabilistic.
Association
Association is the kind of Unsupervised Learning where we can find the relationship of one data item to another data item. We can then use those dependencies and map them in a way that benefits us — e.g., understanding consumers’ habits regarding our products can help us develop better cross-selling strategies.
The association rule is used to find the probability of co-occurrence of items in a collection. These techniques are often utilized in customer behavior analysis in e-commerce websites and OTT platforms.
Artificial Intelligence is a part of the greater field of Computer Science that enables computers to solve problems previously handled by biological systems. AI has many applications in today’s society. NLP and ML are both parts of AI.
Natural Language Processing is a form of AI that gives machines the ability to not just read, but to understand and interpret human language. With NLP, machines can make sense of written or spoken text and perform tasks including speech recognition, sentiment analysis, and automatic text summarization.
Machine Learning is an application of AI that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. Machine Learning can be used to help solve AI problems and to improve NLP by automating processes and delivering accurate responses.
Deep learning is a machine learning technique that teaches computers to do what comes naturally to humans: learn by example. Deep learning is a key technology behind driverless cars, enabling them to recognize a stop sign, or to distinguish a pedestrian from a lamppost.