All guides
Practice now
Extra · Additional content

Machine Learning fundamentals

The AI-901 tests the base concepts of ML: learning types, tasks (regression, classification, clustering), the training and inference workflow, and evaluation metrics. No need to write code.

What is Machine Learning?

is a branch of AI in which systems learn patterns from data without being explicitly programmed with rules. Instead of if temperature > 38 then fever, the system learns that rule (and thousands more) by analyzing millions of patient records.

Traditional programming

data + rules → answers

The programmer defines the rules manually. Scales poorly: impossible to cover every real-world case.

Machine Learning

data + answers → rules

The system learns the rules from the data. Scales well: the more data, the better the model.

Essential exam vocabulary

Feature

An input variable the model uses to predict. E.g.: age, income, payment history.

Label

The output variable we want to predict. E.g.: approved/rejected, house price.

Training data

A dataset with known features and labels used to train the model.

Inference

Using the trained model to make predictions on new data (production).

Model

The result of training — the set of learned parameters that transforms features into predictions.

Algorithm

The mathematical method used to learn from the training data. E.g.: linear regression, random forest, neural network.

vs vs Reinforcement

🏷️

Supervised Learning

You train with LABELED data — each example has the correct answer. The model learns to map features → label.

Typical tasks

  • Regression (predicting a number)
  • Binary classification (yes/no)
  • Multiclass classification (category A/B/C/D)

Real-world examples

Price prediction, spam detection, disease diagnosis, image recognition.

🗂️

Unsupervised Learning

You train with UNLABELED data — the model discovers structure and patterns on its own.

Typical tasks

  • Clustering (grouping by similarity)
  • Dimensionality reduction
  • Anomaly detection

Real-world examples

Customer segmentation, data compression, topic discovery in texts.

🎮

Reinforcement Learning

The model (agent) learns by taking ACTIONS in an environment and receiving REWARDS or PENALTIES. It optimizes its strategy over time.

Typical tasks

  • Games (achieving maximum score)
  • Robotics (controlling movements)
  • Optimization (routes, trading)

Real-world examples

AlphaGo, robot control, data center optimization, trading bots.

— predicting a continuous number

Regression predicts a continuous numeric value. The answer can be any number within a range. Examples: house price, tomorrow's temperature, next month's sales.

Common algorithms

Linear regression

Fits a straight line to the data. Simple and interpretable.

Polynomial regression

Fits curves for non-linear relationships.

Random Forest (Regression)

Combines multiple decision trees — more robust.

Gradient Boosting

Trees in sequence, each correcting the errors of the previous one.

Evaluation metrics

MAE — Mean Absolute Error

Average of absolute errors. Easy to interpret: "on average I'm off by $X".

MSE — Mean Squared Error

Average of squared errors. Penalizes large errors more than MAE.

RMSE — Root Mean Squared Error

Square root of MSE. Same unit as the target — more interpretable than MSE.

R² (R-squared)

How much the model explains the variance of the target. 1.0 = perfect, 0 = no better than the mean.

— predicting a category

Classification predicts which discrete category a data point belongs to. The answer is a class: spam/not spam, positive/negative/neutral, cat/dog/bird.

Binary classification

Only 2 possible classes. The output is a probability between 0 and 1.

Email: spam (1) vs not spam (0)

Transaction: fraud (1) vs legitimate (0)

Medical test: positive (1) vs negative (0)

Loan: approved (1) vs rejected (0)

Multiclass classification

3 or more possible classes. The model assigns a probability to each class.

Sentiment: positive / negative / neutral

Handwritten digit: 0, 1, 2, ... 9

Species: cat / dog / bird / fish

Support: billing / technical / sales

Key evaluation metrics

Accuracy (overall accuracy)

Percentage of correct predictions. ⚠️ Misleading with imbalanced classes: if 99% of emails are legitimate, a model that always says "legitimate" has 99% accuracy without detecting any spam.

Precision

Of all the ones it predicted as positive, how many are actually positive? High precision = few false positives.

Recall (Sensitivity)

Of all the ones that are actually positive, how many did it detect? High recall = few false negatives. Critical in medicine (not missing sick patients).

F1 Score

Harmonic mean of Precision and Recall. Balances both metrics — useful when classes are imbalanced.

— finding groups without labels

Clustering is unsupervised learning. There are no training labels — the algorithm discovers groups of similar data on its own. Useful when you don't know in advance how many categories exist.

👥

Customer segmentation

Group customers by purchasing behavior without knowing in advance how many segments exist. Each cluster is analyzed afterward to define strategies.

📄

Document grouping

Identify recurring topics in thousands of support articles without manually labeling them. The clusters reveal the most frequent themes.

⚠️

Anomaly detection

Points that don't belong to any cluster (outliers) are candidates for anomalies: fraudulent transactions, errors in industrial sensors.

Exam trap

Clustering is unsupervised — you don't need labels. If the scenario mentions that "the categories aren't known in advance" or "groups need to be discovered", it's clustering. If there are labels and you want to predict a category, it's classification.

— deep neural networks

Deep Learning is a branch of Machine Learning based on artificial neural networks with multiple hidden layers. It learns hierarchical representations of data — detecting edges → shapes → objects in images, or words → phrases → meaning in text.

Anatomy of a neural network

Input layer

Receives the input data (features). One node per feature.

→

Hidden layers

Hidden layers that learn representations. More layers = "deeper" = deep learning.

→

Output layer

