Richfield Faculty of Information Technology

Machine Learning 600 Study Hub

A dark, readable one-page revision site built from the Machine Learning 600 study guide, covering exam focus areas first and the full chapter flow after that.

Definitions Correct patterns Exam traps Model risks Algorithms & structure

Exam Focus Areas

Start here when you need the high-yield distinctions: learning type, data preparation choice, model family, evaluation metric, and the common traps that make an answer weak.

Exam Focus Guide Chapters 1-5

Exam Overview

The module moves through the full machine learning pipeline: understand the problem, prepare the data, select a learning type, train a model, evaluate it, and explain the result.

Focus What to know Typical exam angle
ML foundations Models, supervised learning, unsupervised learning, reinforcement learning, feature engineering. Choose the correct learning type for a scenario.
Model fit Overfitting, underfitting, bias, variance, precision, recall, F1 score. Diagnose why a model performs badly on training or unseen data.
Preprocessing Structured vs unstructured data, missing values, outliers, duplicates, scaling. Select the cleaning or scaling method before modelling.
Algorithms Linear, polynomial, decision tree regression, logistic regression, k-NN, SVM, k-means, hierarchical clustering, DBSCAN. Compare how algorithms work, what they predict, and where they fail.
Definitions Learning types

ML Foundations: What Kind of Problem Is It?

Machine learning builds models that learn relationships from data rather than being explicitly programmed for every rule. The learning type depends mainly on whether the training data has labels and what kind of output is expected.

Learning type Input situation Output Guide example
Supervised Labeled input-output pairs. Prediction or class. House prices, spam detection, iris species.
Unsupervised No predefined labels. Hidden patterns or groups. Customer segmentation, anomaly detection.
Reinforcement Agent interacts with an environment. Actions improved by rewards or penalties. Game playing and robotics.
Exam trap: Regression and classification are both supervised. The difference is the output: continuous number for regression, discrete label for classification.
Model risks Metrics

Model Fit, Correctness, and Bias-Variance

A useful answer goes beyond "accuracy is high". The guide stresses generalization, confusion-matrix thinking, and the balance between model complexity and error.

  • Underfitting: model is too simple and performs badly even on training data.
  • Overfitting: model learns noise and performs well on training data but poorly on unseen data.
  • High bias: systematic error from a too-simple model.
  • High variance: sensitivity to small fluctuations in the training data.
Correct pattern: Use precision when false positives matter, recall when false negatives matter, and F1 score when both need a balanced view.
Correct patterns Pipeline

Preprocessing: Clean Before You Train

Real datasets contain missing values, outliers, duplicates, inconsistent scales, and mixed data types. Preprocessing improves reliability before algorithms try to learn patterns.

  1. Understand whether the data is structured or unstructured.
  2. Handle missing values with removal, statistical imputation, or predictive imputation.
  3. Deal with outliers by removal, transformation, robust scaling, or capping.
  4. Remove duplicates so repeated records do not bias the model.
  5. Scale features for distance-based and margin-based models.
Exam trap: Decision trees are generally not affected by feature scaling, but k-NN and SVM can be strongly affected because they use distance or margins.
Dimensionality PCA

PCA: Reduce Dimensions Without Just Deleting Columns

Principal Component Analysis transforms the original features into new axes called principal components. These components are linear combinations of the original features and capture directions of maximum variance.

Scale dataFeatures contribute equally
Find varianceDirections with most information
Rotate axesPrincipal components
Choose components90-95% variance target
Transform dataLower-dimensional representation
Correct pattern: Use scree plots, cumulative explained variance, or cross-validation to choose how many components to keep.
Supervised Continuous output

Regression: Predict a Number

Regression predicts continuous numerical outcomes. The guide uses house price prediction to compare linear regression, polynomial regression, and decision tree regression.

Algorithm Best when Risk
Linear Regression The relationship is roughly linear and interpretability matters. Underfits non-linear patterns.
Polynomial Regression The relationship is curved but still modelled with feature powers. High-degree polynomials can overfit.
Decision Tree Regression You need interpretable rules and non-linear splits. Can overfit and cannot extrapolate beyond the training range.
Supervised Discrete labels

