This repository implements the solutions of the exercises on Chapter 16: Deep Learning Portfolios (link to exercises) of the book Palomar, D. P. (2025). Portfolio Optimization: Theory and Application. Cambridge University Press (available online at portfoliooptimizationbook.com).
To run these exercises, you'll need Python and several libraries. Follow these steps to set up your environment:
-
Clone this repository:
git clone [repository-url] cd [repository-directory] -
Create and activate a virtual environment (optional but recommended):
python -m venv .venv # On Windows .venv\Scripts\activate # On macOS/Linux source .venv/bin/activate
-
Install the required packages using the requirements.txt file:
pip install -r requirements.txt
The repository contains Python scripts implementing solutions to the exercises from Chapter 16:
exercise_16_1.py: Classification of spam in emailsexercise_16_2.py: Regression of housing pricesexercise_16_3.py: Image classification with CNNsexercise_16_4.py: Object detection with Faster R-CNNexercise_16_5.py: Language translation with sequence-to-sequence modelsexercise_16_6.py: GANs for image synthesisexercise_16_7.py: Handwritten Digit Recognition with CNNsexercise_16_8.py: Linear regression for stock pricesexercise_16_9.py: Decision trees for default predictionexercise_16_10.py: Random forests for default predictionexercise_16_11.py: SVMs for stock direction forecastexercise_16_12.py: Comparison of LSTMs vs. transformers with synthetic dataexercise_16_13.py: Predicting stock prices using deep learningexercise_16_14.py: Portfolio optimization using deep learning
Each script can be run independently.