0% found this document useful (0 votes)
3 views10 pages

Artificial Intelligence (AI) Course Notes

The document provides comprehensive AI course notes organized by modules, covering definitions, explanations, examples, and exam-focused content drawn from authoritative sources. It discusses foundational concepts of AI, intelligent agents, problem-solving through search, and probabilistic reasoning, along with their advantages and disadvantages. Additionally, it introduces machine learning, detailing supervised and unsupervised learning methods and their applications.
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)
3 views10 pages

Artificial Intelligence (AI) Course Notes

The document provides comprehensive AI course notes organized by modules, covering definitions, explanations, examples, and exam-focused content drawn from authoritative sources. It discusses foundational concepts of AI, intelligent agents, problem-solving through search, and probabilistic reasoning, along with their advantages and disadvantages. Additionally, it introduces machine learning, detailing supervised and unsupervised learning methods and their applications.
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

Artificial Intelligence (AI) Course Notes

These notes cover the AI syllabus comprehensively, organized by modules. Each topic/subtopic includes a
concise definition, in-depth explanation, examples, formulas, edge cases, advantages/disadvantages,
typical exam questions, and memory aids. Figures and flowcharts illustrate key concepts; tables compare
algorithms; and 1-page summaries conclude each module. All content is drawn from authoritative AI/ML
sources (e.g. Russell & Norvig, IBM, scikit-learn, IEEE) and is exam-focused. Citations are provided for
definitions and factual claims.【59†L111-L114】【48†L185-L193】

Module 1: Foundations and Theoretical Approach

Introduction to AI

• Definition: Artificial Intelligence is generally defined as the study of agents that perceive an
environment through sensors and act upon it to achieve goals. Formally, “AI is the branch of
computer science dealing with the construction of computational artifacts to carry out tasks in the
real world”【1†L1-L8】. AI systems aim to mimic or exceed human cognitive abilities – learning,
reasoning, perception, language understanding, and problem solving【59†L111-L114】【1†L1-L8】.
• Goals: Key AI goals include rational behavior (maximizing goals), human-like performance, and
theoretical understanding of intelligence【15†L166-L174】【59†L111-L114】. Agents may be
designed for specific tasks (weak/narrow AI) or general intelligence (strong AI).
• History: Foundations include logic, probability, optimization, neuroscience, and linguistics. Early
work (Turing, McCarthy) set goals like chess-playing and theorem-proving. Modern AI spans
knowledge-based systems, machine learning, robotics, vision, NLP, etc.

• Current State: Today’s AI includes deep learning in vision/speech, self-driving cars, recommendation
systems, and large language models (LLMs). Key methods: rule-based (expert systems), search-based
problem solving, statistical learning, and neural networks.

• Benefits vs Risks: AI offers benefits such as automation of tedious tasks, higher efficiency, and
solving complex problems (e.g. medical diagnosis, climate modeling)【11†L28-L37】【13†L173-
L182】. For instance, AI can accelerate research by finding patterns in data that humans cannot
see. Drawbacks/Risks include high cost, loss of jobs through automation, and ethical issues (bias,
lack of transparency). AI systems are often opaque (“black boxes”)【13†L199-L208】 and can
perpetuate bias if trained on flawed data【13†L225-L233】. Asimov’s Laws (fictional) capture early
ethical intuitions: no harm to humans, obey humans, protect itself【45†L232-L240】. Real-world
AI ethics focus on fairness, accountability, transparency and privacy.

• Example: A Smart Vacuum Agent: perceives floor cleanliness, acts to clean dirt. If it cleans a square
or moves, it earns points. As a rational agent, it maximizes cleanliness over time【16†L255-L264】.
If after cleaning it still moves randomly, it is suboptimal if there is a cost for movement – illustrating
that rational behavior depends on the performance measure【16†L278-L286】.

1
Exam Questions: Define AI and discuss its goals and current applications (6–10 marks); Compare advantages
and risks of AI (6 marks).

