Hong Kong Baptist University · S1 2026 · FACULTY OF COMPUTER SCIENCE

MATH7005 Data Analytics with Programming

- one subject, every graph, every model, every mark
10 Chapters44-page Bible
Our own words - no uploaded lecturer files
Built to mirror S1 2026 · updated this semester
The Complete Study & Assessment Guide · 2026 T1

MATH7005 Overview

Data Analytics with Programming
— Compute the result, test the implementation, then explain what the data product can and cannot support.
  • Hong Kong Baptist University
  • Semester 1, 2026-27
  • Postgraduate taught course
  • Individual data-product assessment
  • Live demonstration without slides

What this course asks you to build

MATH7005 Data Analytics with Programming is organised around an individual, open-ended data product.

  • Assessment shape A short video pitch prepares an individual project built around a final report, working code, live product demonstration and follow-up questions.
  • Technical spine Classification losses lead into optimisation, neural networks, convolution and Transformer attention, with each result checked numerically.
  • Project habit Trace one record from public data through preprocessing and the model to a product action, then expose one failure case.
  • Where to confirm Use the course LMS for the released marking criteria, current submission settings and the precise late-November project schedule.
MATH7005 · Hong Kong Baptist University
An independent, AskSia-authored study guide. AskSia is not affiliated with, endorsed by, or sponsored by Hong Kong Baptist University; the course code and name are used for identification only.
Assessment

How MATH7005 is assessed

ComponentWeightFormat
Assignment10%Three-minute video pitch using voice-over slides, establishing the proposed data-product context; due 26 October
Project90%Final report with coding, ten-minute live demonstration without slides and approximately twenty-minute question-and-answer session in late November

The official course surface publishes these two components, and their numeric weights total 100%. The available materials say detailed marking criteria will be released later. Confirm the released brief, current submission settings and the precise late-November project schedule on the course LMS.

Assessment structure

10%90%AssignmentProject

The published component weights total 100%.

Current dates · verify in LMS

Current MATH7005 dates

DateItemControl
26 October 2026Assignment video pitchDue date published on the course assessment surface for this offering.

Dates are as published in the captured official course assessment surface for the current offering. Confirm exact deadlines and submission settings in the live LMS.

Contents · every chapter, one map

What MATH7005 covers

The guide moves from classification outputs and losses through optimisation, network architecture and gradient flow to convolution, attention and efficient Transformer methods.

01

Logistic Models and Sigmoid Scores

linear scores, sigmoid outputs, thresholds and stable computation

Three layers of one prediction

Logistic classification begins with a linear score, maps that score through the sigmoid and only then applies an operational threshold.

  • Linear score and intercept
  • Sigmoid range and monotonicity
  • Probability and odds
  • Decision thresholds
  • Coefficient interpretation
  • Stable extreme-score computation
02

Cross-Entropy and Likelihood

true-class probabilities, batch losses and maximum likelihood

Loss reads probability assigned to truth

Binary cross-entropy selects the probability of the observed label and takes its negative logarithm. Correct confident predictions receive small losses, while confident mistakes dominate a batch.

  • Entropy and cross-entropy
  • Binary label cases
  • True-class probability
  • Batch sum and mean
  • Maximum likelihood connection
  • Logarithm stability
03

Softmax and Multiclass Prediction

stable normalisation, categorical loss and class-axis checks

One distribution from competing scores

Softmax exponentiates a vector of class logits and divides by one shared sum, producing positive probabilities that add to one.

  • Class logits
  • Softmax normalisation
  • Maximum subtraction
  • Categorical cross-entropy
  • Class-axis dimensions
  • Top-two decision margin
04

Gradient Descent and Adaptive Optimisers

iterative updates, momentum, RMSProp, ADAM and diagnostics

Training as repeated local movement

Gradient descent computes the current loss slope and moves parameters in the opposite direction. The chapter records current parameters, fresh gradients, update amounts and new losses at every iteration.

  • Gradient direction
  • Learning-rate scale
  • Fresh slope each step
  • Momentum state
  • Adaptive rescaling
  • Training and validation curves