Produces the final prediction (a number for regression, probabilities for classification).

Neuron (node)

The basic unit. Receives inputs, applies an activation function, emits an output.

Weight

An adjustable value that weighs the importance of each connection between neurons. The model learns the optimal weights.

Activation function

ReLU, sigmoid, tanh — introduces non-linearity so the network can learn complex patterns.

Backpropagation

Training algorithm: calculates the error, propagates it backward, adjusts the weights to minimize it.

CNN — Convolutional Neural Networks

Specialized for data with spatial structure: images and video. They detect local patterns (edges, textures) via convolutional filters and combine them into higher-level representations.

Image and object recognition

Visual classification (Azure Custom Vision uses CNNs)

Disease detection in medical images

Facial recognition

RNN / LSTM — Recurrent Neural Networks

Specialized for sequential data where order matters. They have internal "memory" that connects information from previous steps. LSTM (Long Short-Term Memory) solves the long-dependency problem.

Machine translation (before the Transformer)

Time series prediction

Sequential text generation

Classic speech recognition

Classic ML vs Deep Learning

Classic ML (regression, random forest…)

Requires manual feature engineering. Works well with little data. More interpretable.

Deep Learning (neural networks)

Learns features automatically. Needs large volumes of data and GPUs. Better at images, audio, and unstructured text.

architecture

The Transformer (Google, 2017 — the "Attention is All You Need" paper) replaced RNNs as the dominant architecture in NLP and later in vision. It processes the entire sequence in parallel instead of step by step, which allows for massive scaling and capturing long-range relationships in text.

Key components

Self-Attention

Allows each token in the sequence to "attend" to all other tokens simultaneously. Captures semantic relationships regardless of distance.

Multi-Head Attention

Multiple attention mechanisms in parallel, each focused on different aspects of the relationships between tokens.

Positional Encoding

Injects information about the position of each token in the sequence, since the Transformer processes in parallel and has no inherent notion of order.

Feed-Forward layers

Dense layers that process each token independently after attention. They learn non-linear transformations.

Variants by use case

Encoder-only (BERT)

Processes text in both directions. Ideal for comprehension: sentiment classification, NER, semantic search.

Decoder-only (GPT)

Generates text left to right (autoregressive). Ideal for generation: completion, chat, code. GPT-4, Phi, and Llama are decoder-only.

Encoder-Decoder (T5, BART)

Combines both parts. Ideal for transformations: translation, summarization, question answering.

Tokenization

The Transformer doesn't process letters or words — it processes tokens (text fragments). "Azure" might be 1 token; "extraordinary" might be 3-4. GPT-4o handles up to 128,000 tokens of context.

Why the Transformer dominates

Parallelization

Processes the entire sequence at once, not token by token. Allows training with thousands of GPUs simultaneously.

Scale

More parameters and data means more capacity. GPT-2: 1.5B params. GPT-4: estimated >1T. RNNs didn't scale this way.

Transfer learning

You pre-train once on trillions of texts (base model). Then fine-tune for each specific task.

ML workflow

1

1. Data collection

Gathering relevant historical data with sufficient volume and quality. Garbage in, garbage out — data quality determines model quality.

2

2. Data preparation

Cleaning null values, removing duplicates, normalizing features, encoding categorical variables, splitting into train/validation/test sets.

3

3. Feature selection (Feature Engineering)

Choosing which features to include, transforming existing variables, creating new features that capture relevant patterns.

4

4. Model training

The algorithm processes the training set and adjusts its internal parameters to minimize prediction error. In Azure: Azure ML, AutoML.

5

5. Model evaluation

Measuring performance on the validation set (data the model didn't see during training). Adjust hyperparameters if needed.

6

6. Deployment and inference

Publishing the model as a REST endpoint. New data goes in, predictions come out. In Azure: Managed Online Endpoints / Batch Endpoints.

Evaluation metrics — summary

MetricTask typeMeasures
MAE / RMSERegressionAverage error in numeric predictions
R²RegressionWhat % of the variance the model explains (0-1)
AccuracyClassification% of correct predictions (watch out for imbalanced classes!)
PrecisionClassificationOf the predicted positives, how many are actually positive
RecallClassificationOf the actual positives, how many the model detected
F1 ScoreClassificationBalance between Precision and Recall
AUC-ROCBinary classificationHow well the model separates the two classes (0.5 = chance, 1.0 = perfect)

Overfitting and Underfitting

📉

Underfitting

The model is too simple. It doesn't learn well enough — it fails on both training data and new data.

Cause

Model too simple, too few features, insufficient training

Solution

More complex model, more features, more training time

✅

Good fit

The model generalizes well. Low error on both training data and new data. The goal.

📈

Overfitting

The model memorizes the training data instead of learning patterns. Excellent on training, poor on new data.

Cause

Model too complex, too little training data

Solution

More data, regularization (L1/L2), dropout, early stopping

Key for the exam

Train/validation/test split is the fundamental tool for detecting overfitting. If the model has 98% accuracy on training and 60% on validation → overfitting. The classic solution: more data or a simpler model.

Did you get this topic?

Test what you just learned

A company trains a medical image classification model. The model reaches 99% accuracy on the training data but only 61% on new data from the hospital. What is the problem and what is the most appropriate solution?

Ready to test "Classical Machine Learning fundamentals"?

Put what you learned to the test with original AI-901 exam questions.

Start AI-901 mock exam

Unlimited mock exams with the Pro plan

Log in to track your progress.