0% found this document useful (0 votes)
45 views32 pages

Unit 2 - AIML

Uploaded by

Samiulla Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views32 pages

Unit 2 - AIML

Uploaded by

Samiulla Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Unit 2: Handling uncertainty and

learning

What is Uncertainty?
Uncertainty refers to a lack of complete knowledge about an
outcome or situation.

What is Handling Uncertainty in AI?


Handling uncertainty in AI refers to the ability of artificial
intelligence systems to make decisions in situations where there
is uncertainty.

Key Aspect to consider while handling uncertainty in


AI:
Probabilistic Models: AI systems can incorporate probabilistic
models to represent uncertainty. Instead of providing a single,
deterministic answer, these models assign probabilities to
different outcomes.
Uncertainty Quantification: AI systems should be capable of
quantifying uncertainty. This involves estimating the likelihood
of different outcomes or the confidence level associated with a
particular decision.
Continuous Learning and Adaptation: AI systems should be
able to adapt and improve over time by continuously learning
from new data. This adaptive learning process can help AI
models better cope with changing environments and evolving
uncertainties.

Non-monotonic reasoning:
Before understand what is non monotonic reasoning let us first
see what is mean by monotonic reasoning
In monotonic reasoning, once the conclusion is taken, then it
will remain the same even if we add some other information to
existing information in our knowledge base. In monotonic
reasoning, adding knowledge does not decrease the set of
prepositions that can be derived.
To solve monotonic problems, we can derive the valid
conclusion from the available facts only, and it will not be
affected by new facts.
Monotonic reasoning is not useful for the real-time systems, as
in real time, facts get changed, so we cannot use monotonic
reasoning.
Monotonic reasoning is used in conventional reasoning systems,
and a logic-based system is monotonic.
Any theorem proving is an example of monotonic reasoning.

Example:

Earth revolves around the Sun.


It is a true fact, and it cannot be changed even if we add another
sentence in knowledge base like, "The moon revolves around the
earth" Or "Earth is not round," etc.
Advantages of Monotonic Reasoning:
In monotonic reasoning, each old proof will always remain valid.
If we deduce some facts from available facts, then it will remain
valid for always.
Disadvantages of Monotonic Reasoning:
We cannot represent the real-world scenarios using Monotonic
reasoning.
Hypothesis knowledge cannot be expressed with monotonic
reasoning, which means facts should be true.
Since we can only derive conclusions from the old proofs, so
new knowledge from the real world cannot be added.
Non-monotonic Reasoning
In Non-monotonic reasoning, some conclusions may be
invalidated if we add some more information to our knowledge
base.
Logic will be said as non-monotonic if some conclusions can be
invalidated by adding more knowledge into our knowledge base.
Non-monotonic reasoning deals with incomplete and uncertain
models.
"Human perceptions for various things in daily life, "is a general
example of non-monotonic reasoning.
Example: Let suppose the knowledge base contains the
following knowledge:
o Birds can fly
o Penguins cannot fly
o Pitty is a bird
So, from the above sentences, we can conclude that Pitty can
fly.
However, if we add one another sentence into knowledge base
"Pitty is a penguin", which concludes "Pitty cannot fly", so it
invalidates the above conclusion.
Advantages of Non-monotonic reasoning:
o For real-world systems such as Robot navigation, we can
use non-monotonic reasoning.
o In Non-monotonic reasoning, we can choose probabilistic
facts or can make assumptions.
Disadvantages of Non-monotonic Reasoning:
o In non-monotonic reasoning, the old facts may be
invalidated by adding new sentences.
o It cannot be used for theorem proving.