Memory Aid: Think “PERFORM” – Perceive (sensors), Environment, Rational, Forecast, Optimize, Response,
Measure.

Intelligent Agents

• Agent & Environment: An agent is any entity that perceives its environment via sensors and acts
upon it via actuators【7†L29-L33】. For example, a robotic vacuum has sensors for dirt and buttons
(actuators) to move/suck. An agent’s percept is its sensory input at a time, and an agent function maps
percept sequences to actions (Figure: Agent Architecture).

Environment percepts Agent Program actions Actuators -> Environment

• Task Environment: Environments have properties that affect agent design. Common categories
【15†L166-L174】:
• Fully vs Partially Observable: If sensors give complete state info, the world is fully observable;
otherwise partially observable (e.g. foggy self-driving).
• Deterministic vs Stochastic: In a deterministic environment, actions have predictable outcomes; in
stochastic, they don’t (e.g. dice rolls).
• Episodic vs Sequential: Episodic tasks are independent episodes (e.g. classification tasks); sequential
tasks have long-term consequences (e.g. chess).
• Static vs Dynamic: Static if environment doesn’t change while agent thinks; dynamic otherwise (e.g.
real-time stock market).
• Discrete vs Continuous: State variables and time can be discrete or continuous.

• Single-agent vs Multi-agent: One agent or many interacting (societies, markets).

• Rationality & Performance: A rational agent selects actions to maximize expected performance
measure, given its percepts and knowledge【16†L255-L263】. Performance is measured over time
(e.g. cleanliness score for vacuum). Perfect rationality is often impossible (omniscience is unrealistic
【16†L299-L308】), so agents use the best strategy given limited info. A rational agent might act
suboptimally if its sensors lack data – still it is rational given its knowledge.

• Agent Types: Agents can be implemented by:

• Simple Reflex Agents: act only on current percept with condition-action rules. E.g. if dirty, clean.
• Model-based Reflex: keep internal state to handle partial observability.
• Goal-based: also consider future (e.g. planning to reach goal).
• Utility-based: optimize a utility function (ranking states).

• Learning agents: adapt via experience to improve.

2
• Example: A Vacuum Cleaner Agent on two squares (A and B). A simple reflex agent that cleans if
dirty, else moves, is rational if performance is measured by total cleaned squares over time
【16†L255-L263】. However, if movements cost points, the agent should stop moving once clean.
Different performance measures or environments lead to different rational behavior【16†L278-
L286】.

Advantages: Agent-based design allows modularity and adaptation; can integrate knowledge and learning.

Disadvantages: Designing the right architecture and performance measure can be hard; agents might
conflict in multi-agent settings (game theory).

Exam Question: Explain the concept of a rational agent and describe agent types. How does environment
determinism affect agent design? (8 marks).

Memory Aid: “S.P.E.N.U.L.” – Sensors, Percepts, Environment, Noisy (or not), Utility, Learning.

Solving Problems by Search

• Problem-Solving Agent: A classic AI approach models problems as a search in state space. A


problem is defined by initial state, actions, successor function, and goal test. The agent uses search
algorithms to find a sequence of actions (a solution path) from start to goal【48†L185-L193】.

• Uninformed Search: These algorithms use no problem-specific knowledge beyond the problem
definition. Key examples:

• Breadth-First Search (BFS): Explores level by level. Implements a FIFO queue. It finds the shallowest
(least-cost) solution in a state-space with uniform step cost【48†L185-L193】. BFS is complete (if
solution exists at finite depth) and optimal for equal-cost steps【48†L185-L193】. Complexity: time
and space O(b^d) where b=branching factor, d=depth of solution【48†L177-L185】. BFS uses a lot of
memory (stores all frontier nodes).

• 【32†embed_image】 Figure: BFS Tree Example. BFS from root A visits nodes level-by-level【48†L185-
L193】. In contrast:

