Inspiration
Machine learning is incredibly good at finding patterns, but patterns don't always tell us what causes an outcome.
A treatment group might have better results than a control group, but is the treatment responsible? Or were the groups different to begin with?
That question inspired CausalLens.
We wanted to build something that goes beyond prediction: a system that helps people investigate misleading associations, estimate causal effects, understand uncertainty, and explore how those estimates influence decisions.
Our goal wasn't to build another dashboard that displays correlations. We wanted to make rigorous causal inference more accessible, transparent, and actionable.
What it does
CausalLens is an interactive causal inference and decision intelligence platform that helps users move from observational associations to evidence-based investigation.
It brings together:
- Confounding diagnostics: Explore covariate imbalance, treatment assignment, and propensity overlap.
- Causal effect estimation: Compare multiple estimators to investigate average and heterogeneous treatment effects.
- Counterfactual exploration: Examine estimated outcomes under alternative treatment scenarios.
- Model evaluation: Compare estimation error, treatment heterogeneity, and decision quality.
- Policy simulation: Explore how treatment allocation changes under limited capacity.
- Robustness and sensitivity analysis: Investigate estimator disagreement, uncertainty, and methodological assumptions.
- Evidence summaries: Export reproducible results with clearly stated limitations.
Our public Streamlit demo uses independently generated synthetic data, allowing visitors to compare observed associations, estimated treatment effects, and known simulated ground truth.
Separately, we evaluated the underlying research system on IHDP-100, a semi-synthetic causal inference benchmark based on real-world covariates.
CausalLens doesn't claim to prove causation automatically. Instead, it helps users ask better questions about what the data actually supports.
How we built it
We developed CausalLens as a modular Python-based research and application system.
1. Data engineering and validation
We built a reproducible data pipeline for the IHDP-100 benchmark, consisting of 100 simulation replications, 25 covariates, and official training/testing splits of 672/75 observations per replication.
Our workflow includes dataset integrity checks, exploratory analysis, treatment-group balance diagnostics, leakage-safe preprocessing, and strict separation of training observations from ground-truth counterfactual information.
2. Causal inference engine
We implemented and evaluated six core estimators: Naive, S-Learner, T-Learner, X-Learner, IPW with weighted regression, and Doubly Robust AIPW.
An extended research experiment added Causal Forest and a PyTorch-based CFRNet implementation, bringing the comparison to eight estimators.
We evaluated the models using Root-PEHE, absolute ATE error, and policy regret across 100 IHDP replications.
3. Scientific evaluation
Our evaluation pipeline includes reproducible benchmarking, bootstrap confidence intervals, paired model comparisons, and sensitivity diagnostics.
In the extended IHDP experiment, CFRNet achieved a mean Root-PEHE of 1.472 compared with 5.712 for the naive baseline, approximately a 74% reduction in estimation error.
These results measure performance on a semi-synthetic benchmark, not real-world clinical effectiveness.
4. Interactive application
We built a six-tab Streamlit interface integrating Plotly visualizations, counterfactual exploration, model comparisons, and capacity-constrained policy simulation.
For public deployment, we created an isolated synthetic-data demonstration that reuses our core estimation and evaluation components without requiring the original IHDP archives.
Challenges we ran into
Distinguishing correlation from causation. One of our biggest challenges was ensuring that descriptive associations, adjusted estimates, and known simulated causal effects were never presented interchangeably.
Preventing data leakage. Because IHDP provides simulated potential outcomes, we had to carefully isolate oracle information from model training and use it only for evaluation.
Ensuring scientific accuracy. During verification, we identified a reporting issue where confidence intervals for means were presented alongside medians. We corrected the reporting pipeline and introduced separate bootstrap confidence intervals.
Interpreting unstable results. Model errors varied substantially across benchmark replications. We learned that reporting only averages could hide important behavior, so we included medians, distributions, uncertainty intervals, and paired comparisons.
Connecting estimates to decisions. Translating individual treatment effect predictions into meaningful policy simulations required careful handling of capacity constraints, oracle comparisons, and regret definitions.
Deploying responsibly. Public redistribution and hosting permissions for the IHDP-derived archives were not conclusively established. Rather than expose research data, we built a separate, independently generated synthetic demo while preserving the original research pipeline.
Accomplishments that we're proud of
- Built an end-to-end causal investigation platform, from validated data pipelines to interactive decision simulation.
- Completed a reproducible 600-fit benchmark across six estimators and 100 IHDP replications.
- Extended the research evaluation to 800 model fits across eight estimators.
- Demonstrated approximately 74% lower mean Root-PEHE for CFRNet than the naive baseline in the extended experiment.
- Built interactive tools for individual counterfactual exploration, treatment heterogeneity, estimator comparison, and constrained policy evaluation.
- Identified and corrected scientific reporting inconsistencies through independent verification and regression testing.
- Deployed a publicly accessible Streamlit demo with reproducible synthetic scenarios and downloadable evidence summaries.
We're particularly proud that we didn't stop at obtaining attractive results. We challenged our own evaluations, investigated discrepancies, and made scientific limitations part of the product.
What we learned
Building CausalLens reinforced an important lesson: a good predictive model is not necessarily a good causal model, and a good causal estimate is not automatically a good decision.
We learned how sensitive causal conclusions can be to assumptions, treatment imbalance, model specification, and evaluation methodology.
We also gained practical experience integrating statistical research with production-oriented software engineering, reproducible experimentation, interactive visualization, and responsible public deployment.
Most importantly, we learned that making AI explainable isn't just about showing a model's output. It's about communicating what that output means, what assumptions support it, and when it shouldn't be trusted.
What's next for CausalLens
We see CausalLens evolving into a broader causal decision intelligence platform.
Our next priorities include:
- Supporting additional publicly licensed causal inference datasets and domains.
- Expanding automated diagnostics for overlap, confounding, and model reliability.
- Introducing assumption-aware AI assistance that explains results without overstating causal certainty.
- Adding stronger uncertainty quantification and sensitivity analysis.
- Evaluating treatment-policy generalization across different populations and simulation settings.
- Improving reproducible experiment tracking and collaborative research workflows.
Our long-term vision is to make causal inference easier to investigate, interpret, and apply responsibly.
Because better decisions begin by questioning what the data appears to say.
Built With
- causal-inference
- causal-machine-learning
- counterfactual-inference
- data-science
- decision-intelligence
- econml
- github
- machine-learning
- numpy
- pandas
- plotly
- pytest
- python
- pytorch
- scikit-learn
- scipy
- statistical-analysis
- streamlit