Probabilistic reasoning:
• Probabilistic reasoning in AI involves using probability
theory to make decisions and draw conclusions based on
uncertain or incomplete information.
• It's a way for AI systems to handle uncertainty and make
educated guesses rather than giving definitive answers.
For Example:
Let's say you have an AI weather app that uses probabilistic
reasoning.
When you check the app, it doesn't just give you a single weather
forecast (e.g., "It will rain today"). Instead, it provides a
probability-based forecast like this:
• "There's a 70% chance of rain today."
• "There's a 30% chance of sunshine."
Features of Probabilistic Reasoning
Assigning Probabilities
AI assigns probabilities to different possible outcomes or events.
These probabilities indicate how likely each outcome is.
Quantifying Uncertainty
• Instead of making binary (yes/no) decisions, AI
acknowledges and quantifies uncertainty by expressing
probabilities.
• For instance, it might say, "There's an 80% chance it's true,"
indicating the level of confidence in an outcome.
Bayesian Inference
• Bayesian probability theory is a common framework used in
probabilistic reasoning. It involves updating probabilities as
new evidence becomes available.
• For example, if a medical test is 90% accurate and yields a
positive result, Bayesian reasoning allows for adjusting the
probability of having a disease based on this new
information.
Decision Making
• AI systems use these probabilities to make decisions that
aim to maximize expected outcomes or utility.
• For example, in autonomous vehicles, probabilistic
reasoning helps determine how fast to drive based on the
likelihood of encountering obstacles ahead.
Risk Assessment
• Probabilistic reasoning is valuable for assessing and
managing risks.
• It can be applied in financial modelling to estimate the level
of risk associated with different investment options.
• This allows decision-makers to make more informed choices
in situations involving uncertainty.
Bayes Theorem in AI
• Bayes' Theorem, named after the 18th-century
mathematician Thomas Bayes, stands as a foundational
principle in probability theory.
• Bayes' Theorem, also known as Bayes' Rule or Bayes'
Law, is a fundamental concept in AI and probability theory.
• It's used to update probabilities based on new evidence,
making it a crucial tool for reasoning under uncertainty.
In AI, Bayes' Theorem is often applied in various areas,
including:
• Machine Learning: In machine learning, it's used for
Bayesian inference and probabilistic modelling. For
instance, it's employed in Bayesian networks, which are
graphical models that represent probabilistic relationships
among variables.
• Natural Language Processing: Bayes' Theorem can be
used in text classification tasks, such as spam detection,
sentiment analysis, and language modelling.
• Medical Diagnosis: Bayes' Theorem helps doctors update
the probability of a patient having a disease based on the
results of medical tests and the patient's symptoms.
• Autonomous Systems: In autonomous systems like self-
driving cars, Bayes' Theorem is used for sensor fusion and
decision-making under uncertainty.
• Recommendation Systems: It can be applied in
recommendation engines to improve the accuracy of
personalized recommendations by updating user preferences
based on their interactions and feedback.

Use of certainty factors:


Certainty factors (CFs) are a way to represent and manipulate
uncertainty in expert systems and decision-making processes,
including applications in robotics. They were originally
developed for use in medical diagnostic systems but have since
been adapted for other fields.
Key Concepts of Certainty Factors
1. Certainty Factor (CF):
o A measure of belief in a hypothesis given some
evidence.
o CF values range between -1 (complete disbelief) and +1
(complete belief), with 0 indicating total uncertainty.
2. Combining Certainty Factors:
o When multiple pieces of evidence contribute to the
belief in a hypothesis, CFs can be combined using
specific rules.
o CF_combined = CF1 + CF2 × (1 − |CF1|)
o This formula adjusts the impact of each piece of
evidence based on the existing certainty.
Applications in Robotics
1. Sensor Fusion:
o CFs are used to combine data from multiple sensors,
especially when sensors provide uncertain or conflicting
information.
o For example, if one sensor is 70% sure there's an
obstacle (CF = 0.7) and another is 60% sure (CF = 0.6),
CFs help combine these to get a more accurate
estimation.
2. Decision-Making:
o Robots often need to make decisions under uncertainty.
CFs allow a robot to weigh different pieces of evidence
to decide on actions.
o For instance, in autonomous navigation, a robot might
use CFs to decide whether to turn left or right based on
uncertain map data and sensor readings.
3. Fault Diagnosis and Recovery:
o In robotics, diagnosing and responding to faults (e.g.,
sensor failures) can be challenging due to the
uncertainty of the fault's nature.
o CFs help in assessing the likelihood of different faults
and selecting the most appropriate recovery action.
4. Expert Systems:
o Some robots use rule-based expert systems for decision-
making. CFs enable these systems to handle situations
where rules might not apply perfectly due to
uncertainty.
o This is particularly useful in robotic systems where
exact models of the environment or task are difficult to
obtain.
Advantages of Using Certainty Factors
• Simplicity: Easier to implement compared to more complex
probabilistic methods like Bayesian networks.
• Flexibility: Can handle a wide range of uncertainty levels,
making it suitable for various robotic applications.
• Computational Efficiency: Less computationally intensive
than some alternatives, making it practical for real-time
applications in robotics.
Limitations
• Subjectivity: The assignment of CFs can be subjective,
potentially leading to biased outcomes.
• Approximation: CFs are an approximation and may not
always capture the true uncertainty as well as probabilistic
methods.
In robotics, CFs offer a straightforward method for dealing with
uncertainty, especially in scenarios where quick, real-time
decisions are crucial, and computational resources are limited.

