Skip to content

Commit 468b0eb

Browse files
committed
docs: improve README with detailed architecture and usage
1 parent 6df3336 commit 468b0eb

1 file changed

Lines changed: 118 additions & 13 deletions

File tree

README.md

Lines changed: 118 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,123 @@
1-
# Portfolio Optimization
1+
# Portfolio Optimization with Spectral Mixture Gaussian Processes
22

33
[![Python CI](https://github.com/MichalRedm/portfolio-optimization/actions/workflows/ci.yml/badge.svg)](https://github.com/MichalRedm/portfolio-optimization/actions/workflows/ci.yml)
44

5-
Modular Python implementation for Markowitz Portfolio Optimization using Spectral Mixture Gaussian Processes.
5+
A professional-grade Python implementation of Multi-Objective Portfolio Optimization. This project combines advanced time-series forecasting (Spectral Mixture Gaussian Processes) with state-of-the-art evolutionary algorithms (MOEA/D) to find optimal asset allocations.
66

7-
## Features
8-
- Modular architecture (SOLID principles)
9-
- Exact Gaussian Process regression (Spectral Mixture Kernel)
10-
- Pareto Front optimization (Weighted Sum & Epsilon-Constrained)
11-
- Matplotlib visualizations
7+
---
128

13-
## Setup
14-
1. Create virtual environment: `python -m venv .venv`
15-
2. Activate environment
16-
3. Install dependencies: `pip install -r requirements.txt`
17-
4. Run standard experiment: `python -m scripts.experiment_standard`
18-
5. Run MOEA/D experiment: `python -m scripts.experiment_moead`
9+
## 🚀 Overview
10+
11+
This repository provides a modular framework for:
12+
1. **Price Prediction**: Using Gaussian Processes with Spectral Mixture (SM) kernels to capture complex periodicity and trends in financial data.
13+
2. **Portfolio Modeling**: Defining multi-objective problems including Expected Return, Risk (Variance), and Diversification (HHI Index).
14+
3. **Pareto Front Discovery**: Solving the optimization problem using classical (Weighted Sum, Epsilon-Constrained) and evolutionary (MOEA/D) approaches.
15+
16+
---
17+
18+
## 🛠️ Key Algorithms
19+
20+
### 1. Classical Optimizers
21+
* **Weighted Sum**: Aggregates objectives into a single scalar value.
22+
* **Epsilon-Constrained (ECM)**: Maximizes return while keeping other objectives within strict bounds. Used as the ground-truth reference for quality metrics.
23+
24+
### 2. MOEA/D (Decomposition-based Optimization)
25+
* **Standard MOEA/D**: Decomposes the problem into subproblems with fixed weight vectors.
26+
* **MOEA/D-DRA (Dynamic Resource Allocation)**: Optimizes computational efficiency by focusing on subproblems that show the most improvement.
27+
* **MOEA/D-AWA (Adaptive Weight Adjustment)**: Dynamically repositions weight vectors during search to ensure a uniform distribution of solutions across the Pareto front.
28+
29+
---
30+
31+
## 📦 Project Structure
32+
33+
```text
34+
├── .github/workflows/ # CI/CD Pipeline (Linting & Formatting)
35+
├── data/ # Historical asset price data (CSV)
36+
├── scripts/ # Experiment entry points
37+
│ ├── experiment_standard.py # Classical optimization comparison
38+
│ ├── experiment_moead.py # Basic MOEA/D vs ECM
39+
│ ├── experiment_dra.py # Performance & efficiency testing
40+
│ └── experiment_awa.py # Diversity & distribution testing
41+
├── src/
42+
│ ├── portfolio/ # Core optimization logic
43+
│ │ ├── metrics.py # Quality metrics (IGD, Spacing, Spread)
44+
│ │ ├── moead_base.py # Common evolutionary logic
45+
│ │ └── ...
46+
│ ├── predictors.py # GP-SM Regression models
47+
│ └── visualization.py # Advanced plotting and 3D animations
48+
└── requirements.txt # Dependency list
49+
```
50+
51+
---
52+
53+
## ⚙️ Setup & Installation
54+
55+
1. **Clone the repository**:
56+
```bash
57+
git clone https://github.com/MichalRedm/portfolio-optimization.git
58+
cd portfolio-optimization
59+
```
60+
61+
2. **Create and activate a virtual environment**:
62+
```bash
63+
python -m venv .venv
64+
# Windows
65+
.venv\Scripts\activate
66+
# Linux/macOS
67+
source .venv/bin/activate
68+
```
69+
70+
3. **Install dependencies**:
71+
```bash
72+
pip install -r requirements.txt
73+
```
74+
75+
---
76+
77+
## 📈 Running Experiments
78+
79+
The project includes several built-in experiments to evaluate algorithm performance.
80+
81+
### Standard Optimization (ECM vs Weighted Sum)
82+
```bash
83+
python scripts/experiment_standard.py
84+
```
85+
86+
### MOEA/D vs Standard Comparison
87+
```bash
88+
python scripts/experiment_moead.py
89+
```
90+
91+
### Efficiency & Resource Allocation (DRA)
92+
```bash
93+
python scripts/experiment_dra.py
94+
```
95+
96+
### Distribution & Adaptive Weights (AWA)
97+
```bash
98+
python scripts/experiment_awa.py
99+
```
100+
101+
---
102+
103+
## 📊 Quality Metrics
104+
105+
We evaluate the quality of the found Pareto fronts using:
106+
* **IGD (Inverted Generational Distance)**: Measures how close the found solutions are to the true Pareto front.
107+
* **Spacing**: Measures how evenly the solutions are distributed.
108+
* **Spread**: Measures how well the solutions cover the entire objective space.
109+
110+
---
111+
112+
## 🎨 Visualizations
113+
114+
The framework generates high-quality visualizations, including:
115+
* **2D Comparisons**: Scatter plots showing the Pareto front against reference models.
116+
* **3D Animations**: Interactive rotation of 3D fronts (Return vs Risk vs Diversification) saved as smooth GIFs (25 FPS).
117+
* **Efficiency Plots**: Performance over time (IGD vs. Function Evaluations).
118+
119+
---
120+
121+
## 📜 License
122+
123+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)