05

Feed-Forward Network Architecture

layer shapes, nonlinear activations and output design

Representations built layer by layer

A feed-forward network alternates affine transformations with nonlinear activations.

  • Affine layer
  • Weight and bias shapes
  • Nonlinear activation
  • Hidden representation
  • Output activation
  • Parameter counting
06

Backpropagation Through Layers

chain-rule paths, parameter gradients and debugging evidence

Influence traced in reverse

Backpropagation reuses the forward computation graph to organise the chain rule. An upstream gradient arrives from the loss, each operation contributes a local derivative and shared paths add their contributions.

  • Computation graph
  • Upstream gradient
  • Local derivative
  • Chain-rule product
  • Branch accumulation
  • Finite-difference check
07

Convolution, Pooling and Feature Maps

local filters, spatial dimensions, channels and segmentation

Local patterns with shared weights

Convolution applies one small kernel at many spatial locations, reducing parameter count and detecting a learned pattern across an image.

  • Shared convolution kernel
  • Spatial output size
  • Input and output channels
  • ReLU feature map
  • Max pooling
  • Segmentation and U-Net
08

Scaled Dot-Product Attention

query-key scores, scaling, masks and weighted value sums

Addressing separated from content

Attention compares a query with key rows, turns those scores into a probability distribution and uses the weights to mix value rows. Keys decide relevance while values carry returned information.

  • Query-key dot product
  • Score scaling
  • Rowwise softmax
  • Weighted value sum
  • Attention masking
  • Self and cross-attention
09

Multi-Head and Causal Attention

head dimensions, causal masks, reshaping and cross-attention

Parallel subspaces with controlled time access

Multi-head attention divides the model channel width across several learned query, key and value subspaces.

  • Combined QKV projection
  • Head width
  • Tensor reshape
  • Per-head attention
  • Causal mask
  • Cross-attention lengths
10

Efficient Transformers and Distillation

caching, rotary position, online attention and teacher-student transfer

Different methods remove different costs

KV caching avoids recomputing history during autoregressive decoding, rotary position methods change query-key geometry, online attention reduces stored intermediate work and distillation transfers behaviour into a smaller model.

  • KV caching
  • Rotary position
  • Stable online softmax
  • Online attention
  • Token distillation
  • Sentence distillation

The captured course surface points students toward Hong Kong Government open datasets and asks them to frame a useful context, analyse data, incorporate coding into a final report and demonstrate a finished product live. The guide therefore treats every mathematical method as part of an evidence chain.

A model output matters only when the data, preprocessing, validation, threshold and resulting product action can all be explained.

How the assessment is organised

The published structure has a short assignment and a much larger project. The assignment is a three-minute voice-over video pitch designed to establish the context for the proposed data product.

The project includes a final report with coding, a ten-minute live demonstration with no slides and an approximately twenty-minute question-and-answer session. The available materials say that detailed criteria will be released later, so this guide does not invent a University rubric.

It supplies technical checks and rehearsal structures that make the work defensible when the current brief appears.

Logistic models and sigmoid scores

The first chapter separates a linear score, a sigmoid output and a threshold decision. A coefficient moves log-odds rather than probability directly, and a threshold belongs to an operational policy rather than the fitted model.

Worked calculations show how signs, intercepts and feature scale affect a prediction. Numerical stability is included because an algebraically correct sigmoid may overflow when implemented naively for an extreme score.

Cross-entropy and likelihood

Cross-entropy reads the probability assigned to the observed class.

The chapter expands the binary formula into its positive-label and negative-label cases, then joins the summed loss to maximum likelihood through the negative logarithm.

It distinguishes a sum from a mean and explains why confidence matters: two models can have the same hard-class accuracy while assigning very different probability to the outcomes that occurred.

Softmax and multiclass prediction

Softmax makes several class logits compete through a shared denominator.