Fuzzy logic:
Fuzzy logic is widely used in robotics to handle uncertainty,
imprecision, and partial truths, which are common in real-world
environments.
Unlike traditional binary logic, where variables are either true or
false, fuzzy logic allows for a range of values between 0 and 1,
enabling robots to make decisions based on degrees of truth.

Here are some key applications of fuzzy logic in robotics:

Control Systems:

Navigation and Path Planning: Fuzzy logic helps robots navigate


through uncertain and dynamic environments. For example, a
robot can determine the best path to avoid obstacles by
considering factors like distance and speed, which are often
imprecise.
Motion Control: In tasks like balancing, following a path, or
grasping objects, fuzzy logic controllers adjust the robot's
movements smoothly by dealing with uncertainties in sensor data
and the robot’s dynamic responses.
Decision Making:

Behaviour Coordination: Robots often need to choose between


multiple possible actions based on incomplete or imprecise
information. Fuzzy logic can be used to weigh different options
and decide the most appropriate action.
Task Prioritization: Fuzzy logic allows robots to prioritize tasks
based on fuzzy criteria, such as urgency, energy consumption, or
the likelihood of success.
Sensor Fusion:
Combining Data from Multiple Sensors: Robots often use data
from various sensors to perceive their environment. Fuzzy logic
can be used to integrate these data, which may be noisy or
conflicting, to form a more reliable understanding of the
surroundings.
Example
The robot needs to control its cooling fan speed based on the
temperature of its internal components. The relationship between
temperature and fan speed is not straightforward, and precise
control is difficult due to varying operating conditions.
Fuzzy Logic Approach:
1. Fuzzy Variables:
o Input Variable: Temperature (T)
▪ Fuzzy sets: "Cold," "Warm," and "Hot"
o Output Variable: Fan Speed (S)
▪ Fuzzy sets: "Low," "Medium," and "High"
2. Fuzzy Sets:
o Temperature:
▪ "Cold" might range from 0°C to 20°C.
▪ "Warm" might range from 15°C to 35°C.
▪ "Hot" might range from 30°C to 50°C.
o Fan Speed:
▪ "Low" might range from 0% to 30% of the fan's
maximum speed.
▪ "Medium" might range from 20% to 70%.
▪ "High" might range from 60% to 100%.
These ranges overlap, reflecting the fact that temperature can be
partly warm and partly hot at the same time.
3. Fuzzy Rules:
o Rule 1: IF Temperature is "Cold" THEN Fan Speed is
"Low."
o Rule 2: IF Temperature is "Warm" THEN Fan Speed is
"Medium."
o Rule 3: IF Temperature is "Hot" THEN Fan Speed is
"High."
4. Fuzzification: Suppose the current temperature is 25°C. The
system will fuzzify this input:
o The temperature of 25°C might belong 20% to the
"Cold" set, 70% to the "Warm" set, and 10% to the
"Hot" set.
5. Inference: Based on the fuzzy rules:
o Rule 1 will suggest a "Low" fan speed, but with a low
degree of membership (20%).
o Rule 2 will suggest a "Medium" fan speed, with a
higher degree of membership (70%).
o Rule 3 will suggest a "High" fan speed, but with a low
degree of membership (10%).
6. Defuzzification: The system combines these suggestions to
produce a specific output. For example, it might calculate a
weighted average of the suggested fan speeds, resulting in
an actual fan speed of, say, 55%.

