Mod 6 Ai
Mod 6 Ai
Module 6
Planning
● Artificial Intelligence (AI) is reshaping the future, playing a pivotal role in
domains like intelligent robotics, self-driving cars, and smart cities.
● At the heart of AI systems’ ability to perform tasks autonomously is AI
planning, which is critical in guiding AI systems to make informed decisions,
execute tasks, and achieve goals efficiently.
● In Artificial Intelligence (AI), planning refers to the process of deciding a
sequence of actions that a system must take to achieve a specific goal
starting from a initial state. Just like humans plan their daily tasks with a goal
in mind, AI systems use planning algorithms to break down a problem into
smaller, manageable tasks and determine the best course of action.
● It is a crucial area of AI, especially in robotics, game playing, automated
reasoning, and decision support systems.
What is AI Planning?
AI planning is the automated process of generating a plan—a series of actions—with the goal of
achieving a desired outcome from a known starting point, given constraints and a model of the
environment.
● Actions: Steps the agent can take to move from one state to another.
● Plan: A sequence of actions that leads from the initial state to the goal state.
Planning
Planning is crucial for AI applications because it allows machines to:
B. Partial-Order Planning
● Actions do not have to be in a total linear order; some actions can be unordered if they don't
interfere.
● Useful for parallel execution.
● Example: Cooking (you can boil water and chop vegetables simultaneously).
E. Probabilistic Planning
● Uses probabilities to deal with uncertain outcomes of actions.
● Often represented using Markov Decision Processes (MDPs) or Partially Observable MDPs
(POMDPs).
● Example: Robot navigation where the environment may have moving obstacles.
F. Temporal Planning
● Considers time durations and deadlines for actions.
● Example: A satellite scheduling observations where time windows are critical.
https://www.youtube.com/watch?v=Ng6zy7hI64A
Planning Algorithms
a. Forward State-Space Search
● Starts from the initial state and searches forward through the state space until the goal is found.
c. GraphPlan
● Builds a planning graph that represents how actions and states are related over time.
A planning strategy where all actions are totally ordered—that is, they are arranged in a fixed linear sequence. Every
action must be performed in a specific order.
Features:
● Actions are executed strictly one after another.
● Simpler but less flexible.
● Easier to implement and debug.
● Cannot leverage concurrency.
Even if some steps are independent, they must follow the exact order.
Use Case:
Useful in deterministic and serial environments (e.g., assembly lines).
Two Major Approaches to Planning
2. Partial-Order Planning (POP)
A planning strategy that allows actions to be partially ordered—only constraining actions when necessary due to precondition or causal
dependencies.
Features:
● Also called Least Commitment Planning.
● Only required actions are ordered.
● Allows parallelism and flexibility.
● Plans are more compact and reusable.
Here, boiling water and toasting bread can occur in parallel, since they are independent.
Only necessary orderings are enforced:
● You must toast bread before applying butter.
● You must boil water before pouring tea.
Use Case:
Ideal for multi-agent systems, robotics, or workflows where some actions can occur in parallel.
Total-Order Planning (TOP) Vs Partial-Order Planning (POP)
Types:
● Supervised Learning
● Unsupervised Learning
● Semi-Supervised Learning
● Reinforcement Learning
● Ensemble learning
What is machine learning?
● Machine Learning
¨Study of algorithms that improve their performance ¨at some task ¨with experience
● Optimize a performance criterion using example data or past
experience.
● Role of Statistics: Inference from a sample
● Role of Computer science: Efficient algorithms to
❖ Solve the optimization problem
❖ Representing and evaluating the model for inference
What is machine learning?
Machine learning vs. “classic” programming.
● Machine learning: "Field of study that gives computers the ability to learn without
being explicitly programmed"
○ Samuels wrote a checkers playing program
■ Had the program play 10000 games against itself
■ Work out which board positions were good and bad depending on wins/losses
● Well posed learning problem: "A computer program is said to learn from experience
E with respect to some class of tasks T and performance measure P, if its
performance at tasks in T, as measured by P, improves with experience E."
○ The checkers example,
■ E = 10000s games
■ T is playing checkers
■ P if you win or not
Definition of learning
Definition: A computer program is said to learn from experience E with respect to
some class of tasks T and performance measure P, if its performance at tasksT, as
measured by P, improves with experience E.
Supervised Learning :Teach the computer how to do something, then let it use
it;s new found knowledge to do it
In supervised learning, the computer is provided with example inputs that
are labeled with their desired outputs.
The purpose of this method is for the algorithm to be able to “learn” by
comparing its actual output with the “taught” outputs to find errors, and
modify the model accordingly.
Supervised learning therefore uses patterns to predict label values on
additional unlabeled data.
Types of Machine Learning
Types of Machine Learning
Types of Machine Learning
Unsupervised Learning: Let the computer learn how to do something, and
use this to determine structure and patterns in data
Game Playing
● AlphaGo and AlphaZero use RL to achieve superhuman performance in Go and
Chess.
Autonomous Vehicles
● RL-based policies help self-driving cars navigate safely in dynamic environments.
Healthcare
● Personalized treatment recommendations based on patient response to
medications
Semi Supervised Learning
In Semi supervised learning, some input data is labeled and some is unlabeled.
Classification
In machine learning, classification is the problem of identifying to which of a set of
categories a new observation belongs, on the basis of a training set of data
containing observations (or instances) whose category membership is known.
Example 1
Consider the following data: -training set of data.
-two attributes “Score1” and “Score2”.
-class label is called “Result”.
-class label has two possible values
“Pass” and “Fail”.
-The data can be divided into two
categories or classes:
Classification
If we have some new data, say “Score1 =
25” and “Score2 = 36”, what value should be
assigned to “Result” corresponding to the
new data; in other words, to which of the two
categories or classes the new observation
should be assigned?
To answer this question, using the given
data alone we need to find the rule, or the
formula, or the method that has been used
in assigning the values to the class label
“Result”.
The problem of finding this rule or formula or
the method is the classification problem.
Example 2 of Classification
Can we define breast cancer as malignant or benign based on tumour size
A tumor can be benign (not dangerous to health) or malignant (has the potential to be dangerous)
● Classify data into one of two discrete classes - either malignant or not
● In classification problems, can have a discrete number of possible values for the
output
■ 0 - benign
■ 1 - type 1
■ 2 - type 2
■ 3 - type 4
Used only one attribute (size)
Example 3 of Classification
● In other problems may have multiple attributes for same problem
definition of breast cancer
● We may also, for example, know age and tumor size
● Based on that data, you can try and define separate classes by
a. Drawing a straight line between the two groups
b. Using a more complex function to define the two groups (which we'll discuss later)
c. Then, when you have an individual with a specific
tumor size and who is a specific age,
you can hopefully use that information to place
them into one of your classes
c) k-NN algorithm
● Example problem: "Given this data, a friend has a house 750 square feet - how much can
they be expected to get?"
Example 1: If you are planning to buy an air-conditioner, would you enter a showroom and
buy the air-conditioner that the salesperson shows you? The answer is probably no. In this
day and age, you are likely to ask your friends, family, and colleagues for an opinion, do
research on various portals about different models, and visit a few review sites before
making a purchase decision. In a nutshell, you would not come to a conclusion. Instead,
you would try to make a more informed decision after considering diverse opinions and
reviews. In the case of ensemble learning, the same principle applies.
Ensemble methods
Need of ensemble methods:
Machine learning models suffer from bias and/or variance.
● Bias is the difference between the predicted value and the actua lvalue by the model.
● (1) Bias is introduced when the model doesn’t consider the variation of data and
creates a simple model. The simple model doesn’t follow the patterns of data, and
hence the model gives errors in predicting training as well as testing data i.e. the
model with high bias and high variance.
● (2) When the model follows even random quirks of data, as patterns of data, then the
model might do very well on the training dataset, i.e. it gives low bias, but it fails on
test data and gives high variance.
● Therefore, to improve the accuracy (estimate) of the model, ensemble learning
methods are developed.
● Ensemble is a machine learning concept, in which several models are trained
using machine learning algorithms.
● It combines low performing classifiers (also called weak learners or base learners)
and combine individual model predictions for the final prediction.
Ensemble methods
● On the basis of the type of base learners, ensemble methods can be categorized
as homogeneous and heterogeneous ensemble methods.
● If the base learners are the same, then it is a homogeneous ensemble method.
● If base learners are different, then it is a heterogeneous ensemble method.
Types of Ensemble Methods
1. Bagging
2. Boosting
3. Stacking
Bagging is a way to decrease the variance in the prediction by generating additional data
for training from the dataset using combinations with repetitions to produce multiple sets
of the original data.
Boosting is an iterative technique that adjusts the weight of an observation based on the
last classification. If an observation was classified incorrectly, it tries to increase the weight
of this observation. Boosting, in general, builds strong predictive models.
1. Bagging, or Bootstrap Aggregating
Concept:
● Consider a scenario where we are looking at the users’ ratings for a product.
Instead of approving one user’s good/bad rating, we consider the average rating
given to the product.
● With an average rating, we can be considerably sure of the quality of the product.
Bagging makes use of this principle.
● Instead of depending on one model, it runs the data through multiple models in
parallel, and averages them out as the model's final output.
● Bagging is an acronym for Bootstrapped Aggregation.
● Bootstrapping means a random selection of records with replacements from the
training dataset.
1. Bagging, or Bootstrap Aggregating
It has three steps:
Bagging is a parallel method, which means several weak learners learn the data
pattern independently and simultaneously.
1. BAGGing, or Bootstrap AGGregating
Advantages:
● Since the final prediction is based on the mean predictions from subset
trees, it won’t give precise values for the classification and regression models
2. Boosting
We saw that in bagging, every model is given equal preference, but if one model
predicts data more correctly than the other, then higher weightage should be given to
this model over the other.
These concepts are applied in the second ensemble method that we are going to learn,
that is Boosting.
Boosting
Concept:
1. To start with, boosting assigns equal weights to all data points as all points are equally
important in the beginning. For example, if a training dataset has N samples, it assigns
weight = 1/N to each sample.
2. The weak learner classifies the data. The weak classifier classifies some samples
correctly, while making mistake in classifying others.
3. After classification, sample weights are changed. Weight of correctly classified sample
is reduced, and weight of incorrectly classified sample is increased. Then the next weak
classifier is run.
4. This process continues until model as a whole gives strong predictions.
Note: Adaboost is the ensemble learning method used in binary classification only.
Boosting
Boosting Steps:
● Draw a random subset of training samples d1 without replacement from the training set
D to train a weak learner C1
● Draw second random training subset d2 without replacement from the training set and
add 50 percent of the samples that were previously falsely classified/misclassified to train
a weak learner C2
● Find the training samples d3 in the training set D on which C1 and C2 disagree to train
a third weak learner C3
● Combine all the weak learners via majority voting.
Boosting
Advantages:
● Supports different loss function (we have used ‘binary:logistic’ for this example).
● Works well with interactions.
Disadvantages:
● Prone to over-fitting.
● Requires careful tuning of different hyper-parameters.
Ensemble Learning