The chapter uses maximum subtraction for stable computation, checks that probabilities sum to one across the class axis and connects categorical cross-entropy to the probability at the true-class index.

Tensor shapes show why normalising across the batch is a serious error even when the returned numbers still sit between zero and one.

Gradient descent and adaptive optimisers

Optimisation is presented as a sequence of local decisions. The gradient gives direction, the learning rate controls trust in that direction and the slope must be recomputed after every move.

Momentum, RMSProp and ADAM are compared through what they remember or rescale. Training curves are then read diagnostically so overfitting, oscillation and disconnected gradients are not all answered by changing the optimiser.

Feed-forward network architecture

A feed-forward network composes affine transformations with nonlinear activations.

The chapter keeps a shape ledger from input through hidden layers to output, because matrix dimensions catch architectural errors before code runs. Sigmoid, tanh and ReLU are compared by range and gradient behaviour.

Output design follows the label structure: binary, mutually exclusive multiclass, independent multi-label or regression.

Backpropagation through layers

Backpropagation is organised chain-rule bookkeeping. Forward values are stored, an upstream gradient arrives from the loss and each operation multiplies by a local derivative. Contributions add where paths branch.

A fully worked scalar graph and a finite-difference check show how an automatic-differentiation result can be audited rather than trusted as a black box.

Convolution, pooling and feature maps

Convolution reuses a local kernel across an image, creating feature maps with far fewer parameters than a fully connected image layer. The chapter separates spatial output size, channel count and trainable parameter count.

ReLU and max pooling are traced on new numeric arrays, and U-Net motivates why segmentation must recover spatial detail rather than compress everything into one label.

Scaled dot-product attention

Attention uses query-key similarity to create weights and uses those weights to mix values. Scaling by the square root of the key dimension prevents large dot products from forcing a sharply saturated softmax.

Matrix dimensions distinguish several queries from several keys and explain why the output has the value width. Masking is applied before softmax so disallowed positions receive no probability mass.

Multi-head and causal attention

Multi-head attention splits the model channel dimension into parallel subspaces while keeping the token sequence intact.

The chapter follows the combined query-key-value projection, reshaping, per-head score matrices, concatenation and final output projection. A causal mask is tested on a tiny sequence so future-token leakage is detected directly rather than inferred from a training curve.

Efficient Transformers and distillation

The final technical chapter separates methods that solve different costs.

KV caching avoids recomputing past keys and values during decoding. Rotary embeddings modify query-key geometry to encode relative position. Online attention reorganises stable softmax and value accumulation to reduce intermediate storage.

Token-level and sentence-level distillation transfer different forms of teacher information into a smaller student.

How to work with the guide

Recalculate every example before reading its answer, then change one input and predict the direction of the new result.

For implementation chapters, assert shapes and invariants in code: probabilities sum to one, masks have the intended pattern, gradients remain finite and reported outputs match a hand calculation. Keep an error log that records the first incorrect line, because repairing the earliest divergence is faster than inspecting the final number.

How to prepare the live product

The project format rewards ownership.

Build a demonstration route inside the product itself: context, one representative record, the transformation and model output, the action it supports, validation against a baseline and a failure case. Preserve the data dictionary, split logic, model settings, dependency versions and AI-use declaration.

The report and demonstrated application should point to the same frozen version.

Evidence and assessment control

Assessment labels, weights and formats follow the captured official course surface for this offering. The examples and drills here are independently authored and are not University assessment material. The published assessment surface names the assignment and project as the assessed work.

Detailed marking criteria are announced for later release, so confirm them, the submission settings and the precise project date on the course LMS.

Worked example · free

Trace a logistic product decision from input to action