◦ Depth-First Search (DFS): Explores a path fully before backtracking. Uses a LIFO stack
(recursion). DFS is memory-efficient (O(bd) space) but not guaranteed complete if cycles or
infinite branches exist【48†L197-L200】. It is not optimal (may find a deeper solution first).
Worst-case time O(b^m) (m=maximum depth). For infinite-depth spaces, DFS may never find
a solution【48†L197-L200】.

• Uniform-Cost Search: Expands lowest-cost frontier first (uses priority queue). Complete and optimal
for any positive step cost. Worse time/space than BFS if costs vary.

• Depth-Limited/Iterative Deepening: DFS with a depth limit, or repeatedly deepening to guarantee


completeness like BFS with less memory.

3
• Informed Search (Heuristic): Uses heuristic functions h(n) estimating cost from node n to goal. The
best-known is A* search: f(n) = g(n) + h(n), where g(n)=path cost so far, h(n)=estimated remaining
cost【64†L153-L160】. If h(n) is admissible (never overestimates true cost), A is optimal*【64†L123-
L132】【64†L153-L160】.

• Admissible Heuristic: h(n) ≤ actual least cost to goal (h*(n)). For example, in 8-puzzle, Manhattan
distance is admissible【64†L125-L134】【64†L188-L197】.

• Consistent (Monotonic) Heuristic: h(n) ≤ cost(n, n') + h(n') for every action; guarantees optimality
without re-opening nodes.

• Example: Maze solving with BFS (guaranteed shortest path) vs DFS (faster memory but may go down
a long dead-end). If a heuristic (like Euclidean distance to exit) is used with A*, the search is focused.

• Complexity Summary: Uninformed searches have exponential time in depth. BFS: time/space
O(b^d)【48†L177-L185】; DFS: time O(b^m) (m=max depth) but space O(bd)【48†L197-L204】. A*’s
complexity depends on heuristic quality.

• Edge Cases: Infinite or cyclic graphs: BFS must check repeated states to avoid loops. DFS can get
stuck; iterative deepening or bidirectional search help. Uniform cost fails if costs can be zero or
negative. A* fails optimality if h is not admissible (it may miss the true optimum)【64†L153-L160】.

• Advantages: Search algorithms are general problem solvers. BFS/DFS are simple to implement; A*
effectively uses problem structure via heuristics.

• Disadvantages: Exponential time and memory in large spaces. Finding good heuristics can be hard.
Without heuristics, many problems are intractable.

Exam Question: Compare BFS and DFS in terms of completeness, optimality and complexity (8 marks). Explain
A* search and the role of an admissible heuristic (10 marks).

Memory Aid: “FIFO vs LIFO”: Breadth uses queue (FIFO), Depth uses stack (LIFO). A = “Always True*”?
(optimal if h admissible).

Quantifying Uncertainty

• Probability Basics: Probability theory models uncertainty quantitatively. A random variable X has a
probability distribution P(X). Conditional probability: P(A|B)=P(A∧B)/P(B). Bayes’ Theorem: allows
inverting conditioning:

$$P(H|E) = \frac{P(E|H)\,P(H)}{P(E)}.$$

This gives the probability of a hypothesis H given evidence E【62†L259-L264】. For example, probability of
disease given a positive test. Bayes’ rule is central to probabilistic AI inference【62†L259-L264】.

• Naive Bayes Classifier: A simple probabilistic classifier assuming features X are conditionally
^=
independent given class Y【22†L139-L144】. It predicts class by maximizing posterior: y

4
arg maxy P (y) ∏i P (xi ∣y)【22†L154-L162】. Despite its “naïve” assumption, it often works well in
practice (spam filtering, text classification)【22†L139-L144】【20†L231-L239】.

• Probabilistic Reasoning: In more complex domains, we use graphical models (Bayesian Networks)
to represent joint distributions efficiently. A Bayesian network is a directed acyclic graph where
nodes are random variables and edges denote direct probabilistic dependencies【18†L79-L82】.
Each node has a Conditional Probability Table (CPT) given its parents. Inference (computing
posteriors given evidence) can be done exactly (e.g. Variable Elimination) or approximately (e.g.
Gibbs sampling/MCMC)【18†L185-L193】.

