Prepare and practise

Exam info

See what you may use, get your laptop ready for the offline notebook exam, save a copy of everything you want with you, and practise with three complete mock exams.

Ordinary exam 2026: suggested solutions

You can now check your work against the suggested solutions and read the overview of common mistakes below. The guide includes code, expected results and written explanations. It illustrates one approach; alternative correct solutions are also possible.

Download the suggested solutions (.ipynb)

Open the notebook in VS Code or Jupyter to read it. To run Part 2, keep the MLFIN_ORDINARY_2026_data.csv supplied with the exam in the same folder.

Local setup guide

For future offline work, use the local readiness check. Installation and XGBoost/LightGBM troubleshooting are collected in the setup guide.

Common mistakes — ordinary exam, October 2026

The points below summarise recurring difficulties in the submissions. They are intended to guide further practice, not to prescribe one particular coding style. Different correct approaches are welcome; where a question specifies a method, data structure or model setting, that requirement still matters.

  1. Adapting an example without adapting its logic. Several answers retained variables, models or explanations from a different problem. Before reusing code, identify the inputs, target, required output and evaluation method in the current question. A working example about stock volatility does not automatically answer a question about invoice payments.

  2. Losing track of days and return windows. Eleven closing prices give ten daily returns and six five-day returns. The five-day return ending on day 6 uses the closes on days 1 and 6; its daily returns are those on days 2–6. Finding the lowest five-day return and then the lowest daily return within that window are different tasks. The starting close is needed to calculate the first daily return; this is not simply an issue of Python's zero-based indexing. Negative indices can silently select prices from the end of the list.

  3. Confusing dictionary keys, values and positions. A dictionary mapping days to returns needs a separate entry for each day. min(d) selects the smallest key, whereas min(d, key=d.get) selects the key with the smallest value. A list position is not automatically the corresponding day. Keep returns numeric and apply percentage formatting when displaying them.

  4. Translating a formula without checking its meaning or shape. Portfolio weights are position values divided by total value: (units * unit_price) / (units * unit_price).sum(). They should have three entries and sum to one. Portfolio volatility is np.sqrt(w @ cov @ w), a single number. The covariance matrix contains variances on its diagonal, so the bond fund's own volatility is np.sqrt(cov[1, 1]), not cov[1, 1].

  5. Breaking the pairing when filtering data. Removing the zero area alone shifts the remaining areas relative to the prices. Filter each price–area pair together, using the area's validity. Filtering prices by an arbitrary price threshold happens to remove the right house here but does not implement the rule. Check every retained house against its own price and area. Keep full precision for calculations and round the displayed results.

  6. Losing a level in nested dictionaries. In holdings, the outer keys are clients and the inner keys are tickers. For each client, multiply each share count by prices[ticker] and accumulate the values. Do not pair separate dictionaries by their iteration order, overwrite the running total, or return before the loop finishes. Concentration uses the largest position's market value, not the largest share count; firm exposure sums each ticker across clients.

  7. Changing the benchmark or the evaluation sample. The specified reference predicts each test invoice's own terms_days; it does not predict a training mean or the average payment terms. Compare both forecasts with the actual days_to_pay for the same test rows. Keep training and test rows separate: reporting training error as test error, fitting on the test set, or including days_minus_terms as a predictor invalidates the intended evaluation. That derived column contains the outcome and is only for the descriptive analysis.

  8. Changing the model-selection procedure. Use the requested five shuffled folds, seeds, candidate leaf counts and fixed settings—including learning_rate=0.05, not 0.5. Select using validation MSE, then refit the selected model on all training rows. Printing the selected leaf count is not enough if the final model still uses the last candidate. Few leaves can underfit; many leaves can fit noise. Validation MSE is an error measure, not an explicit penalty for the number of leaves.

  9. Calculating an overall statistic instead of a group statistic. “For each value of terms_days” means separate results for the 14-, 30- and 60-day groups. Filter the relevant rows before calculating the statistic, or use groupby. Multiplying by a Boolean mask and then averaging all rows leaves zeros in the denominator. For the chart, retain all three group MAEs; do not plot the overall MAE or only the final loop value three times. Label the axes and units.

  10. Mixing up error measures and kinds of lateness. MSE averages squared errors and has units of squared days; MAE averages absolute errors and has units of days. Here the residual is actual payment time minus the model forecast. “More than 10 days later than forecast” therefore means residual > 10, not lateness relative to the contractual due date or an absolute error above 10. Within each payment-terms group, report both the count and the share, using that group's size as the denominator.

  11. Giving conclusions that are not supported by the results. A lower overall test MSE does not establish equally good forecasts for every group or guarantee future performance. Connect the treasury recommendation to the benchmark comparison and group results, state a limitation of the evidence, and propose a practical response such as a cash buffer. If a calculation is unfinished, explain the intended method and make any assumptions explicit. Finally, restart and run the notebook from the top: saved outputs may reflect earlier code or variables that no longer exist.

The exam at a glance

180 minuteson site, offline, in VS Code
Two parts50 points each
No AI, no interneteverything else is allowed
Two filesyour answer notebook and the blank PDF

What you may use

Two things are not allowed: anything that needs the internet, and anything built on AI. Everything else is allowed. This is the official exam cover in short: all aids, no internet, no generative AI.

Allowed

  • Your own notes, books and printouts.
  • Course materials saved on your laptop: the course ZIP, the lecture PDFs and the cheatsheet, all below.
  • Documentation saved beforehand, help(), and the documentation VS Code shows when you hover over a name.
  • VS Code's suggestion list. Type df. and it lists head, describe, groupby and the other methods that exist; inside pd.read_csv( it shows the arguments.

Not allowed

  • Anything online: web search, Colab, online documentation, this site, messages to anyone.
  • Anything built on AI: chat assistants such as ChatGPT, and AI code completion, the grey suggested code that writes a line or a block for you, or writes code from a comment. GitHub Copilot is the best-known example.

A quick test for an editor feature: picking a name from a list of what already exists is fine; having code written for you is not. For anything else, use your intuition: if it feels like cheating, it probably is. If you are unsure about a tool, ask before the exam.

Get ready, in this order

  1. Save your offline copies while you have internet: the course ZIP, the lecture PDFs and the cheatsheet, all below.
  2. Select your local exam Python kernel in VS Code. If you have not set up local Python and VS Code yet, start with the setup page. If you already have a setup, test it below before changing it.
  3. Run the readiness check offline. Replace any older copy of setup_check.ipynb with the updated download above. Open the unzipped folder in VS Code, select your exam kernel, restart it and Run All. Read the final verdict and confirm the plot appears; fix any failures before exam day.
  4. Switch off AI completion in VS Code, as page 2 of the practicalities guide shows. The suggestion list (type df., pick head) is allowed and stays on.
  5. Sit one mock exam in three uninterrupted hours on that laptop, then read its code solutions.

Offline copies

Everything the course has, as files. Save them before the exam: the site itself will not be reachable.

The lectures, as PDFs

Every slide, with the result of every code cell. Printing a lecture from the browser leaves those results out, so use these.

Practicalities and preparation

A two-page guide to what you may use, preparing offline materials, switching off AI completion in VS Code, practising under exam conditions, and handing in your work.

Mock exams

Each ZIP contains the question paper, answer notebook, CSV data, blank PDF for the two-file hand-in, and a separate notebook with code solutions. Try one in an uninterrupted three-hour block under the exam's rules: offline, no AI, your saved materials allowed. Open the code solutions only after your attempt; they do not contain written explanations.