AI Foundation
AI #
A selection of notes that didn’t fit elsewhere or are being worked on!.
Home
A selection of notes that didn’t fit elsewhere or are being worked on!.
This page is a quick reference of definitions + formulas, grouped by the modules.
Sample mean (ungrouped):
Trained using labelled data.
Each example in the training set includes the correct output.
The algorithm learns to generalise and make predictions on unseen data.
Generally more accurate than unsupervised methods.
Requires human intervention for labelling and setup.
Widely used due to its accuracy and efficiency.
Produces highly accurate results when trained on good-quality labelled data.
Output is discrete (e.g. Yes/No, Spam/Not Spam).
Used for categorising data into predefined classes.
Support Vector Machine (SVM) is a common classifier (a linear classifier with margin-based separation).
Learning how machines learn! My working notes as I learn AI.
flowchart LR
AI[Artificial Intelligence]
ML[Machine Learning]
DL[Deep Learning]
FM[Foundation Models]
LLM[LLM Models]
AI --> ML
ML --> DL
DL --> FM
FM --> LLM
style AI fill:#E1F5FE
style ML fill:#C8E6C9
style DL fill:#90CAF9
style FM fill:#64B5F6
style LLM fill:#FFCCBC
flowchart TD AI["Artificial<br/>Intelligence"] ML["Machine<br/>Learning"] NN["Neural<br/>Networks"] DL["Deep<br/>Learning"] FM["Foundation<br/>Models"] LLM["LLM<br/>Models"] AI --> ML ML --> NN NN --> DL DL --> FM FM --> LLM LR["Linear<br/>Regression"] DT["Decision<br/>Trees"] ML --> LR ML --> DT MLP["MLP"] CNN["CNN"] NN --> MLP NN --> CNN CNNDL["CNN<br/>(deep)"] RNN["RNN"] DL --> CNNDL DL --> RNN BERT["BERT"] CLIP["CLIP"] FM --> BERT FM --> CLIP GPT["GPT"] LLAMA["LLaMA"] LLM --> GPT LLM --> LLAMA TEXT["Text"] IMAGE["Images"] AUDIO["Audio"] VIDEO["Video"] LLM --> TEXT LLM --> IMAGE LLM --> AUDIO LLM --> VIDEO style AI fill:#90CAF9,stroke:#1E88E5,color:#000 style ML fill:#90CAF9,stroke:#1E88E5,color:#000 style NN fill:#90CAF9,stroke:#1E88E5,color:#000 style DL fill:#CE93D8,stroke:#8E24AA,color:#000 style FM fill:#CE93D8,stroke:#8E24AA,color:#000 style LLM fill:#C8E6C9,stroke:#2E7D32,color:#000 style LR fill:#C8E6C9,stroke:#2E7D32,color:#000 style DT fill:#C8E6C9,stroke:#2E7D32,color:#000 style MLP fill:#C8E6C9,stroke:#2E7D32,color:#000 style CNN fill:#C8E6C9,stroke:#2E7D32,color:#000 style CNNDL fill:#C8E6C9,stroke:#2E7D32,color:#000 style RNN fill:#C8E6C9,stroke:#2E7D32,color:#000 style BERT fill:#C8E6C9,stroke:#2E7D32,color:#000 style CLIP fill:#C8E6C9,stroke:#2E7D32,color:#000 style GPT fill:#C8E6C9,stroke:#2E7D32,color:#000 style LLAMA fill:#C8E6C9,stroke:#2E7D32,color:#000 style TEXT fill:#C8E6C9,stroke:#2E7D32,color:#000 style IMAGE fill:#C8E6C9,stroke:#2E7D32,color:#000 style AUDIO fill:#C8E6C9,stroke:#2E7D32,color:#000 style VIDEO fill:#C8E6C9,stroke:#2E7D32,color:#000