Classification: Predict a Category

Classification assigns inputs to discrete labels. The guide covers logistic regression, k-NN, SVM, multiclass classification, regularization, and metrics.

  • Logistic regression: strong interpretable baseline for binary classification.
  • k-NN: predicts by majority vote among nearby training points.
  • SVM: finds a margin-maximizing hyperplane; kernels handle non-linear patterns.
  • Metrics: accuracy, precision, recall, F1 score, and ROC curve.
Exam trap: Accuracy alone can hide weak performance on imbalanced data. Always connect the metric to the cost of false positives or false negatives.
Unsupervised Pattern discovery

Clustering: Find Groups Without Labels

Clustering groups similar observations when there is no ground-truth label. It is useful for segmentation, anomaly detection, image segmentation, and document categorization.

Algorithm Main idea Important limitation
k-Means Assign points to nearest centroid and update centroids until stable. Requires k and assumes fairly simple cluster shapes.
Hierarchical Builds nested clusters, often shown with a dendrogram. Linkage choice affects cluster structure.
DBSCAN Finds dense regions and marks noise points. Depends heavily on eps and min_samples.

General Module Content

Chapter-by-chapter notes from the study guide. All content is visible by default so you can scroll, scan, and jump directly from the menu or exam focus cards.

Chapter 1: Introduction to Machine Learning

1.1 Overview of Machine Learning

Machine learning is a subfield of artificial intelligence focused on models that learn from data to make predictions without being explicitly programmed for every case. It is used in healthcare, finance, marketing, autonomous systems, cybersecurity, education, agriculture, and entertainment.

Core idea: ML is one part of a broader data workflow that includes collecting, cleaning, transforming, modelling, and evaluating data.

1.2 Modeling

A model represents relationships between variables. In ML, the model learns those relationships from data and can improve as more data becomes available.

  • Business model: profit from revenue and expenses.
  • Recipe model: servings linked to ingredient quantities.
  • Poker model: probability of winning based on revealed cards.

1.3 Types of Machine Learning

The guide separates machine learning by the nature of the available data and output.

SupervisedLabeled data: classification or regression
UnsupervisedNo labels: clusters or anomalies
ReinforcementRewards and penalties from an environment

1.4 Overfitting and Underfitting

Underfitting happens when a model is too simple to capture the real pattern. Overfitting happens when a model is so complex that it learns noise instead of the underlying pattern.

Problem Training performance Unseen-data performance Typical fix
Underfitting Poor Poor Use richer features or a more flexible model.
Overfitting Very strong Poor Simplify, regularize, prune, or add more data.
Good generalization Strong enough Strong enough Balance complexity and error.

1.5 Correctness

Correctness is not just accuracy. The guide uses the confusion matrix to separate prediction outcomes into true positives, false positives, false negatives, and true negatives.

  • Precision: of the predicted positives, how many were correct?
  • Recall: of the actual positives, how many were found?
  • F1 score: harmonic mean that balances precision and recall.
Scenario logic: In medical diagnosis, high recall may matter most because false negatives are dangerous. In spam detection, high precision may matter because false positives can hide important mail.

1.6 The Bias-Variance Tradeoff

Bias is error from a model being too simple. Variance is error from a model being too sensitive to training-data fluctuations. A good model balances both so it generalizes to new data.

Reduce variance: simplify the model, increase training data, or use regularization such as L1/L2 penalties.

1.7 Feature Engineering

Feature extraction transforms raw data into usable numerical representations. Feature selection identifies the most relevant features so the model avoids unnecessary complexity.

  • Extraction: text to vectors, image pixels or edges to numeric features.
  • Selection: statistical filter methods, wrapper methods, recursive feature elimination, forward selection.

1.8 Real-World Applications

The guide lists ML uses in healthcare, finance, retail, transportation, manufacturing, cybersecurity, NLP, education, agriculture, and entertainment.

