AI Fundamentals: Project Cycle & Ethics
AI Fundamentals: Project Cycle & Ethics
Overview
Brief Overview
This note covering Artificial Intelligence Fundamentals was created from a PDF
document, 181 pages. It provides a comprehensive journey from the AI project cycle and
ethical frameworks to advanced modeling concepts, machine learning fundamentals,
computer vision basics, and NLP fundamentals, all structured for easy study and review.
Key Points
Understanding the AI project lifecycle and its six stages.
Exploring ethical frameworks that guide responsible AI design.
Grasping core machine learning concepts and evaluation metrics.
Delving into computer vision techniques and no‑code tools.
Learning NLP fundamentals, from tokenisation to sentiment analysis.
1.2 AI Domains 🌐
Statistical Data – Systems that collect large datasets, maintain them, and extract
meaningful insights for decision‑making.
Natural Language Processing (NLP) – Handles spoken and written human language,
extracting meaning and enabling interaction between computers and people.
Ethical Framework – A systematic approach that helps ensure AI choices do not cause
unintended harm, aligning decisions with moral principles.
The image highlights the need to weigh ethical considerations before releasing an AI
system.
1.4 Types of Ethical Frameworks
1.4.1 Sector‑Based Frameworks
Tailored to specific industries; they embed domain‑specific concerns (e.g., privacy in
finance, patient safety in healthcare).
Bioethics – Focuses on health‑care and life‑science applications.
1.4.2 Value‑Based Frameworks
Category Core Concern Typical Question
Rights‑Based Protection of human rights Does the system respect
and dignity individual autonomy?
Utility‑Based Maximising overall benefit, Do the benefits outweigh
minimising harm the societal risks?
Virtue‑Based Alignment with moral Are developers acting with
virtues (honesty, integrity throughout the
compassion) lifecycle?
Key traits:
Interconnected nodes enable hierarchical feature learning.
Efficient for large, unstructured data such as visual or audio streams.
AI provides the overarching goal, ML supplies the learning mechanism, and DL offers
the deep‑layered architecture for handling massive data volumes.
Supporting Visuals
The image symbolises the integration of human cognition (brain) with AI‑driven city‑scale
innovations, reinforcing the curriculum’s focus on societal impact.
The three coloured plus signs represent the collaborative, multi‑stakeholder approach
encouraged throughout the AI curriculum.
DL models are considered the most advanced form of AI because they can
self‑train on huge amounts of data and even devise their own internal
algorithms.
Two primary DL architectures mentioned:
Architecture Typical Use
Artificial Neural Network (ANN) General‑purpose pattern learning; e.g.,
recognizing a bird from pixel data.
Convolutional Neural Network (CNN) Image‑centric tasks; learns spatial
hierarchies such as edges → shapes →
objects.
Data Fundamentals 📊
Data – Information in any form that can be processed by a computer (tables, images,
sensor readings, etc.).
Training set – The collection of (usually labeled) examples the model learns from.
Learning Paradigms 🌱
Paradigm Data Requirement Goal
Supervised Learning Labeled data Map inputs → known
outputs (classification,
regression).
Unsupervised Learning Unlabeled data Discover hidden structure
(clustering, association).
Reinforcement Learning Interaction feedback Learn a policy that
(rewards/penalties) maximises cumulative
reward.
Visual Summary
The flowchart separates the three learning families and highlights their typical model
types.
Sub‑Categories
Subtype Output Type Example
Classification Discrete categories Spam vs. not‑spam, animal
species.
Regression Continuous value House price, temperature
forecast.
Shows the split between classification and regression under supervised learning.
Regression Example – House‑Price Prediction
Features: # bedrooms, carpet size, garage area.
Label: Sale price (continuous).
Reinforcement Learning 🚦
Reinforcement Learning (RL) – An agent interacts with an environment, receives a
reward signal, and learns a policy that maximises long‑term reward.
Structure:
1. Input Layer – Receives raw features; no processing occurs here.
2. Hidden Layers – Perform weighted summations and non‑linear
transformations; these layers are “hidden” from the user.
3. Output Layer – Produces the final prediction (class label, numeric
value, etc.).
Key Advantage: Ability to automatically extract features from raw data,
especially useful for high‑dimensional inputs like images.
Practical Checklist
Identify the learning paradigm before selecting a model (supervised ↔
unsupervised ↔ reinforcement).
Confirm data labeling: if labels exist, supervised methods are appropriate;
otherwise explore clustering or association.
Choose architecture based on task complexity:
Simple rule‑based logic for deterministic, low‑variability problems.
Deep neural networks (ANN/CNN) for image, speech, or large‑scale
pattern recognition.
Split data into training and testing sets to avoid overfitting and to gauge
real‑world performance.
The hidden layers perform the bulk of the computation; the number of hidden layers and
the number of nodes per layer depend on the complexity of the function the network
must learn.
The diagram visualises how information flows from the left‑most input neurons, through
two intermediate hidden layers, to the right‑most output neuron. Each connection carries
a weight that is tuned during training.
3.1 Perceptron Decision‑Making Example 🌦️
A perceptron is the simplest neural unit: it sums weighted inputs, adds a bias, and
compares the total to a threshold (often zero).
Input (X) Question Binary encoding
X1
“Do you have a jacket?” 1 = yes, 0 = no
X2
“Do you have an umbrella?” 1 = yes, 0 = no
X3
“Is it sunny now?” 1 = yes, 0 = no
X4 “Will it rain later 1 = yes, 0 = no
(forecast)?”
Assume the following weights (based on personal experience or preference) and a bias b:
w1 = 1.5
(jacket)
w2 = 1.0 (umbrella)
b = −0.3
Sum = 1.5(1) + 1.0(0) + 0.3(1) − 0.5(0) − 0.3 = 1.5 + 0 + 0.3 − 0.3 = 1.5 > 0
Sum = 1.5(0) + 1.0(1) + 0.3(0) − 0.5(1) − 0.3 = 1.0 − 0.5 − 0.3 = 0.2 > 0
Output = 1 → Go to the park (the bias is low enough that the umbrella outweighs the rain
forecast).
Changing the weights or bias directly changes the decision boundary, illustrating why
different people can reach opposite conclusions from the same factual inputs.
Students can visualise the same structure they are physically embodying.
The diagram shows the four steps from data division to evaluation, highlighting that the
test set must remain unseen during training to avoid over‑fitting.
3.4.2 Accuracy & Error
Accuracy
Accuracy =
Number of correct predictions
Total predictions
Error rate
Error = 1 − Accuracy
The figure visualises a 2 × 2 matrix with numbers 12, 06, 04, 21 representing TP, FN, FP, TN
respectively.
From the matrix we derive:
Precision = – proportion of positive predictions that are correct.
TP
TP + FP
TP + FN
captured.
F1‑Score = 2 × – harmonic mean of precision and recall.
Precision × Recall
Precision + Recall
These metrics are crucial when false negatives (e.g., missed disease) are more costly
than false positives.
| Predicted (USD) | Actual (USD) | ∣Error∣ = ∣Pred − Act∣ | Error Rate = | Accuracy =
Error
Actual
1 − Error Rate | |----------------|--------------|----------------|--------------------------|-----------
41 000
…|…|…|
Overall mean accuracy = average of the row‑wise accuracies (e.g., (0.9756 + 0.9842 +
0.9821 + … )/5 ).
Understanding which evaluation metric aligns with the business objective is essential for
model selection and tuning.
The matrix visualises how many “Yes” and “No” predictions were correct (green) and
incorrect (red).
Building the Confusion Matrix
1. Count rows where both Actual = Yes and Predicted = Yes → TP (top‑left cell).
2. Count rows where Actual = Yes but Predicted = No → FN (bottom‑left cell).
3. Count rows where Actual = No but Predicted = Yes → FP (top‑right cell).
4. Count rows where both Actual = No and Predicted = No → TN (bottom‑right
cell).
Cell Definitions
Cell Meaning Example from activity
TP Correctly predicted the Predicted “Yes” for a
positive class disease that was present.
TN Correctly predicted the Predicted “No” for a
negative class disease that was not
present.
FP Incorrectly predicted the Predicted “Yes” for a
positive class disease that was not
present.
FN Incorrectly predicted the Predicted “No” for a
negative class disease that was present.
Accuracy
Evaluation Ethics – Ensuring that chosen metrics, data splits, and reporting practices
do not introduce bias or hide harms.
Accountability – Metrics must reflect the real‑world impact; e.g., high accuracy
on a balanced test set may hide poor performance for a protected group.
Transparency – Clearly disclose which metrics are used and why; avoid hiding
low‑performing sub‑groups.
Fairness – Check that metric choices do not systematically disadvantage any
demographic.
Practice Activities & Self‑Check ✅
Activity Goal Key Takeaway
Activity 3 – Compute Demonstrates why The model attains 90 %
accuracy of a “always‑Yes” accuracy can be deceptive. accuracy despite never
classifier on an unbalanced predicting the negative
test set (900 Yes, 100 No) class.
Activity 4 – Select the Apply metric‑selection Recall is crucial because
most suitable metric for a reasoning. missing a fraudulent
fraud‑detection scenario transaction (FN) is far
costlier than flagging a
legitimate one (FP).
Test‑Yourself Questions – Reinforce formula Practice solidifies
Identify TP, FP, TN, FN application. understanding of each
from given matrices; cell’s meaning.
compute precision, recall,
F1‑score.
Case TP FP TN FN
Spam 150 50 750 50
detection
(1 000 emails)
Credit‑scoring 90 40 820 50
defaults (1 000
applicants)
Fraud 80 30 850 40
detection
(1 000
transactions)
Medical 120 20 800 60
diagnosis
(1 000
patients)
Inventory 100 50 800 0
out‑of‑stock
prediction
(1 000
products)
Metrics are computed using the formulas above; students should practice filling the table.
Benefits
1. Accessibility – Enables non‑technical users (e.g., doctors, marketers) to create
models.
2. Speed – Drag‑and‑drop pipelines can be assembled in minutes.
3. Cost‑Effective – Reduces the need for dedicated AI engineers.
Drawbacks
Issue Impact
Lack of Flexibility Custom algorithms or fine‑tuned
hyper‑parameters may be unavailable.
Automation Bias Users may over‑trust model suggestions
without critical review.
Security Concerns Platforms may offer limited control over
data protection; unsuitable for highly
sensitive datasets.
All formulas are presented in LaTeX syntax for clear mathematical representation. The
images are integrated to illustrate key concepts such as the confusion matrix, DNA as a
data‑science metaphor, code‑free interfaces, and AutoML pipelines.
5 – Computer Vision 📸
Computer Vision – The AI sub‑domain that enables machines to interpret, analyse,
and act upon visual information (images, video, infrared, etc.) in a way that mimics
human perception.
Feature Extraction – The process of turning raw pixels into meaningful descriptors
(edges, corners, textures) that a model can use.
Object Detection – Locating and classifying objects within an image, often producing
bounding boxes.
Ethical note – Even visual models can inherit bias from training images; always audit
datasets for representation and privacy concerns.
5.5 Orange Data Mining – Step‑by‑Step Vision Workflow
The following workflow builds a price‑prediction model for a zoo’s animal‑feed budget.
The same sequence applies to any supervised vision task (e.g., classifying penguin
species).
1. Download the dataset (FAO Food Price Index).
2. Open Orange → double‑click the Orange icon.
The initial view shows a blank canvas where widgets will be placed.
3. Upload the dataset – drag the File widget (Data → File) onto the canvas and
browse to the CSV file.
The green arrows illustrate moving a widget from the left panel to the central
canvas.
4. Inspect the data – connect File → Data Table and open the table to verify that
the target variable is Food Price Index.
The table view confirms correct column selection; the diagram hints at the
upcoming pipeline.
5. Select the model – add the Linear Regression widget (Model → Linear
Regression) and connect it to File.
The red‑circled “Linear Regression” node indicates the algorithm chosen for
regression.
6. Evaluate performance – place Test & Score (Evaluate → Test & Score) and link
both File and Linear Regression to it.
The diagram visualises the split into training and hold‑out test sets, followed by
metric calculation.
7. Generate predictions – add the Prediction widget, connect it to Test & Score,
and inspect the output table for the forecasted price index.
The final prediction can be exported or used to inform the zoo’s budgeting
plan.
Mind‑Map Activity – Students created a digital mind map (see image below) to
organise where mean, median, and mode appear in real‑life contexts (e.g., average
temperature, most common shoe size).
The visual shows how statistical ideas interlink, reinforcing their relevance to data‑driven
AI.
4. Run the Regression via Data → Data Analysis → Regression; set Distance as
the dependent variable and Speed as the independent variable.
5. Interpret the output – the coefficient for Speed gives the slope; the intercept
is the constant term. Use the equation Distance = β + β × Speed to predict
0 1
Feature Overview
Feature Description
Culmen Length Length of the penguin’s bill (mm).
Culmen Depth Depth of the bill (mm).
Flipper Length Length of the wing‑like flipper (mm).
Body Mass Weight of the bird (g).
Sex Male / Female (categorical).
Confusion matrix example (from a previous classification task)
The matrix visualises true/false positives and negatives, from which precision, recall, and
F1 can be derived.
TP
Precision =
TP + FP
TP
Recall =
TP + FN
TP + TN
Accuracy =
TP + TN + FP + FN
Ethical reminder – Report all relevant metrics; a high overall accuracy can mask poor
performance on minority species in the penguin dataset.
5.10 Test‑Yourself
# Question Answer
1 Define feature extraction in Transforming raw pixel
a single sentence. data into informative
descriptors such as edges
or colour histograms.
2 Which metric is most Recall
appropriate when false
negatives are far more
harmful than false
positives?
3 In Orange, which widget Scatter Plot
visualises the relationship
between two numeric
variables?
4 List two advantages of Rapid prototyping and
no‑code tools for accessibility for
computer‑vision projects. non‑technical users.
5 Name three statistical Mean pixel intensity,
concepts that help assess variance (or standard
the quality of an image deviation), and outlier
dataset. detection.
6 True or false: The Linear False
Regression widget can be
used for classification
tasks.
7 What does the Data It creates a random subset
Sampler widget do? of the loaded data for
quicker experimentation.
8 Provide the formula for F 1
F1 = 2 ×
Precision + Recall
Construction Steps
1. Build a vocabulary of all unique tokens across the corpus.
2. For each document, count the occurrences of each vocabulary term →
frequency vector.
Strengths – simple, fast, works well for many classic text‑classification tasks.
Limitations – loses contextual information; high‑dimensional for large
vocabularies.
Formula
$ \text{TF‑IDF}(t,d) = \underbrace{\frac{\text{count}(t,d)}{\text{total words in }d}}
{\text{Term Frequency (TF)}} \times \underbrace{\log!\left(\frac{N}{\text{df}(t)}\right)}
{\text{Inverse Document Frequency (IDF)}} $
where
t= term, d = document,
N = total number of documents,
df(t)= number of documents containing term t .
Interpretation – Frequently occurring words in a specific document get high
weight, while ubiquitous words across many documents (e.g., “the”) receive low
weight.
Sentiment analysis – the process of classifying textual opinion into categories such as
positive, negative, or neutral.
Typical workflow
1. Pre‑process text (tokenise, remove stop‑words).
2. Convert to BoW or TF‑IDF vectors.
3. Train a supervised classifier (e.g., logistic regression, SVM).
4. Evaluate using accuracy, precision, recall, or F1‑score.
Applications – brand monitoring, customer support triage, market research.
All formulas are presented in LaTeX syntax for clarity. The notes maintain the same visual
style (bold keywords, blockquote definitions, tables) as earlier sections, enabling seamless
integration into the overall study guide.
Computers only understand binary; NLP bridges the gap between human intent
and machine‑readable data.
The goal is to enable seamless human‑computer communication.
The flowchart visualises the automatic identification of the most frequent and meaningful
words that define each article’s topic.
Purpose: Highlight the most informative terms in a text corpus, useful for
summarisation, content recommendation, and market‑trend analysis.
Each red box represents a processing stage; arrows indicate the sequential flow from raw
text to nuanced understanding.
Chatbot – a software program that simulates conversation with users via text or voice,
handling queries, troubleshooting, lead generation, and sales support.
6.10 Quiz 📋
Statement Answer
NLP primarily deals with numeric, textual, ✔︎
image, and visual data.
Sentiment analysis expresses an opinion ✔︎
as positive, negative, or neutral.
First NLP stage is Lexical Analysis. ✔︎
“Stop words” are high‑frequency terms ✔︎
with little semantic value.
Discourse integration identifies ✘ (it links sentences).
individual words.
Implementation outline
Step Action
1. Collect & preprocess documents. e.g., three short sentences about “Aman”,
“Avni”, and “chatbot”.
2. Build a dictionary of unique tokens. {aman, avni, stressed, went, download,
health, chatbot, therapist}
3. Create document vectors – count
occurrences of each dictionary term per
document.
4. Assemble the vocabulary‑frequency
matrix.
The resulting matrix supplies the raw numerical input for downstream ML algorithms.
total words in d
Inverse Document Frequency (IDF)
N
IDF(w) = log! ( )
df(w)
Interpretation
High TF + low DF → high TF‑IDF → word is specific and informative for that
document (e.g., “pollution” in a pollution‑focused article).
High DF across all documents → low IDF → the term behaves like a stop word
(e.g., “and”).
6.18 Test‑Yourself
# Question Correct Answer
1 Primary challenge for Complexity of human
computers in languages
understanding human
language?
2 How do voice assistants To understand natural
use NLP? language
3 Which step is not part of Document summarisation
Text Normalisation?
4 Purpose of tokenisation? To segment sentences
into smaller units
5 What distinguishes Lemmatization produces
lemmatization from meaningful words after
stemming? affix removal, while
stemming does not
6 Main goal of the To extract features from
Bag‑of‑Words model? text for machine‑learning
algorithms
7 In TF‑IDF, stop words are … Words with frequent
occurrence in the corpus
that are often removed
during preprocessing
8 Rare, valuable words … Occur the least but add
the most value to the
corpus
The matrix does not aggregate frequencies across the whole corpus, count
total words, or compute average word length.
Correct answer: frequency of each word in a single document (option B).
Assertion / Reasoning
Assertion: Pragmatic analysis involves assessing sentences for practical
applicability.
Reasoning: It requires understanding nuanced meaning and logical
implications, not just literal semantics.
Both statements are true, and the reasoning correctly explains the assertion (option A).
Both the assertion and the reasoning are true, and the reasoning explains the assertion
(option A).
TF‑IDF Applications 📈
Application How TF‑IDF Helps
Document Classification Provides discriminative term weights for
classifiers (e.g., Naïve Bayes, SVM).
Search Engine Ranking Scores query‑document similarity based
on weighted term overlap.
Topic Modelling Highlights terms that uniquely define each
topic.
Spam Detection Emphasises rare words that are
characteristic of spam messages.
1. Pre‑process
Lowercase, remove punctuation, tokenise.
Doc Tokens
D1 johnny johnny yes papa
D2 eating ug?r? no papa
D3 telling lies no papa
D4 open mot mouth hal hal hal
2. Build Vocabulary
{johnny, yes, papa, eating, ug?r?, no, telling, lies, open, mot, mouth, hal}
(12 unique terms)
DF(t)
) with N = 4 :
Term IDF
johnny log! (
4
1
) = log 4
yes log 4
papa log! (
4
3
) = log
4
3
eating log 4
ug?r? log 4
no log! (
4
2
) = log 2
telling log 4
lies log 4
open log 4
mot log 4
mouth log 4
hal log 4
3
≈
0.288 .)
6. TF‑IDF weights (TF × IDF)
Term D1 D2 D3 D4
johnny 2!×! log 4 0 0 0
yes 1!×! log 4 0 0 0
papa 1!×! log
4
3
1!×! log
4
3
1!×! log
4
3
0
eating 0 1!×! log 4 0 0
ug?r? 0 1!×! log 4 0 0
no 0 1!×! log 2 1!×! log 2 0
telling 0 0 1!×! log 4 0
lies 0 0 1!×! log 4 0
open 0 0 0 1!×! log 4
These weighted vectors can now be used for similarity scoring, classification, or
clustering.