Q [8 marks]. AskSia-authored practice. A data product uses z = -1.4 + 0.9H + 0.5W, where H marks a public holiday and W marks a high-temperature forecast. For H = 1 and W = 1, calculate the probability and apply a threshold of 0.4. The marks shown are an AskSia study allocation, not the University's marking scheme.
The sigmoid is monotone but not linear.The sigmoid is monotone but not linear. Scores near zero change the output sharply, while extreme scores are compressed close to zero or one.z = 0, p = 0.5negative scorepositive score10A linear score becomes a probability-like output
The sigmoid is monotone but not linear. Scores near zero change the output sharply, while extreme scores are compressed close to zero or one.
  • 2Calculate the linear score from the printed inputs.
  • 3Apply the sigmoid and retain four decimal places.
  • 3Compare with the threshold and explain the product action.
The score is z = -1.4 + 0.9 + 0.5 = 0. The sigmoid at zero is 0.5. Because 0.5 exceeds the operational threshold of 0.4, the product flags the day for additional staffing. The fitted probability did not choose the staffing rule by itself; changing the threshold could change the action without retraining the model.
Sia tip — Write the score, probability and threshold on separate lines. If the action changes, you can then identify which layer caused it.
Glossary

Key terms

Logit
The unrestricted linear score used before a sigmoid or softmax converts scores into probabilities.
Sigmoid Function
A monotone squashing function that maps any real score to a value between zero and one.
Cross-Entropy
A loss that penalises the model according to the probability assigned to the observed class.
Softmax
A normalisation that converts a vector of logits into positive class probabilities summing to one.
Learning Rate
The factor controlling how far an optimiser moves in the direction opposite the gradient.
Momentum
An optimiser state that combines recent gradients so persistent directions accumulate and oscillating directions partly cancel.
Activation Function
A transformation applied after an affine layer that lets a network represent nonlinear relationships.
Backpropagation
An efficient reverse traversal of a computation graph that applies the chain rule to obtain parameter gradients.
Feature Map
A spatial output channel produced when one convolutional filter is applied across an input.
Attention Weight
A row-normalised relevance value derived from a query-key score and used to mix value vectors.
Causal Mask
A lower-triangular restriction that prevents an autoregressive position from attending to future positions.
KV Cache
Stored key and value tensors from earlier decoding steps that avoid recomputing unchanged history.
Knowledge Distillation
Training a smaller student model to imitate distributions or generated outputs supplied by a larger teacher.
FAQ

MATH7005 FAQ

What are the assessed components?

The captured official course surface lists a short video-pitch assignment and a much larger individual project. The project includes a final report with coding, a live demonstration of the finished product and a question-and-answer session. The two published weights total the full course mark, while detailed criteria are announced for later release.

Which assessed work is published for this offering?

The available course materials describe the assignment and project, with the project identified as the principal assessment. Prepare for the report, product demonstration and follow-up questions on the current course surface, and check the course LMS for the released marking criteria and current settings.

What should the video pitch establish?

The pitch should make the proposed data product legible before technical detail takes over. Name the user, the decision or task, the public-data context, the intended output and why the product would be useful. Use the current released brief for the final required structure because detailed specifications are announced separately.

Can AI tools help with the project code?

The project description permits AI assistance with coding when it is clearly declared. Keep a record of the contribution, inspect the suggested logic and test every output. You remain responsible for the submitted behaviour, so a generated function needs a hand-check, edge cases and a reproducible explanation rather than being accepted because it runs.

How should I choose a model for the project?

Begin with the user decision, label structure and a simple baseline. Add complexity only when validation evidence reveals a limitation that the new method can plausibly address. Compare models on the same time-aware split and preprocessing, and report operational trade-offs such as false alarms, missed cases, runtime and interpretability.

What makes a convincing live demonstration?

Trace one representative record from input through preprocessing and the model to a visible product action. Show a baseline comparison, one validation result and one failure case. The published format says no slides, so keep the evidence inside the working product and rehearse navigation until the computational chain remains clear.

How do I prepare for the question session?

Maintain an evidence index containing the data dictionary, split logic, baseline, final settings, error cases, dependencies and AI-use declaration. Practise answers in a claim-evidence-limit structure. If challenged on a number, recompute it from stored inputs instead of relying on the authority of a software library.

Which technical topics have the fullest source support?