Memory hook: ML is valuable when large volumes of data can reveal patterns that improve prediction, automation, personalization, or anomaly detection.

1.9 Introduction to Python ML Libraries

The guide introduces NumPy for arrays and numerical computing, Pandas for DataFrame-based dataset work, Scikit-learn for ML models, and Matplotlib for visualizations.

import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression

df = pd.read_csv("iris.csv")
X = df.drop(columns=["species"])
y = df["species"]

X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, random_state=42
)

model = LogisticRegression()
model.fit(X_train, y_train)
print(model.score(X_test, y_test))

Chapter 2: Data Preprocessing and Feature Engineering

2.1 Understanding Datasets

Before applying ML algorithms, understand the data type, structure, and quality. Structured data is organised in rows and columns. Unstructured data includes text, images, audio, and video.

Data type Format Typical tools or techniques
Structured Tables, spreadsheets, CSV, JSON, XML. SQL, Pandas, standard ML algorithms.
Unstructured Text, image, audio, video. NLP, image analysis, deep learning approaches.

2.2 Data Cleaning

Data cleaning handles missing values, inconsistencies, errors, outliers, and duplicates so the dataset becomes reliable enough for model training.

  • Missing Completely at Random: missingness is independent of observed and missing data.
  • Missing at Random: missingness depends on observed data.
  • Missing Not at Random: missingness depends on the missing value itself.
from sklearn.impute import SimpleImputer

imputer = SimpleImputer(strategy="mean")
df.iloc[:, :] = imputer.fit_transform(df)

2.2.2-2.2.3 Outliers and Duplicates

Outliers are unusually distant values. They can be errors or genuine extreme cases. Duplicates repeat observations and can skew the model.

import numpy as np

data = np.array([10, 12, 13, 15, 1000])
filtered_data = data[data < np.percentile(data, 95)]

df.drop_duplicates(inplace=True)

2.3 Feature Scaling and Normalization

Scaling puts features on comparable ranges. It is important when a model uses distances, gradients, or margins, as with k-NN and SVM.

from sklearn.preprocessing import MinMaxScaler, StandardScaler

data = [[100, 200], [300, 400], [500, 600]]

scaled = MinMaxScaler().fit_transform(data)
standardized = StandardScaler().fit_transform(data)
Exam trap: Scaling should be fitted on the training data, then applied to test data. Do not let test data influence preprocessing choices.

2.4 Principal Component Analysis

PCA is a dimensionality reduction technique that creates principal components, which are new axes capturing maximum variance. It reduces high-dimensional data while preserving as much useful information as possible.

  • Reduces computational cost.
  • Can reduce overfitting risk by removing noisy dimensions.
  • Improves interpretability and visualization for high-dimensional data.

2.4.3 Choosing Principal Components

The explained variance ratio tells how much variance each principal component captures. The cumulative explained variance helps decide how many components to keep.

Method How it is used
Scree plot Look for the elbow point where extra components add little value.
Variance threshold Keep enough components to explain about 90-95% of variance.
Cross-validation Try different component counts and compare model performance.

2.5 Applications of PCA

The guide applies PCA to visualizing high-dimensional data such as the breast cancer dataset and to image feature extraction through eigenfaces. PCA can produce a better representation than raw pixel distances for some analysis tasks.

Important interpretation: PCA components are not original columns. They are weighted combinations of original features, so meaning must be explained carefully.

Chapter 3: Supervised Learning - Regression Algorithms

3.1 What Is Supervised Learning?

Supervised learning uses labeled input-output pairs. The model learns a function from features to a target and adjusts its parameters to minimize prediction error.

  • Labeled data: each example has known features and a known target.
  • Learning function: the model approximates the relationship.
  • Error minimization: training reduces the gap between predictions and actual values.

3.2 Regression

Regression is supervised learning for continuous numerical outcomes. The guide uses examples such as house prices, stock prices, and sales revenue forecasting.

Fast test: If the answer can vary along a number line, think regression. If the answer is a category, think classification.

