munichpavel / risk-ai-workshop

Lecture material and sample code for the workshop "Risk, Artificial Intelligence and Discrete Geometry" at the University of Ljubljana
GNU General Public License v3.0
7 stars 8 forks source link

Add causal approach to model selection #13

Closed munichpavel closed 2 years ago

munichpavel commented 2 years ago

In scope

Out of scope

munichpavel commented 2 years ago

EconML

Credit risk seems most analogous to stratification in clinical trials

Problem formulation (notation as in Pearl et al, I think): https://econml.azurewebsites.net/spec/api.html

Causal random forests

From https://github.com/Microsoft/EconML

from econml.dml import CausalForestDML
from sklearn.linear_model import LassoCV
# Use defaults
est = CausalForestDML()
# Or specify hyperparameters
est = CausalForestDML(criterion='het', n_estimators=500,       
                      min_samples_leaf=10, 
                      max_depth=10, max_samples=0.5,
                      discrete_treatment=False,
                      model_t=LassoCV(), model_y=LassoCV())
est.fit(Y, T, X=X, W=W)
treatment_effects = est.effect(X_test)
# Confidence intervals via Bootstrap-of-Little-Bags for forests
lb, ub = est.effect_interval(X_test, alpha=0.05)

see also https://github.com/microsoft/EconML/blob/main/notebooks/Causal%20Forest%20and%20Orthogonal%20Random%20Forest%20Examples.ipynb

munichpavel commented 2 years ago

Or not: Causal methods aren't in general about doing prediction better, they are usually about estimating effects of interventions.