• Example (Rain/Sprinkler): A classic BN has variables Cloudy → Sprinkler, Cloudy → Rain, and
Sprinkler & Rain → WetGrass【18†L79-L88】. If you observe WetGrass = True, you can infer higher
probability of Rain or Sprinkler via Bayes’ rule. Notably, if you then observe Sprinkler=on, belief in
Rain decreases (“explaining away” phenomenon)【18†L137-L145】.

• Formulas: Key probabilistic formulas include: joint probability P (x, y)


= P (x)P (y∣x);
marginalization P (x) = ∑y P (x, y); and Bayes’ rule above. In decision trees, entropy H(S) =
− ∑i pi log pi and information gain IG(S, A) = H(S) − ∑v (∣Sv ∣/∣S∣)H(Sv ) measure splits (see
ID3).

• Advantages: Probabilistic models can handle uncertainty and noise, combine evidence, and update
beliefs with new data. They provide principled confidence estimates.

• Disadvantages: Exact inference in general BNs is NP-hard, and specifying probabilities (CPTs) can be
challenging. Independence assumptions (e.g. Naive Bayes) may be unrealistic. Bayesian methods
require careful handling of low probabilities and zero priors (additive smoothing for Naive Bayes).

Exam Question: State and explain Bayes’ theorem with an example. Describe the structure of a Bayesian network
and how inference is done (10 marks).

Memory Aid: “Bayes Fixes Flips” – Bayes Formula Inverts conditional probabilities.

Module 1 Summary

• AI Definition & Goals: Agents maximizing goals in uncertain environments【16†L255-L263】


【59†L111-L114】. Scope: perception, reasoning, learning.
• Intelligent Agents: Sensors → Percepts → Decision-making → Actions【7†L29-L33】. Rationality:
maximize performance measure given percepts【16†L255-L263】.
• Environments: Characterize by observability, determinism, dynamics, etc. Rational agent design
depends on environment type.
• Search: State-space search is core problem-solving. Uninformed search (BFS: level-by-level,
guaranteed optimal for equal costs【48†L185-L193】; DFS: deep-then-backtrack) vs informed (A: uses
h(n), optimal if h* admissible【64†L123-L132】【64†L153-L160】). Complexity generally exponential
in depth.

5
• Uncertainty: Probabilistic reasoning lets agents handle uncertainty. Bayes’ theorem inverts evidence
【62†L259-L264】; Bayesian networks model variable dependencies. Naive Bayes assumes
independence【22†L139-L144】.

Module 2: AI Application Development and Ethics

Learning from Examples (Introduction to ML)

• Definition: Machine Learning (ML) is the AI subfield that learns from data to make predictions or
decisions without being explicitly programmed for every scenario【56†L1-L4】【59†L111-L114】. It
focuses on algorithms that improve performance (inference, classification, regression) by
generalizing from examples. ML encompasses supervised, unsupervised, semi-supervised and
reinforcement learning.

• Supervised Learning: Algorithms are trained on labeled data (input-output pairs). The goal is to
predict the correct label for new inputs. Two main types: Classification (categorical outputs) and
Regression (continuous outputs)【40†L43-L52】. Common classifiers: K-Nearest Neighbors (KNN),
Naive Bayes, Logistic Regression, Decision Trees, SVMs. Common regressors: Linear Regression, etc.

• Unsupervised Learning: Algorithms infer structure from unlabeled data. Main tasks: Clustering
(group similar data, e.g. K-means), Association (find rules like “if A then B”), and Dimensionality
Reduction (PCA, feature learning)【40†L68-L77】.

• Reinforcement Learning: An agent learns by interacting with an environment and receiving


rewards or penalties. The goal is to maximize cumulative reward (e.g. game playing, robot control).

• Example: Spam email detection (supervised): learn from emails labeled spam/not spam to classify
new emails. Customer segmentation (unsupervised clustering): group customers by purchase
history.