3.3 Linear Regression

Linear regression assumes a straight-line relationship between independent variables and the target. The slope shows how much the output changes for a unit change in the input; the intercept is the predicted output when the input is zero.

import numpy as np
from sklearn.linear_model import LinearRegression

X = np.array([1200, 1500, 1800, 2100, 2500]).reshape(-1, 1)
y = np.array([220, 270, 320, 370, 420])

model = LinearRegression()
model.fit(X, y)
print(model.predict([[2000]]))

3.4 Polynomial Regression

Polynomial regression handles non-linear relationships by adding higher-degree terms. It is more flexible than linear regression but can overfit when the degree is too high.

from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression

poly_model = make_pipeline(
    PolynomialFeatures(degree=2),
    LinearRegression()
)
poly_model.fit(X, y)

3.5 Decision Tree Regression

Decision tree regression splits the data into branches based on feature values. Each leaf predicts a value, usually the average outcome in that region.

  • Easy to visualize for small trees.
  • Does not require feature scaling.
  • Can overfit if the tree grows too deep.
  • Cannot extrapolate beyond the range of the training data.
Control complexity: use pre-pruning parameters such as max_depth, max_leaf_nodes, or min_samples_leaf.

3.6 Hands-On Exercise: House Price Prediction

The practical task is to load a housing dataset, preprocess missing values and scales, train linear, polynomial, and decision tree models, evaluate with R2 score and MAE, and visualize predictions against actual values.

Load dataHousing dataset
PreprocessMissing values and scaling
TrainLinear, polynomial, tree
EvaluateR2 and MAE
VisualizePredicted vs actual

Chapter 4: Supervised Learning - Classification Algorithms

4.1 Classification

Classification predicts categorical outcomes. A decision boundary separates categories in feature space. Common applications include fraud detection, automated decision-making, and medical diagnostics.

4.2 Logistic Regression

Logistic regression is a linear classification algorithm that predicts the probability of class membership. It is commonly used as an interpretable baseline for binary classification.

from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score

model = LogisticRegression()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print(accuracy_score(y_test, y_pred))

4.3 k-Nearest Neighbors

k-NN stores the training dataset and classifies a new point by looking at the majority class among its k closest neighbors, often using Euclidean distance.

  • Lazy learning: no heavy training phase.
  • Distance based: scaling matters.
  • Curse of dimensionality: performance can weaken with many features.
from sklearn.neighbors import KNeighborsClassifier

knn = KNeighborsClassifier(n_neighbors=5)
knn.fit(X_train, y_train)
print(knn.score(X_test, y_test))

4.4 Support Vector Machines

SVM finds a hyperplane that maximizes the margin between classes. Support vectors are the closest points that define this margin. Kernel methods such as RBF help with non-linear separation.

Parameter trap: In Logistic Regression and LinearSVC, larger C means less regularization and a more flexible model. Smaller C means stronger regularization and a simpler model.

4.4.1 Strengths, Weaknesses, and Parameters

Linear models train and predict quickly, scale well to large and sparse datasets, and are easy to express mathematically. Their coefficient interpretation can become unclear when features are highly correlated.

  • Use L1 regularization when only a few features are expected to matter.
  • Use L2 regularization as the usual default when many features may contribute.
  • Search regularization values on a logarithmic scale.

4.4.2 Evaluation Metrics for Classification

Classification metrics explain different kinds of correctness.

Metric Meaning Use when
Accuracy Overall proportion of correct predictions. Classes are balanced and errors have similar cost.
Precision Correct predicted positives divided by all predicted positives. False positives are costly.
Recall Correct predicted positives divided by all actual positives. False negatives are costly.
F1 score Harmonic mean of precision and recall. You need a balanced precision-recall summary.
ROC curve Tradeoff between sensitivity and specificity. You need to compare thresholds.

Chapter 5: Unsupervised Learning - Clustering Algorithms

5.1 Introduction

Unsupervised learning finds patterns in unlabeled data. It is useful when labels are unavailable but hidden structure may still support segmentation, anomaly detection, or exploration.

