# Chapter 35: Explainability, Uncertainty, and Model Governance
# Fundamentals of Python for Financial Econometrics - Explainability, Uncertainty, and Model Governance
# Dataset: Ceteris Lab teaching sample

# Chapter 35: Explainability, Uncertainty, and Model Governance
# **Economic question:** How do we decide whether a powerful prediction model is trustworthy enough to use?
#
# Responsible model use requires error analysis, uncertainty, documentation, and governance, not just a high validation score.

# %% Cell 2
import numpy as np
rng=np.random.default_rng(35); pred=rng.normal(100,10,300); actual=pred+rng.normal(0,5,300)
err=actual-pred
print('mean error',err.mean()); print('RMSE',np.sqrt(np.mean(err**2))); print('90% empirical error interval',np.quantile(err,[.05,.95]))

# Interpretation checklist
# - State the unit of observation and units of every variable.
# - Separate association, prediction, and causation.
# - Report magnitude and uncertainty.
# - Identify the most important threat to validity.