• Advantages: ML can handle complex patterns and large data; it improves with more data (especially
deep learning). Once trained, models can make fast predictions.

• Disadvantages: Requires lots of data and tuning. Models may overfit (perform well on training but
poorly on unseen data). They can encode biases present in data. Many ML models are “black boxes”,
raising interpretability issues.

Exam Question: What is supervised learning? Distinguish classification and regression with examples (6 marks).
What is unsupervised learning? (4 marks).

The Machine Learning Landscape

• AI, ML, DL Relationship: AI is a broad field; ML is a subset of AI using data-driven learning


【59†L111-L114】. Deep Learning (DL) is a subfield of ML using multi-layer neural nets.

• Learning Settings:

6
• Batch vs Online: Batch learning trains on fixed dataset; online/streaming updates model
incrementally.
• Feature Engineering: Traditional ML often needs human-designed features. Deep learning
automatically learns features.

• Evaluation Methods: Important to use train/test splits or cross-validation to assess generalization.

• Model Landscape:

• Supervised algorithms: Decision Trees, Random Forests, SVMs, Neural Networks. Each has trade-
offs (see table below).
• Unsupervised: k-means, hierarchical clustering, Gaussian mixture models.
• Ensembles: Boosting (AdaBoost) and bagging (Random Forest) combine multiple models for
robustness.

Algorithm Complexity Memory Pros Cons

O(n·d) per
k-NN High (data) Simple, no training Slow at test, high mem
query

Decision Can overfit (need


~O(n·d·log n) Moderate Interpretable, fast
Tree pruning)

Good accuracy (small Slow training, poor on


SVM (RBF) O(n^2)–O(n^3) High (n^2)
n) large n

Large
Neural Net O(iter·n·d) Powerful, flexible Hard to tune, opaque
(weights)

(n = number of examples, d = features)

• Model Evaluation: Use confusion matrix for classification (TP, FP, TN, FN)【26†L212-L219】. From it
derive precision, recall, F1-score. ROC curves plot True Positive Rate vs False Positive Rate at
thresholds【28†L171-L179】. A model’s Area Under ROC (AUC) measures discriminative power. Be
wary of imbalanced data: accuracy can be misleading if one class dominates【26†L263-L270】.

Memory Aid: “SLUDR” – Supervised, Learning, Unsupervised, Deep learning, Reinforcement.

Classification

• Definition: Supervised task of assigning instances to discrete categories (classes)【40†L43-L52】.


The model learns from labeled examples. Example: classifying tumors as benign/malignant.

• Methods:

• k-Nearest Neighbors (k-NN): Classify by majority vote of k closest training examples.


• Naive Bayes: Probabilistic classifier using Bayes’ theorem with feature independence assumption
【22†L139-L144】. Computes posterior P (y∣x) ∝ P (y) ∏i P (xi ∣y). Good for text classification;
simple and fast.

7
• Logistic Regression: Models log-odds linearly: P (Y = 1∣x) = σ(wT x + b). Binary classification
with probabilistic output (sigmoid).
• Decision Trees: See next section.

• Support Vector Machines: Find hyperplane separating classes with maximum margin (kernelizable).

• Metrics: Besides confusion matrix【26†L212-L219】 and ROC【28†L171-L179】, compute accuracy,


precision (TP/(TP+FP)), recall (TP/(TP+FN)), and F1-score.

• Advantages: Many algorithms (esp. tree-based or linear) scale well and can be interpreted.
Probabilistic methods output confidences.

• Disadvantages: Overfitting (trees, high-dimensional data), sensitivity to noise. Some (k-NN) scale
poorly with data size. No free lunch: one must choose algorithm to fit data patterns.

Exam Question: Describe how the Naive Bayes classifier works. What is the role of the independence
assumption? (6 marks).

Memory Aid: “K2 Tree Sat” – k-NN, Naive Bayes, Trees, SVM.

Decision Trees