The supplied raw lecture notes are richest on logistic and multinomial models, cross-entropy, optimisation, feed-forward networks, backpropagation, convolutional networks, dot-product attention, multi-head attention, caching, rotary position methods, memory-aware attention and knowledge distillation. The LMS also names Python, NumPy, Pandas, clustering and recommender systems.

Chapter questions

Questions students ask in each MATH7005 chapter

Why is logistic regression a classifier?
Its linear score is passed through a sigmoid to produce a positive-class probability, and a separate threshold converts that probability into a class. The word regression refers to the mathematical form, not the final task. Chapter 01 · Logistic Models and Sigmoid Scores
Why does a confident mistake cost so much?
Negative logarithm grows rapidly as the true-class probability approaches zero. The loss therefore distinguishes a hesitant error from a model that assigns almost all probability to the wrong outcome. Chapter 02 · Cross-Entropy and Likelihood
Why subtract the largest logit?
The operation prevents a large positive exponential from overflowing and leaves every softmax probability unchanged because the same multiplicative factor cancels from numerator and denominator. Chapter 03 · Softmax and Multiclass Prediction
Why must the gradient be recomputed?
The loss slope depends on the current parameter location. Once an update moves the model, the old derivative describes the previous point and may have the wrong magnitude or even direction. Chapter 04 · Gradient Descent and Adaptive Optimisers
Why are nonlinear activations necessary?
Without them, consecutive affine layers collapse into one affine transformation. Nonlinearity lets the network build curved boundaries and hierarchical representations that a single linear map cannot express. Chapter 05 · Feed-Forward Network Architecture
What does backpropagation add to the chain rule?
It organises and reuses intermediate derivatives across a computation graph, avoiding repeated calculation of the same subexpressions. The mathematics remains the chain rule, applied efficiently in reverse order. Chapter 06 · Backpropagation Through Layers
Why does convolution use fewer parameters?
The same small kernel is reused at every spatial location. Parameter count therefore depends on kernel dimensions and channel counts, rather than growing with the full image width and height. Chapter 07 · Convolution, Pooling and Feature Maps
Why are attention scores scaled?
Dot-product variance grows with key dimension, making softmax excessively peaked and leaving weak gradients at most positions. Dividing by the square root of key width keeps the score scale more stable. Chapter 08 · Scaled Dot-Product Attention
Does each head receive different tokens?
No. Each head usually sees the same sequence positions but projects their channel representations into different learned subspaces. The time axis remains intact while the model-width axis is divided. Chapter 09 · Multi-Head and Causal Attention
What work does a KV cache save?
It prevents the model from recomputing keys and values for earlier tokens at every decoding step. The new query still compares with the stored history, and the cache consumes memory that grows with sequence length. Chapter 10 · Efficient Transformers and Distillation
Study strategy

How to prepare for the assessments

Build one small notebook that follows the guide from start to finish. Use a tiny labelled dataset, calculate a logistic prediction and cross-entropy by hand, reproduce them in code, then extend the notebook to a multiclass output, a short network and one attention row. At every stage print shapes and retain a hand-computed test.

For the project, maintain a separate evidence index with data provenance, preprocessing, the validation split, baseline, final settings, failure cases and declared AI assistance. Rehearse the live demonstration from a cold start without slides.

After each rehearsal, write down the first point at which the audience could no longer connect the displayed result to its evidence, then repair that hand-off rather than adding more features. Confirm the released assessment criteria and current schedule on the course LMS before submission.

Study MATH7005 with AI

Your AI Computer Science tutor for MATH7005

Stuck on a hard MATH7005 question? Sia is AskSia’s AI Computer Science tutor — ask any MATH7005 Data Analytics with Programming question and get a clear, step-by-step explanation grounded in how the course is actually taught and assessed. Read this whole study guide free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 12 of your Hong Kong Baptist University subjects - and 1,000+ Bibles across every Australian university.
Sia - your MATH7005 tutor, unlimited, worked the way the exam marks it
The full 44-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works