Concept of learning
Learning automation:
• Definition: Learning automation in AI refers to the use of
automated tools and techniques to streamline the processes
involved in developing, training, optimizing, and deploying
machine learning (ML) models.
• Objective: Reduce the need for manual intervention in ML
workflows, enabling scalable, efficient, and faster AI
development.
2. Key Areas of Learning Automation
• AutoML (Automated Machine Learning):
o Automates the end-to-end process of applying ML to
problems.
o Includes tasks like data preprocessing, feature
engineering, model selection, hyperparameter tuning,
and model deployment.
o Tools: Google AutoML, H2O.ai, TPOT.
• Reinforcement Learning Automation:
o Focuses on automating the learning process where an
agent interacts with an environment to optimize
decision-making.
o Applications: Robotics, autonomous systems, AI in
gaming (e.g., AlphaGo).
• Neural Architecture Search (NAS):
o Automates the design of neural network architectures to
find the most effective model structure.
o Techniques: Reinforcement learning, evolutionary
algorithms, gradient-based methods.
o Tools: Google’s AutoML, ENAS.
• Hyperparameter Optimization:
o Automates the process of finding the best
hyperparameters for ML models.
o Techniques: Grid Search, Random Search, Bayesian
Optimization.
o Tools: Optuna, Ray Tune.
• MLOps (Machine Learning Operations):
o Involves automating the deployment, monitoring, and
maintenance of ML models in production environments.
o Tools: Kubeflow, MLflow.
3. Advantages of Learning Automation
• Scalability: Allows AI efforts to scale across multiple
domains with minimal manual input.
• Efficiency: Speeds up the ML lifecycle, from model
development to deployment.
• Accessibility: Makes advanced AI techniques more
accessible to non-experts by simplifying complex tasks.
• Performance: Enhances model performance by
automatically discovering optimal configurations that might
be missed manually.
4. Challenges and Considerations
• Complexity: While automation simplifies many tasks,
setting up automated systems can be complex and requires
expertise.
• Interpretability: Automated models can sometimes be less
interpretable, making it harder to understand why a model
performs well.
• Resource Intensive: Automation, especially in NAS and
reinforcement learning, can be computationally expensive.
5. Importance in Modern AI
• Innovation: Automation in learning is driving innovation by
allowing more time to focus on problem-solving rather than
technical minutiae.
• Business Impact: Enables businesses to deploy AI solutions
faster and more reliably, giving them a competitive edge.

Genetic algorithm:
History of GAs
•As early as 1962, John Holland's work on adaptive systems laid
the foundation for later developments.
•By the 1975, the publication of the book Adaptation in Natural
and Artificial Systems, by Holland and his students and
colleagues.
What is GA
A genetic algorithm (or GA) is a search technique used in
computing to find true or approximate solutions to optimization
and search problems.
• (GA)s are categorized as global search heuristics.
• (GA)s are a particular class of evolutionary algorithms that
use techniques inspired by evolutionary biology such as
inheritance, mutation, selection, and crossover (also called
recombination).
• The evolution usually starts from a population of randomly
generated individuals and happens in generations.
• In each generation, the fitness of every individual in the
population is evaluated, multiple individuals are selected
from the current population (based on their fitness), and
modified to form a new population.
• The new population is used in the next iteration of the
algorithm.
• The algorithm terminates when either a maximum number
of generations has been produced, or a satisfactory fitness
level has been reached for the population.