Keep this page as a quick reference of definitions + formulas.
Sample mean (ungrouped):
stateDiagram-v2
%% ===== CLASS DEFINITIONS (Math-based colours) =====
classDef algebra fill:#cfe8ff,stroke:#1e3a8a,stroke-width:1px
classDef probability fill:#d1fae5,stroke:#065f46,stroke-width:1px
classDef geometry fill:#ffedd5,stroke:#9a3412,stroke-width:1px
classDef logic fill:#ede9fe,stroke:#5b21b6,stroke-width:1px
classDef category font-style:italic,font-weight:bold,fill:#aaaaaa,stroke:#374151,stroke-width:3px
%% ===== ROOT =====
ML: Machine Learning
%% ===== SUPERVISED =====
ML --> SL:::category
SL: Supervised Learning
SL --> Regression
Regression --> LR:::algebra
LR: Linear Regression
LR --> NN:::algebra
NN: Neural Network
NN --> DT:::logic
DT: Decision Tree
SL --> Classification
Classification --> NB:::probability
NB: Naive Bayes
NB --> KNN:::geometry
KNN: k-Nearest Neighbours
KNN --> SVM:::algebra
SVM: Support Vector Machine
%% ===== UNSUPERVISED =====
ML --> USL:::category
USL: Unsupervised Learning
USL --> Clustering
Clustering --> KM:::geometry
KM: K-Means
KM --> GMM:::probability
GMM: Gaussian Mixture Model
GMM --> HMM:::probability
HMM: Hidden Markov Model
%% ===== REINFORCEMENT =====
ML --> RL:::category
RL: Reinforcement Learning
RL --> DM:::logic
DM: Decision Making
Used heavily when models rely on:
Generative Artificial Intelligence (GenAI) refers to a class of AI systems that can generate new content such as text, images, audio, video, or code, rather than only making predictions or classifications.
GenAI systems learn patterns and representations from large datasets and use them to produce novel outputs that resemble the data they were trained on.
| Traditional AI | Generative AI |
|---|---|
| Predicts or classifies | Generates new content |
| Task-specific models | General-purpose models |
| Fixed outputs | Open-ended outputs |
| Often rule-based | Data-driven and probabilistic |
Instead of learning “what label to assign”, Generative AI learns “how data is structured” and then creates new data following that structure.
| Step | Perceptron (Boolean/Logic) | Linear Regression Network | Binary Classification (Logistic) | DFNN / MLP (Classification) |
|---|---|---|---|---|
| 1. Input | Take binary or discrete inputs \( x_1, \dots, x_n \) | Take numerical features \( x \) | Take numerical features \( x \) | Take high-dimensional numerical or categorical features |
| 2. Weighted Sum | Single calculation: \( z = \sum (w_i x_i) + b \) | Single calculation: \( \hat{y} = w_0 + w_1 x \) | Single calculation: \( z = W x + b \) | Multiple stages: \( z^{[l]} = W^{[l]} a^{[l-1]} + b^{[l]} \) for each layer \( l \) |
| 3. Activation | Step Function: Output 1 if \( z \geq 0 \) , else 0 | Identity: The output remains \( z \) (no non-linear change) | Sigmoid: Maps \( z \) to a probability between 0 and 1 | ReLU for hidden layers; Softmax/Sigmoid for the output layer |
| 4. Loss / Error | Error = Target − Output | Mean Squared Error (MSE): \( J = \frac{1}{2N} \sum (Y - \hat{y})^2 \) | Binary Cross-Entropy (BCE): penalises based on probability distance | BCE or Categorical Cross-Entropy for multiple classes |
| 5. Optimisation | Update weights only on misclassification | Gradient Descent: compute gradients at initialization and update weights | Backpropagation: compute error signals \( \delta \) and gradients \( dW \) | Backpropagation: recursive chain rule to update all hidden layer weights |
| 6. Output | Discrete Boolean value (0 or 1) | Continuous numerical value (e.g., house prices) | Single probability score or class label | A vector of probabilities for multiple classes |
flowchart LR
%% Input Layer
subgraph subGraph0["Input Layer"]
I1(("Input 1"))
I2(("Input 2"))
I3(("Input 3"))
end
%% Hidden Layers
subgraph subGraph1["Hidden Layer 1"]
H1a(("H1-1"))
H1b(("H1-2"))
H1c(("H1-3"))
end
subgraph subGraph2["Hidden Layer 2"]
H2a(("H2-1"))
H2b(("H2-2"))
H2c(("H2-3"))
end
subgraph subGraph3["Hidden Layer 3"]
H3a(("H3-1"))
H3b(("H3-2"))
H3c(("H3-3"))
end
%% Output Layer
subgraph subGraph4["Output Layer"]
O(("Output"))
end
%% Connections: Input to Hidden Layer 1
I1 --> H1a & H1b & H1c
I2 --> H1a & H1b & H1c
I3 --> H1a & H1b & H1c
%% Connections: Hidden Layer 1 to Hidden Layer 2
H1a --> H2a & H2b & H2c
H1b --> H2a & H2b & H2c
H1c --> H2a & H2b & H2c
%% Connections: Hidden Layer 2 to Hidden Layer 3
H2a --> H3a & H3b & H3c
H2b --> H3a & H3b & H3c
H2c --> H3a & H3b & H3c
%% Connections: Hidden Layer 3 to Output
H3a --> O
H3b --> O
H3c --> O
%% Styling
style I1 fill:#C8E6C9
style I2 fill:#C8E6C9
style I3 fill:#C8E6C9
style H1a fill:#BBDEFB
style H1b fill:#BBDEFB
style H1c fill:#BBDEFB
style H2a fill:#90CAF9
style H2b fill:#90CAF9
style H2c fill:#90CAF9
style H3a fill:#64B5F6
style H3b fill:#64B5F6
style H3c fill:#64B5F6
style O fill:#FFCDD2
style subGraph0 stroke:none,fill:transparent
style subGraph1 stroke:none,fill:transparent
style subGraph2 stroke:none,fill:transparent
style subGraph3 stroke:none,fill:transparent
style subGraph4 stroke:none,fill:transparent
| Step | Perceptron (Boolean/Logic) | Linear Regression Network | Binary Classification (Logistic) | DFNN / MLP (Classification) |
|---|---|---|---|---|
| 1. Input | Binary/discrete inputs \( x_1, \dots, x_n \) | Numerical features \( x \) | Numerical features \( x \) | High-dimensional numerical or categorical features |
| 2. Weighted Sum | \( z = \sum (w_i x_i) + b \) | \( \hat{y} = w_0 + w_1 x \) | \( z = W x + b \) | \( z^{[l]} = W^{[l]} a^{[l-1]} + b^{[l]} \) |
| 3. Activation | Step: 1 if \( z \geq 0 \) , else 0 | Identity: output = \( z \) | Sigmoid: maps \( z \) to probability | ReLU (hidden), Softmax/Sigmoid (output) |
| 4. Loss / Error | Error = Target − Output | \( J = \frac{1}{2N} \sum (Y - \hat{y})^2 \) | Binary Cross-Entropy (BCE) | BCE or Categorical Cross-Entropy |
| 5. Optimisation | Update on misclassification | Gradient Descent | Backpropagation (single layer) | Backpropagation (multi-layer chain rule) |
| 6. Output | Boolean (0 or 1) | Continuous value | Probability score | Probability vector (multi-class) |
Deep Learning is the methodology, DNN is a model.
RL is learning by trial and error.
Reinforcement Learning (RL) is a type of machine learning where an autonomous agent learns to make decisions by interacting with an environment.
Instead of being told the correct answer, the agent:
Reinforcement Learning teaches an agent how to act, not what to predict.