Docsity

Artifical intelligence notess, Study notes of Artificial Intelligence

Toggle sidebar
bg1
Probabilistic Reasoning
Probabilistic reasoning is a way of thinking and acting that uses probability theory to represent and
reason about uncertain information. Instead of dealing with definite true or false statements, it assigns
degrees of belief or likelihood to different possibilities. This is crucial in many real-world scenarios where
information is incomplete, noisy, or inherently random.
Key Concepts:
• Probability: A numerical measure between 0 and 1 (inclusive) that quantifies the likelihood of
an event occurring.
o 0 indicates impossibility.
o 1 indicates certainty.
o Values in between represent varying degrees of likelihood.
• Sample Space (Ω): The set of all possible outcomes of a random experiment.
• Event (E): A subset of the sample space, representing a specific outcome or a set of outcomes.
• Probability of an Event (P(E)): The measure of how likely event E is to occur. For a discrete
uniform sample space, P(E)=Total number of possible outcomesNumber of favorable outcomes.
• Random Variable: A variable whose value is a numerical outcome of a random phenomenon.
o Discrete Random Variable: Can take on a finite or countably infinite number of values
(e.g., the number of heads in three coin flips).
o Continuous Random Variable: Can take on any value within a given range (e.g., a
person's height).
• Probability Distribution: Describes the likelihood of each possible value (for discrete variables)
or the likelihood of values within a range (for continuous variables).
Conditional Probability
Conditional probability deals with the probability of an event occurring given that another event has
already occurred.
• Definition: The conditional probability of event A given that event B has occurred is denoted as
P(A∣B) and is defined as: P(A∣B)=P(B)P(A∩B), provided P(B)>0 where P(A∩B) is the probability of
both A and B occurring.
• Intuition: It allows us to update our beliefs about an event based on new evidence. If we know B
has happened, the sample space effectively shrinks to just the outcomes where B occurs, and
we then look at the proportion of those outcomes where A also occurs.
Bayes' Rule
Bayes' Rule is a fundamental theorem in probability theory that describes how to update the probability
of a hypothesis based on new evidence. It's the cornerstone of Bayesian inference.
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Artifical intelligence notess and more Study notes Artificial Intelligence in PDF only on Docsity!

Probabilistic Reasoning Probabilistic reasoning is a way of thinking and acting that uses probability theory to represent and reason about uncertain information. Instead of dealing with definite true or false statements, it assigns degrees of belief or likelihood to different possibilities. This is crucial in many real-world scenarios where information is incomplete, noisy, or inherently random. Key Concepts:

  • Probability: A numerical measure between 0 and 1 (inclusive) that quantifies the likelihood of an event occurring. o 0 indicates impossibility. o 1 indicates certainty. o Values in between represent varying degrees of likelihood.
  • Sample Space (Ω): The set of all possible outcomes of a random experiment.
  • Event (E): A subset of the sample space, representing a specific outcome or a set of outcomes.
  • Probability of an Event (P(E)): The measure of how likely event E is to occur. For a discrete uniform sample space, P(E)=Total number of possible outcomesNumber of favorable outcomes.
  • Random Variable: A variable whose value is a numerical outcome of a random phenomenon. o Discrete Random Variable: Can take on a finite or countably infinite number of values (e.g., the number of heads in three coin flips). o Continuous Random Variable: Can take on any value within a given range (e.g., a person's height).
  • Probability Distribution: Describes the likelihood of each possible value (for discrete variables) or the likelihood of values within a range (for continuous variables). Conditional Probability Conditional probability deals with the probability of an event occurring given that another event has already occurred.
  • Definition: The conditional probability of event A given that event B has occurred is denoted as P(A∣B) and is defined as: P(A∣B)=P(B)P(A∩B), provided P(B)>0 where P(A∩B) is the probability of both A and B occurring.
  • Intuition: It allows us to update our beliefs about an event based on new evidence. If we know B has happened, the sample space effectively shrinks to just the outcomes where B occurs, and we then look at the proportion of those outcomes where A also occurs. Bayes' Rule Bayes' Rule is a fundamental theorem in probability theory that describes how to update the probability of a hypothesis based on new evidence. It's the cornerstone of Bayesian inference.
  • Formula: P(H∣E)=P(E)P(E∣H)P(H) Where: o P(H∣E): Posterior Probability - The probability of the hypothesis H being true given the evidence E. This is what we want to calculate. o P(E∣H): Likelihood - The probability of observing the evidence E given that the hypothesis H is true. o P(H): Prior Probability - The initial probability of the hypothesis H being true before observing any evidence. o P(E): Evidence Probability - The overall probability of observing the evidence E. It can be calculated as: P(E)=i∑P(E∣Hi)P(Hi) where the sum is over all possible hypotheses Hi.
  • Intuition: Bayes' Rule provides a way to go from the probability of evidence given a hypothesis (P(E∣H)), which is often easier to estimate, to the probability of the hypothesis given the evidence (P(H∣E)), which is usually what we are interested in. It allows us to incorporate prior knowledge with new data to refine our beliefs. Bayesian Networks Bayesian Networks (BNs), also known as belief networks or probabilistic graphical models, are graphical representations of the probabilistic relationships among a set of random variables. They combine probability theory with graph theory. Representation:
  • A BN is a Directed Acyclic Graph (DAG) where: o Nodes: Represent random variables. These can be discrete or continuous. o Edges (Directed Arrows): Represent probabilistic dependencies between the variables. An arrow from node A to node B indicates that A directly influences B. This doesn't necessarily mean a causal relationship, but rather a probabilistic dependence.
  • Conditional Probability Tables (CPTs): Associated with each node are CPTs (for discrete variables) or conditional probability distributions (for continuous variables). o For a node with no parents, the CPT specifies the prior probability distribution of that variable. o For a node with parents, the CPT specifies the conditional probability distribution of the node given each possible combination of the states of its parents. Construction: Building a Bayesian network involves two main steps:
  1. Structure Learning (Qualitative Part): Defining the DAG structure, i.e., identifying the variables and the dependencies between them. This often relies on domain expertise, causal knowledge, or can be learned from data (though structure learning from data is a complex task). The
  • Natural language processing Brief Introduction of Neural Networks Neural Networks (NNs), also known as Artificial Neural Networks (ANNs), are a subset of machine learning algorithms inspired by the structure and function of the human brain. They are composed of interconnected nodes (neurons) organized in layers. Key Components:
  • Neurons (Nodes): The basic processing units of a neural network. Each neuron receives input from other neurons or external sources, performs a weighted sum of these inputs, adds a bias, and then applies an activation function to produce an output.
  • Weights: Represent the strength of the connection between neurons. They are learned during the training process.
  • Bias: A constant value added to the weighted sum of inputs, allowing the neuron to be activated even when all inputs are zero.
  • Activation Function: A non-linear function applied to the weighted sum plus bias. It introduces non-linearity into the network, enabling it to learn complex patterns. Common activation functions include sigmoid, ReLU (Rectified Linear Unit), and tanh.
  • Layers: Neurons are typically organized into layers: o Input Layer: Receives the input data. o Hidden Layers: One or more intermediate layers that perform the main computations. Deep learning involves networks with many hidden layers. o Output Layer: Produces the final output of the network. Learning Process: Neural networks learn through a process called training, where they are presented with input data and corresponding desired outputs. The network adjusts its weights and biases based on the difference between its predictions and the actual outputs, typically using an optimization algorithm like gradient descent and backpropagation. Types of Neural Networks (Briefly):
  • Feedforward Neural Networks (FNNs): Information flows in one direction, from the input layer to the output layer, without any loops.
  • Convolutional Neural Networks (CNNs): Particularly effective for processing grid-like data such as images. They use convolutional layers to automatically learn spatial hierarchies of features.
  • Recurrent Neural Networks (RNNs): Designed to handle sequential data (e.g., text, time series). They have feedback connections that allow them to maintain a memory of past inputs. Applications:

Neural networks have achieved remarkable success in various domains, including:

  • Image recognition and classification
  • Natural language processing (e.g., machine translation, text generation)
  • Speech recognition
  • Robotics
  • Game playing Brief Introduction of Fuzzy Logic Fuzzy Logic is an approach to computing based on "degrees of truth" rather than the usual "true or false" (Boolean) logic. It provides a way to represent and reason with vague or imprecise information, which is common in human language and real-world systems. Key Concepts:
  • Fuzzy Sets: Unlike crisp sets where an element either belongs or does not belong, fuzzy sets allow elements to have a degree of membership between 0 and 1. This degree represents how much an element belongs to the set.
  • Membership Functions: Define the degree of membership of each element in the universe of discourse to a fuzzy set. They map each element to a value between 0 and 1.
  • Linguistic Variables: Variables whose values are words or sentences in a natural language (e.g., "temperature" can have values like "cold," "warm," "hot"). These linguistic values are represented by fuzzy sets.
  • Fuzzy Operators: Analogous to Boolean operators (AND, OR, NOT), but adapted for fuzzy sets. Common fuzzy AND operators include minimum and product, fuzzy OR operators include maximum and probabilistic sum, and the fuzzy NOT operator is typically 1−μ(x), where μ(x) is the membership degree.
  • Fuzzy Rules (IF-THEN Rules): Form the basis of fuzzy inference systems. They express relationships between fuzzy variables (e.g., IF temperature is hot AND humidity is high THEN fan speed is fast).
  • Fuzzification: The process of converting crisp (numerical) input values into fuzzy sets using membership functions.
  • Inference Engine: Applies the fuzzy rules to the fuzzified input to produce fuzzy output.
  • Defuzzification: The process of converting the fuzzy output back into a crisp (numerical) value that can be used for control or decision-making. Applications: Fuzzy logic is particularly useful in control systems and decision-making where inputs are often imprecise or linguistic:
  1. Replacement: Replace the old population with the new population (offspring).
  2. Termination: Repeat steps 2-6 until a termination condition is met (e.g., reaching a maximum number of generations, finding a satisfactory solution, or no significant improvement in fitness). Applications: Genetic algorithms are used in a wide range of optimization and search problems, including:
  • Optimization of complex functions
  • Machine learning (e.g., feature selection, hyperparameter tuning)
  • Robotics
  • Scheduling and resource allocation
  • Circuit design
  • Bioinformatics Examples : Probabilistic Reasoning Imagine you have a bag containing 5 red balls and 3 blue balls. You randomly pick one ball.
  • Sample Space (Ω): The set of all possible outcomes is {Red Ball 1, Red Ball 2, Red Ball 3, Red Ball 4, Red Ball 5, Blue Ball 1, Blue Ball 2, Blue Ball 3}. So, ∣Ω∣=8.
  • Event (E): Let's say the event E is "picking a red ball". The favorable outcomes are {Red Ball 1, Red Ball 2, Red Ball 3, Red Ball 4, Red Ball 5}.
  • Probability of an Event (P(E)): Assuming each ball has an equal chance of being picked, the probability of picking a red ball is: P(Red)=Total number of ballsNumber of red balls=85=0.
  • Conditional Probability (Example): Suppose you pick a ball, and without looking , you are told that the ball is not blue. What is the probability that it is red? o Let A be the event "picking a red ball". o Let B be the event "picking a ball that is not blue". o We want to find P(A∣B). o The event A∩B is the event of picking a red ball (since a red ball is not blue). So, P(A∩B)=P(Red)=85. o The probability of event B (not blue) is P(B)=Total number of ballsNumber of non- blue balls=85.

o Therefore, the conditional probability is: P(A∣B)=P(B)P(A∩B)=5/85/8=1 This makes intuitive sense – if you know the ball isn't blue, and there are only red and blue balls, then it must be red. Bayes' Rule Consider a medical diagnostic problem. Suppose a certain disease (D) affects 1% of the population. There is a test (T) for this disease that has the following properties:

  • The test is positive for 90% of people who have the disease (P(T+∣D)=0.90). (Sensitivity)
  • The test is positive for 5% of people who do not have the disease (P(T+∣¬D)=0.05). (False Positive Rate) Now, suppose a person takes the test and it comes out positive. What is the probability that they actually have the disease? We want to find P(D∣T+). Using Bayes' Rule: P(D∣T+)=P(T+)P(T+∣D)P(D) We know:
  • P(T+∣D)=0.90 (Likelihood)
  • P(D)=0.01 (Prior probability of having the disease) We need to calculate P(T+), the overall probability of a positive test result. We can use the law of total probability: P(T+)=P(T+∣D)P(D)+P(T+∣¬D)P(¬D) We also know:
  • P(¬D)=1−P(D)=1−0.01=0.99 (Prior probability of not having the disease)
  • P(T+∣¬D)=0.05 (False positive rate) Now, let's calculate P(T+): P(T+)=(0.90)(0.01)+(0.05)(0.99)=0.009+0.0495=0. Finally, we can calculate the posterior probability P(D∣T+): P(D∣T+)=0.0585(0.90)(0.01)=0.05850.009≈0. So, even though the test is positive, the probability that the person actually has the disease is only about 15.38%. This example highlights how Bayes' Rule can be used to update our beliefs based on evidence, considering the prior probability of the event. Bayesian Networks Let's consider a simple Bayesian network for diagnosing a cold. We have three variables:
  • S: Sore Throat (Binary: Yes/No)
  • Hidden Layer: Two neurons. o Neuron h1 receives input x with weight w11 and has a bias b1. Its activation is a =sigmoid(w11x+b1). o Neuron h2 receives input x with weight w12 and has a bias b2. Its activation is a =sigmoid(w12x+b2). o The sigmoid function σ(z)=1+e−z1 is a common activation function that squashes the output between 0 and 1.
  • Output Layer: One neuron receiving inputs a1 and a2 with weights w21 and w22 respectively, and having a bias b3. Its output is y=sigmoid(w21a1+w22a2+b3). The output y (between 0 and
    1. can be interpreted as the probability of the image being a cat (e.g., if y>0.5) or a dog (if y≤0.5). Learning (Conceptual): Initially, the weights (w11,w12,w21,w22) and biases (b1,b2,b3) are set randomly. During training:
  1. The network is fed with training data (pixel intensity, and the correct label: cat or dog).
  2. The network makes a prediction y.
  3. The difference between the prediction y and the true label is calculated using a loss function.
  4. An optimization algorithm (like gradient descent with backpropagation) adjusts the weights and biases to minimize this loss, i.e., to make the network's predictions closer to the true labels. Over many training examples, the network learns to associate certain pixel intensities with the "cat" or "dog" class by adjusting the internal weights and biases. Brief Introduction of Fuzzy Logic Consider a simple temperature control system for a room using fuzzy logic. The input is the current temperature, and the output is the fan speed (low, medium, high). Linguistic Variables and Fuzzy Sets:
  • Temperature: o Fuzzy sets: "Cold", "Warm", "Hot" o Membership functions would define the degree to which a crisp temperature value (e.g., 20°C) belongs to each of these fuzzy sets. For instance: ▪ μCold(20)=0. ▪ μWarm(20)=0. ▪ μHot(20)=0.
  • Fan Speed:

o Fuzzy sets: "Slow", "Medium", "Fast" o Similarly, membership functions would define the degree to which a crisp fan speed value (e.g., RPM) belongs to these sets. Fuzzy Rules: We can define rules based on common sense:

  1. IF Temperature is Cold THEN Fan Speed is Slow.
  2. IF Temperature is Warm THEN Fan Speed is Medium.
  3. IF Temperature is Hot THEN Fan Speed is Fast. Fuzzy Inference Suppose the current temperature is 22°C. Let's say the membership degrees are:
  • μCold(22)=0.
  • μWarm(22)=0.
  • μHot(22)=0. Using the rules and a common inference method (Mamdani):
  1. The degree of activation for Rule 1 is min(μCold(22))=min(0.5)=0.5. This activates the "Slow" fan speed fuzzy set to a degree of 0.5.
  2. The degree of activation for Rule 2 is min(μWarm(22))=min(0.7)=0.7. This activates the "Medium" fan speed fuzzy set to a degree of 0.7.
  3. The degree of activation for Rule 3 is min(μHot(22))=min(0.1)=0.1. This activates the "Fast" fan speed fuzzy set to a degree of 0.1. Defuzzification: The resulting fuzzy sets for fan speed (clipped at the activation degrees) are then combined, and a defuzzification method (e.g., centroid method) is used to calculate a single crisp output value for the fan speed (e.g., a specific RPM). Brief Introduction of Genetic Algorithms (with Example) Consider the problem of finding the maximum value of a simple function, say f(x)=x2, within the range of 0 to 31. We can use a genetic algorithm to find an approximate solution. 1. Initialization:
  • We start with a population of candidate solutions. Let's represent each solution (a value of x) as a 5-bit binary string (since 25=32, which can represent numbers from 0 to 31).
  • Initial population (randomly generated): o 01101 (decimal 13)

maximum of the function within the given range. In this simple example, the maximum of x2 in the range [0, 31] occurs at x=31 (312=961), and the GA would iteratively try to find binary strings closer to '11111'.