Vocabulary
•Individual-Any possible solution
•Population-Group of all individuals
•Fitness–Target function that we are optimizing (each individual
has a fitness)
•Trait-Possible aspect (features) of an individual
•Genome-Collection of all chromosomes (traits) for an
individual.

Example: The MAXONE problem


Suppose we want to maximize the number of ones in a string of
lbinary digits
Is it a trivial problem?
It may seem so because we know the answer in advance
However, we can think of it as maximizing the number of correct
answers, each encoded by 1, to l yes/no difficult questions`
An individual is encoded (naturally) as a string of l binary digits
•The fitness f of a candidate solution to the MAXONE problem
is the number of ones in its genetic code
•We start with a population of n random strings. Suppose that l=
10 and n= 6
Example (initialization)
We toss a fair coin 60 times and get the following initial
population:
s1= 1111010101 f (s1) = 7
s2= 0111000101 f (s2) = 5
s3= 1110110101 f (s3) = 7
s4= 0100010011 f (s4) = 4
s5= 1110111101 f (s5) = 8
s6= 0100110000 f (s6) = 3
Learning by inductions neural network
Neural networks are artificial intelligence models that have
become the backbone of modern deep learning across various
domains. Neural networks are inspired by the human brain
structure and functionality. You can see the similarity between
the typical human brain neuron and an artificial neuron.

Neurons and Layers


The main core of the neural networks are neurons, also known as
units. Each neuron receives input data, processes it with learned
weight, and finally produces an output. In the neural network
structure basically, there are three main layers. These layers are
the input layer, one or more hidden layers, and the output layer.
More layers or deeper structures increase the complexity of the
model.
Fig. A simple perceptron

Activation Functions
Non-linearity is provided by activation functions such as
Rectified Linear Unit (ReLU), sigmoid, hyperbolic tangent
(tanh), Leaky ReLU, etc. ReLU is so common activation
function because of its simplicity and effectiveness. These
functions allow us to understand the complex relationship in the
data. But note that the key point is non-linearity.

Fig. Common activation functions


Also, you can see below the decision boundaries difference
between linearity and non-linearity. So, non-linearity allows us
to explain more complex data. Most real data is not linear so we
need to non-linearity and activation functions play a key role at
this time.
Feedforward and Backpropagation
Feedforward and backpropagation are the two phases of neural
networks. Data is passed through the network during
feedforward and prediction is generated. The backpropagation
algorithm consists of calculating the loss between the predictions
and actual values to minimize errors. As a result of the
propagation phase, model weights are updated.
Training Neural Networks
For a better understanding of training neural networks, we
should know the loss function and optimization algorithms. The
loss function is a crucial component that helps us to understand
how well the model’s predictions. Basically, we compare the
predictions with actual values. For the classification problems
commonly used loss function is cross-entropy while Mean
Squared Error (MSE) for the regression problems. Unlike the
loss function, the optimization functions update the weights
during the backpropagation based on the loss function. The
commonly used optimization function is Stochastic Gradient
Descent (SGD) and Adam. Generally, scientist prefer to use
Adam because of its effectiveness such as adaptive learning rate
and momentum optimization.

Applications
Artificial intelligence has been revolutionized by neural
networks and enabled remarkable advancements in various filed
like computer vision, natural language processing, robotics,
finance, speech recognition, recommendation systems,
healthcare and etc. Their architecture, training process, and
flexibility make them incredibly powerful tools for complex
problems. Neural networks are continuously improving, making
them central to the future of AI, and enabling us to tackle new
challenges in the ever-changing tech world.

Assignment No: 2
1.What is fuzzy JHU logic?
2.Explain learning automation ?
3.Define non monotonic reasoning ?
4.Explain neural network?
5.Explain Probabilistic learning in ai?

Assignment no 3:
1.Describe Hill Climbing?
2.Explain Best First Search?
3.Describe Ant Colony Optimization?
4.Define Heuristic Search?
5.Describe uniformed and informed search?

You might also like