# Chapter 53: Capstone Projects and Student Portfolio
# Fundamentals of Python for Financial Econometrics - Capstone Projects and Student Portfolio
# Dataset: Ceteris Lab teaching sample

# Capstone Projects and Student Portfolio
#
# **Opening question:** How can a student transform code fragments into a defensible, reproducible analytical product for the Ceteris LAB website or a professional portfolio?

# %% Cell 2
import pandas as pd

results = pd.DataFrame({
    "model": ["naive", "ARIMA", "random_forest"],
    "MAE": [0.0124, 0.0118, 0.0121],
    "RMSE": [0.0168, 0.0160, 0.0164],
})
results["MAE_rank"] = results["MAE"].rank(method="min").astype(int)
print(results.sort_values("MAE"))

# **Interpretation check:** Interpretation. The advanced model improves only modestly over the naive benchmark, so uncertainty and practical relevance should accompany the ranking.

# %% Cell 4
from pathlib import Path

required = ["README.md", "requirements.txt", "data", "notebooks", "scripts", "figures"]
root = Path.cwd()
manifest = {item: (root/item).exists() for item in required}
print(manifest)

# **Interpretation check:** Interpretation. A manifest is not proof of quality, but it catches missing package components before publication.

# Verified source output
#
# ```text
# model MAE RMSE MAE_rank 1 ARIMA 0.0118 0.0160 1 2 random_forest 0.0121 0.0164 2 0 naive 0.0124 0.0168 3
# ```
#
# ```text
# {'README.md': True, 'requirements.txt': True, 'data': True, 'notebooks': True, 'scripts': True, 'figures': True}
# ```
#
# ```text
# model     MAE    RMSE  MAE_rank
# 1          ARIMA  0.0118  0.0160         1
# 2  random_forest  0.0121  0.0164         2
# 0          naive  0.0124  0.0168         3
# ```
#
# ```text
# import pandas as pd
# results = pd.DataFrame({
# results["MAE_rank"] = results["MAE"].rank(method="min").astype(int)
# print(results.sort_values("MAE"))
# from pathlib import Path
# root = Path.cwd()
# ```
