Tutorials#
Step-by-step tutorials for each supported model family.
Tutorials
- Gallery
- At a Glance
- 1. Linear: Wage Returns to Experience
- 2. Logit: Discount Effectiveness
- 3. Poisson: Open Access Citation Advantage
- 4. Tobit: Charitable Donations
- 5. Gamma: Insurance Claims
- 6. Weibull: Customer Churn
- 7. Multinomial Logit: Transportation Mode Choice
- 8. Gaussian: Manufacturing Quality Control
- Run It Yourself
- Linear Model Tutorial
- Logit Model Tutorial
- Poisson Model Tutorial
- Tobit Model Tutorial
- Negative Binomial Model Tutorial
- Gamma Model Tutorial
- Gumbel Model Tutorial
- Weibull Model Tutorial
- Multinomial Logit (Conditional Logit) Tutorial
- Multimodal Tutorial: Text & Image Embeddings
- Personalized Pricing Tutorial
- Continuous Treatment Tutorial
Overview#
Each tutorial covers:
When to use - What types of data and research questions
Mathematical setup - The DGP, loss function, and estimand
Code example - Complete working code
Results interpretation - Understanding coverage and SE ratios
Real-world applications - Practical use cases
Model Selection Guide#
Your Outcome |
Distribution |
Model |
Tutorial |
|---|---|---|---|
Continuous (unbounded) |
Normal |
Linear |
|
Binary (0/1) |
Bernoulli |
Logit |
|
Count (0, 1, 2, …) |
Poisson |
Poisson |
|
Censored at boundary |
Tobit |
Tobit |
|
Overdispersed counts |
Negative Binomial |
NegBin |
|
Positive right-skewed |
Gamma |
Gamma |
|
Extreme values (maxima) |
Gumbel |
Gumbel |
|
Time-to-event |
Weibull |
Weibull |
|
Discrete choice (J>=3) |
Categorical |
Multinomial Logit |
|
High-dim embeddings |
Any |
Any |
|
Pricing / Elasticity |
Bernoulli |
Logit |
|
Dose-response (continuous T) |
Any |
Any |
Common Workflow#
All tutorials follow the same basic pattern:
from deep_inference import structural_dml
import numpy as np
# 1. Prepare your data
# Y: outcome variable
# T: treatment variable
# X: covariates (must be 2D array)
# 2. Run inference
result = structural_dml(
Y=Y, T=T, X=X,
family='linear', # or 'logit', 'poisson', etc.
hidden_dims=[64, 32],
epochs=100,
n_folds=50
)
# 3. Check results
print(f"Estimate: {result.mu_hat:.4f}")
print(f"SE: {result.se:.4f}")
print(f"95% CI: [{result.ci_lower:.4f}, {result.ci_upper:.4f}]")
# Coverage should be ~95%, SE ratio should be ~1.0