Models for Risk and Forecasting - S. Galiani


Course Syllabus

Models for risk and forecasting

II semester - Spring 2023


Professor: Stefano Galiani (


Office 107 - 1° piano (107 - 1st floor)


Office Hours: in person or Google Meet subject to email confirmation.


Class Hours (day, time, room):


Monday 8:00 to 10:00am , DIDALAB computer lab classroom

Tuesday 8:00 to 10:00am , DIDALAB computer lab classroom

Thursday 8:00 to 10:00am , DIDALAB computer lab classroom


Total Module Hours72hrs / 9 CFU

Exam Sessions28 April 2023, 21 June 2023, 18 July 2023, 14 September 2023, 19 October 2023 (to be booked on INFOSTUD platform)

Course website:




Slides prepared by the instructor, along with Python based Jupyter Notebooks are the course main references.


Textbooks covering the topics of the course can be found in:


  • Coqueret, G. and Guida, T. (2020) Machine Learning for Factor Investing, Chapman and Hall/CRC Financial Mathematics Series,
  • Geron, A. (2017), Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems, O'Reilly Media
  • Agresti, A. and Kateri, M., Foundations of Statistics for Data Scientists: With R and Python (2021), Chapman & Hall/CRC Texts in Statistical Science


Additional Materials 

  • Notes used during the classes 
  • Financial time series and various datasets.
  • Papers focusing on specific topics covered during the course 
  • Python/R functions and software 


The additional materials will be available in a dedicated Google ClassRoom/Drive folder reserved for the students attending the course only.



Statistics course covering probability theory and statistical inference.

Financial Mathematics concepts pertinent to present value and basic understanding of contingent claims.

Basic programming in any language, although the first part of the course will provide students with a solid foundations of relevant Python concepts.


Final and grade policy

The exam consists in two parts:

 - the first one consists in a series of assignments covering empirical aspects and it is aimed at testing applied skills.

- the second one includes review questions to test theoretical knowledge and critical understanding.


Course Objectives


This course on quantitative risk management combine certain elements of Statistical Methods and Machine Learning and explain how to build systems that learn and adapt using real-world applications to detect and manage risks within a financial setting.

The first part of the course gathers preparatory material related to data analysis and preparation via Pandas Series and DataFrames.

Data cleaning, checking and grouping tools are presented.

The second part of the course introduces students to the economic foundations (theoretical and empirical) of factors construction, followed by an in-depth discussion of the application of these techniques to portfolio risk decisions, including the design of more robust factor models and the implementation of more efficient risk management models.

The third part of the course is dedicated to predictive algorithms in supervised learning used to forecast financial quantities such asset returns, volatilities and performance ratios. Among the models presented, the students will be introduced to:

  1. Penalized regressions: Ridge, LASSO and Elastic-Net
  2. Tree methods: CART algorithm for both regression and classification tasks
  3. Random Forests: bagging, pasting, out-of-bag evaluation, ADABOOST, Gradient Boosting
  4. Support Vector Machines: soft vs hard marging, non-linear SVM, kernel tricks
  5. Neural Networks: architecture, back-propagation, regularization

Every model will be critically reviewed and implemented in Python (Scikit-Learn, TensorFlow and PyTorch libraries).

Last, the course reviews the critical steps of model tuning and hyperparameters optimization and mentions the critical points that are often encountered at this stage.


Specific educational objectives include:

- Ability to interpret results and draw appropriate conclusions.

- Ability to apply theoretical and empirical models to real world problems.

- Python programming and data analysis.

- Enhance organizational, analytical and communication skills through participation in group project work


Preliminary Weekly Course Calendar 


Week 1-3:

- Overview of Python data analysis tools and programming concepts.

- Introduction to Numpy, Pandas, and Scipy modules for the analysis of financial data series and indicators.

- Grouping, merging, mapping and location applied to financial datasets. 

Week 4-5:

- Value at Risk and Expected Shortfall definition and portfolio implementation (parametric, non-parametric, simulation).

- Factor Investing and Smart Beta Strategies: economic foundations, empirical estimation of Factor Loadings with Python implementation.

Week 6-8:

- Introduction to Machine Learning applied to financial risks:

- Linear Regression, Classification via Logistic Regression.

     i) Gradient Descents (Batch, Stochastic, Mini Batch),
    ii) Loss Functions: MSE, Log-Loss and Cross Entropy for Multiclass target variables.
ii) Regularization (Ridge, Lasso and Elastic Net)

- Decision Trees and CART training algorithm

- Ensemble Learning and Random Forests (bagging, pasting, out-of-bag evaluation and boosting)

- SVM: primal vs dual problem, soft margin via slack variables, kernel tricks, Mercer's Theorem

- from Perceptons to Artificial Neural Networks. Activation Functions, Backpropagation, Parameter Tuning

Week 9

Model Calibration and hyperparameters tuning.

© Università degli Studi di Roma "La Sapienza" - Piazzale Aldo Moro 5, 00185 Roma