Ai Unit 3
Ai Unit 3
Ai Unit 3
Choose the best rule for applying the next rule based on the best available
heuristics.
Apply the chosen rule for computing the new problem state.
Detect when a solution has been found.
Detect dead ends so that they can be abandoned and the system’s effort is directed
in more fruitful directions.
Detect when an almost correct solution has been found.
This is one of the most important planning algorithms, which is specifically used
by STRIPS.
The stack is used in an algorithm to hold the action and satisfy the goal. A
knowledge base is used to hold the current state, actions.
Goal stack is similar to a node in a search tree, where the branches are created if
there is a choice of an action.
Example :
Solution:-
Planning using State Space Search
State space consists of the initial state, set of goal states, set of actions or
operations, set of states and the path cost. This state space needs to be searched to
find a sequence of actions leading to the goal state. This can be done in the forward
or backward direction.
Forward State Space Search
It is also called Progression. It starts from the initial state and searches in the
forward direction till we reach the goal. It uses STRIPS representation. This is how
the problem formulation looks like.
Conditional Planning
It works regardless of the outcome of an action. It deals with uncertainty by
inspecting what is happening in the environment at predetermined points in the
plan.
Types of Learning in Agents in Artificial Intelligence
Learnining agents as described earlier are the systems which are capable of
training themselves by learning from their own actions and experiences.
The Learning process in the agent is broadly classified into three types:
1. Supervised Machine Learning
The main goal of the supervised learning technique is to map the input
variable(x) with the output variable(y). Some real-world applications of
supervised learning are Risk Assessment, Fraud Detection, Spam filtering, etc.
Categories of Supervised Machine Learning
Supervised machine learning can be classified into two types of problems, which
are given below:
o Classification
o Regression
a) Classification
Classification algorithms are used to solve the classification problems in which the
output variable is categorical, such as "Yes" or No, Male or Female, Red or
Blue, etc. The classification algorithms predict the categories present in the
dataset. Some real-world examples of classification algorithms are Spam
Detection, Email filtering, etc.
b) Regression
Regression algorithms are used to solve regression problems in which there is a
linear relationship between input and output variables. These are used to predict
continuous output variables, such as market trends, weather prediction, etc.
Disadvantages:
o Image Segmentation:
Supervised Learning algorithms are used in image segmentation. In this
process, image classification is performed on different image data with pre-
defined labels.
o Medical Diagnosis:
Supervised algorithms are also used in the medical field for diagnosis
purposes. It is done by using medical images and past labelled data with
labels for disease conditions. With such a process, the machine can identify
a disease for the new patients.
o Fraud Detection - Supervised Learning classification algorithms are used
for identifying fraud transactions, fraud customers, etc. It is done by using
historic data to identify the patterns that can lead to possible fraud.
o Spam detection - In spam detection & filtering, classification algorithms are
used. These algorithms classify an email as spam or not spam. The spam
emails are sent to the spam folder.
o Speech Recognition - Supervised learning algorithms are also used in
speech recognition. The algorithm is trained with voice data, and various
identifications can be done using the same, such as voice-activated
passwords, voice commands, etc.
o
2. Unsupervised Machine Learning
In unsupervised learning, the models are trained with the data that is neither
classified nor labelled, and the model acts on that data without any supervision.
So, now the machine will discover its patterns and differences, such as colour
difference, shape difference, and predict the output when it is tested with the test
dataset.
o Clustering
o Association
1) Clustering
The clustering technique is used when we want to find the inherent groups from
the data. It is a way to group the objects into a cluster such that the objects with the
most similarities remain in one group and have fewer or no similarities with the
objects of other groups. An example of the clustering algorithm is grouping the
customers by their purchasing behaviour.
Some of the popular clustering algorithms are given below:
2) Association
Association rule learning is an unsupervised learning technique, which finds
interesting relations among variables within a large dataset. The main aim of this
learning algorithm is to find the dependency of one data item on another data item
and map those variables accordingly so that it can generate maximum profit. This
algorithm is mainly applied in Market Basket analysis, Web usage mining,
continuous production, etc.
Disadvantages:
3. Semi-Supervised Learning
Disadvantages:
4. Reinforcement Learning
Disadvantage
AI classifications works when the business feeds the AI data points, such as
product stock, along with their predetermined categories. The algorithm studies the
information in this database. For each category, it creates a model based on what it
learned that likely represents the type of product in that category. It then applies
this model to new products to decide which category they belong to.
Types of Classification Algorithms
While you don’t have to understand the details of your AI classifier, here is a basic
overview of some strategies computers use to categorize data points in business.
Using Bayes’ Theorem, which predicts the probability that a product belongs to
a class based on its features. If many parts of the product seem to share
characteristics with the category, then it’s likely part of it.
Decision Trees. You’ve likely heard of this type if you’ve played the “20
questions” game. The algorithm slowly deduces the attributes of the product by
asking questions to narrow down where the data point belongs.
K-nearest Neighbors. This algorithm compares a new piece of data with other
similar data points already in the database. It’s has a population application
predicting the prices of goods in the marketplace and providing product
recommendations.
Neural Networks. This buzzword is popular in the machine learning field since
it simulates how the human brain itself picks up new information. Arguably the
most challenging type of AI to develop, neural networks have caught the interest
of large enterprises like Facebook, Google, and Amazon for their versatility and
virtually endless applications.
The Naïve Bayes algorithm is comprised of two words Naïve and Bayes, Which
can be described as:
o Naïve: It is called Naïve because it assumes that the occurrence of a certain
feature is independent of the occurrence of other features. Such as if the fruit
is identified on the bases of color, shape, and taste, then red, spherical, and
sweet fruit is recognized as an apple. Hence each feature individually
contributes to identify that it is an apple without depending on each other.
o Bayes: It is called Bayes because it depends on the principle of Bayes'
Theorem
Bayes' Theorem:
o Bayes' theorem is also known as Bayes' Rule or Bayes' law, which is used
to determine the probability of a hypothesis with prior knowledge. It
depends on the conditional probability.
o The formula for Bayes' theorem is given as:
Where,
Working of Naïve Bayes' Classifier can be understood with the help of the below
example:
Problem: If the weather is sunny, then the Player should play or not?
Outlook Play
0 Rainy Yes
1 Sunny Yes
2 Overcast Yes
3 Overcast Yes
4 Sunny No
5 Rainy Yes
6 Sunny Yes
7 Overcast Yes
8 Rainy No
9 Sunny No
10 Sunny Yes
11 Rainy No
12 Overcast Yes
13 Overcast Yes
Weather Yes No
Overcast 5 0
Rainy 2 2
Sunny 3 2
Total 10 5
Weather No Yes
Rainy 2 2 4/14=0.29
Sunny 2 3 5/14=0.35
P(Yes|Sunny)= P(Sunny|Yes)*P(Yes)/P(Sunny)
P(Sunny)= 0.35
P(Yes)=0.71
P(No|Sunny)= P(Sunny|No)*P(No)/P(Sunny)
P(Sunny|NO)= 2/4=0.5
P(No)= 0.29
P(Sunny)= 0.35
Key factors:
In short, a decision tree is just like a flow chart diagram with the terminal nodes
showing decisions. Starting with the dataset, we can measure the entropy to find a
way to segment the set until the data belongs to the same class.
It helps us to make the best decisions based on existing data and best speculations.
In other words, we can say that a decision tree is a hierarchical tree structure that
can be used to split an extensive collection of records into smaller sets of the class
by implementing a sequence of simple decision rules. A decision tree model
comprises a set of rules for portioning a huge heterogeneous population into
smaller, more homogeneous, or mutually exclusive classes. The attributes of the
classes can be any variables from nominal, ordinal, binary, and quantitative values,
in contrast, the classes must be a qualitative type, such as categorical or ordinal or
binary. In brief, the given data of attributes together with its class, a decision tree
creates a set of rules that can be used to identify the class. One rule is implemented
after another, resulting in a hierarchy of segments within a segment. The hierarchy
is known as the tree, and each segment is called a node. With each progressive
division, the members from the subsequent sets become more and more similar to
each other. Hence, the algorithm used to build a decision tree is referred to as
recursive partitioning. The algorithm is known as CART (Classification and
Regression Trees)
Expanding factor costs $3 million, the probability of a good economy is 0.6 (60%),
which leads to $8 million profit, and the probability of a bad economy is 0.4
(40%), which leads to $6 million profit.
Not expanding factor with 0$ cost, the probability of a good economy is 0.6(60%),
which leads to $4 million profit, and the probability of a bad economy is 0.4,
which leads to $2 million profit.
The management teams need to take a data-driven decision to expand or not based
on the given data.
Net Expand = ( 0.6 *8 + 0.4*6 ) - 3 = $4.2M
Net Not Expand = (0.6*4 + 0.4*2) - 0 = $3M
$4.2M > $3M,therefore the factory should be expanded.
The decision tree algorithm may appear long, but it is quite simply the basis
algorithm techniques is as follows:
Initially, D is the entire set of training tuples and their related class levels (input
training data).
Missing values in data also do not influence the process of building a choice tree to
any considerable extent.
A decision tree model is automatic and simple to explain to the technical team as
well as stakeholders.
Compared to other algorithms, decision trees need less exertion for data
preparation during pre-processing.