• Definition: A decision tree is a hierarchical model for classification (or regression) that splits data by
feature tests at internal nodes and assigns class labels at leaves【24†L139-L144】. It is a non-
parametric, white-box supervised method.

• ID3 Algorithm (Example): Build tree top-down. At each node, evaluate all candidate features using
information gain (entropy reduction)【66†L151-L159】. Split on feature with highest gain (purest
partitions). Recursively repeat on subsets. Stop when all instances are same class or no features left
【66†L165-L173】. Result: if a test instance follows the path of splits to a leaf, it is labeled with that
leaf’s class.

• Advantages:

• Interpretable: Easy to visualize and explain (if–then rules)【24†L150-L158】.


• Little data prep: No need to normalize or create dummy vars【24†L150-L158】.

• Handles numerical/categorical features.

• Disadvantages:

• Overfitting: Trees can become very complex. Pruning or depth limits are needed【24†L181-L189】.
• Instability: Small data changes can yield different trees【24†L186-L193】.
• Bias: Trees can be biased towards features with many levels. Balancing may be needed.

• Suboptimality: Finding the true optimal tree is NP-hard【24†L193-L202】.

8
• Example: Classify animals. Root split: “Does it fly?” If yes (Bird, Bats), if no (reptile/mammal branch).
Each split reduces uncertainty.

• Common Formulas: Entropy H(S) = − ∑c p(c) log2 p(c). Information Gain IG(S, A) =
∣Sv ∣
H(S) − ∑v∈values(A) ∣S∣ H(Sv ).

Exam Question: Explain how a decision tree is built using the ID3 algorithm. What are its main advantages and
disadvantages? (10 marks).

Memory Aid: “Ask Entropy” – Information gain = Entropy(before) – weighted Entropy(after).

Ethics of AI

• Privacy: AI often requires large personal datasets. Ethical use demands data protection. Models
should comply with regulations (e.g. GDPR).
• Fairness & Bias: AI systems can inherit bias from training data, leading to unfair outcomes (e.g.
biased loan approvals). Transparent algorithms and diverse data can mitigate bias.
• Accountability: Who is responsible for AI decisions? Laws and standards are evolving to ensure
accountability.
• Transparency: “Black box” models (deep nets) are hard to interpret. Explainable AI is important for
trust.
• Asimov’s Laws: Fictionally suggested basic AI ethics:
• A robot may not harm a human or allow harm through inaction.
• It must obey humans unless conflicting with (1).

• It must protect itself unless conflicting with (1) or (2)【45†L232-L240】.


These illustrate safety constraints, though real AI ethics are broader (privacy, consent, impact on
society).

• Example Issues:

• Social media recommendation algorithms creating filter bubbles.


• Face recognition errors more likely on some demographic groups.
• Autonomous vehicles’ decision dilemmas in crashes.

Exam Question: Discuss two ethical issues in AI and suggest how they might be addressed. (6 marks).

Memory Aid: “PAST-FA” – Privacy, Accountability, Safety, Transparency, Fairness, Accuracy.

Module 2 Summary

• Machine Learning: Subset of AI using data-driven algorithms【56†L1-L4】【40†L43-L52】. Main


types: supervised (classification/regression), unsupervised (clustering, association), reinforcement.
• Classification: Assign inputs to categories. Key algorithms: Naive Bayes【22†L139-L144】, k-NN,
logistic regression, SVMs, decision trees. Evaluate with confusion matrix【26†L212-L219】, ROC
【28†L171-L179】, etc.

9
• Decision Trees: Hierarchical if–then rules. Built using metrics like information gain【66†L151-
L159】. Pros: interpretable, no heavy data prep【24†L150-L158】; Cons: overfitting, instability
【24†L181-L189】.
• Ethics: Critical in AI deployment. Must ensure fairness, privacy, and transparency. Fictional laws
(Asimov) stress “no harm to humans”【45†L232-L240】. Real-world ethics requires governance and
oversight.

Downloadable Materials: The above content is also available in a structured PDF format for printing/
studying.

10

You might also like