How jhartford/deepiv works
Project type and purpose
• DeepIV is an open‐source Python package implementing the Deep IV (instrumental variables) method on top of Keras.
• It provides a two‐stage neural‐network procedure (treatment model + response model) for counterfactual prediction.
File structure
Top‐level directories and files:
• deepiv/ ← core library code
– architectures.py (network‐building blocks)
– custom_gradients.py (IV‐specific gradient logic)
– densities.py (density estimation helpers)
– models.py (DeepIVModel class, main API)
– samplers.py (Monte Carlo samplers for stage 2)
• experiments/ ← example pipelines demonstrating usage
• docs/ ← Sphinx documentation sources
• tests/ ← unit tests for core functionality
• setup.py, setup.cfg, Makefile, requirements_dev.txt, tox.ini, travis_pypi_setup.py ← build, CI, and packaging
README for additional insights
• Two‐stage procedure:
1. Fit the Treatment network
2. Fit the Response network, which consumes Treatment’s fitted distribution
• Built as a subclass of Keras’ Model class—drop‐in replacement for standard Keras models
• Example scripts under experiments/ illustrate both simple feedforward and convolutional variants