5.2 Clustering

Clustering groups similar data points so intra-cluster similarity is high and inter-cluster similarity is low. Cluster labels are arbitrary: cluster 0 does not inherently mean anything until you inspect the group.

Exam trap: Clustering produces group assignments, but there is no ground-truth label by default. Do not interpret cluster numbers as meaningful names without analysis.

5.3 k-Means Clustering

k-Means is a centroid-based algorithm. It chooses k centroids, assigns points to the nearest centroid, updates centroids to the mean of assigned points, and repeats until cluster assignments stop changing.

  1. Choose the number of clusters k.
  2. Randomly initialize k centroids.
  3. Assign each point to its nearest centroid.
  4. Update each centroid using the mean of its assigned points.
  5. Repeat until convergence.
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler

df_scaled = StandardScaler().fit_transform(df)
kmeans = KMeans(n_clusters=3, random_state=42)
df["Cluster"] = kmeans.fit_predict(df_scaled)

5.4 Hierarchical Clustering

Hierarchical clustering creates nested clusters shown as a tree-like dendrogram. Agglomerative clustering starts with each point as its own cluster and merges the most similar clusters until the stopping condition is reached.

  • Ward: minimizes variance increase and often creates similar-sized clusters.
  • Average: uses average distance between all points in two clusters.
  • Complete: uses the smallest maximum distance between points in two clusters.

5.5 Density-Based Clustering (DBSCAN)

DBSCAN identifies dense regions and separates noise points. It does not require a predefined k and can find arbitrary-shaped clusters.

  • eps: neighborhood radius.
  • min_samples: minimum points needed to form a dense region.
  • Noise: points not assigned to a dense cluster.
from sklearn.cluster import DBSCAN

dbscan = DBSCAN(eps=0.5, min_samples=5)
df["DBSCAN_Cluster"] = dbscan.fit_predict(df_scaled)

5.6 Clustering Evaluation Metrics

Because clustering is unsupervised, ordinary accuracy is not the main evaluation method. The guide lists internal evaluation methods.

Metric Meaning
Silhouette Score Measures how well-separated and cohesive clusters are.
Davies-Bouldin Index Lower values indicate better cluster separation.
Elbow Method Helps choose k for k-means by looking for diminishing improvement.

5.6.1 Failure Cases of k-Means

k-Means can fail even when the correct number of clusters is known because it assumes clusters are represented well by centers, have simple convex shapes, and have similar diameter.

Weakness: k-Means struggles with stretched, uneven-density, or complex-shaped clusters because it only considers distance to the nearest center.

Final Revision Tables

Use these to check your answer framing quickly before an assessment.

Algorithm Selector

Need Use Reason
Predict a continuous number Regression Output is numeric and continuous.
Predict a label Classification Output is a discrete class.
Find groups with no labels Clustering Output is hidden structure.
Reduce many features PCA Captures variance with fewer components.
Classify by nearby examples k-NN Uses majority vote among nearest neighbors.
Detect dense clusters and outliers DBSCAN Works by density and labels noise points.

Common Exam Traps

  • Calling classification "regression" because logistic regression has regression in the name.
  • Using accuracy only when the dataset is imbalanced.
  • Forgetting that k-NN and SVM are scale-sensitive.
  • Assuming PCA keeps original features instead of creating new components.
  • Assuming cluster numbers have semantic meaning by themselves.
  • Expecting decision tree regression to extrapolate beyond training data.
  • Choosing k-means when clusters are complex-shaped or uneven in density.

Mini Pipeline Cheat Sheet

ProblemWhat output is needed?
DataStructured or unstructured?
PreprocessClean, scale, engineer
ModelTrain and tune
EvaluateMetric matched to risk

Metric Memory Hook

Question Metric
How many predictions were correct overall? Accuracy
When the model says positive, how often is it right? Precision
Of all real positives, how many did it catch? Recall
How do I balance precision and recall? F1 score
How well are clusters separated? Silhouette Score