|
| 1 | +# Econometrics and Supervised Learning Roadmap |
| 2 | + |
| 3 | +This document collects proposed functionality expansions for `pyensmallen`, based on the existing notebooks and current API surface. |
| 4 | + |
| 5 | +## First Tranche |
| 6 | + |
| 7 | +The first set of items to prioritize: |
| 8 | + |
| 9 | +1. Estimator classes for common supervised models |
| 10 | +2. First-class regularization support |
| 11 | +3. Proper stochastic / mini-batch training support |
| 12 | + |
| 13 | +These are the highest-leverage additions for making `pyensmallen` useful beyond optimizer demos and low-level objective wrappers. |
| 14 | + |
| 15 | +## Full Proposal List |
| 16 | + |
| 17 | +### 1. Estimator classes for common supervised models |
| 18 | + |
| 19 | +Add estimator APIs for standard econometrics and ML models: |
| 20 | + |
| 21 | +- `LinearRegression` |
| 22 | +- `LogisticRegression` |
| 23 | +- `PoissonRegression` |
| 24 | +- `MultinomialLogit` |
| 25 | +- `Probit` |
| 26 | +- `NegativeBinomial` |
| 27 | +- optionally `CoxPH` |
| 28 | + |
| 29 | +Each estimator should expose a workflow-level API: |
| 30 | + |
| 31 | +- `fit` |
| 32 | +- `predict` |
| 33 | +- `predict_proba` where applicable |
| 34 | +- `score` |
| 35 | +- fitted coefficients and intercept |
| 36 | +- convergence diagnostics |
| 37 | +- optional standard errors and summaries |
| 38 | + |
| 39 | +Rationale: |
| 40 | +The current API is objective-first. Real workflows usually want model objects, not raw closures. |
| 41 | + |
| 42 | +### 2. First-class regularization support |
| 43 | + |
| 44 | +Add penalized estimation support across core models: |
| 45 | + |
| 46 | +- L1 |
| 47 | +- L2 |
| 48 | +- elastic net |
| 49 | +- regularization paths |
| 50 | +- cross-validated penalty selection |
| 51 | + |
| 52 | +This should work naturally with existing constrained optimization ideas already present in the package. |
| 53 | + |
| 54 | +Rationale: |
| 55 | +This is central to both supervised learning and modern econometrics, especially in high-dimensional settings. |
| 56 | + |
| 57 | +### 3. Productized JAX bridge |
| 58 | + |
| 59 | +Turn the current notebook pattern into a supported API: |
| 60 | + |
| 61 | +- `JaxObjective` |
| 62 | +- `AutoDiffObjective` |
| 63 | +- or `AutoDiffEstimator` |
| 64 | + |
| 65 | +The wrapper should accept a JAX loss function and automatically provide: |
| 66 | + |
| 67 | +- objective evaluation |
| 68 | +- gradients |
| 69 | +- shape handling |
| 70 | +- low-boilerplate integration with ensmallen optimizers |
| 71 | + |
| 72 | +Rationale: |
| 73 | +The multinomial logit notebook already shows this is useful. It should be library functionality, not notebook glue code. |
| 74 | + |
| 75 | +### 4. Proper stochastic / mini-batch training support |
| 76 | + |
| 77 | +Expose true separable-objective support for first-order optimizers: |
| 78 | + |
| 79 | +- mini-batch iteration |
| 80 | +- batch indexing |
| 81 | +- data shuffling |
| 82 | +- epoch-level callbacks |
| 83 | +- objective tracking |
| 84 | +- early stopping hooks |
| 85 | + |
| 86 | +This is especially important for: |
| 87 | + |
| 88 | +- large supervised-learning problems |
| 89 | +- neural-style differentiable objectives |
| 90 | +- scalable generalized linear models |
| 91 | + |
| 92 | +Rationale: |
| 93 | +The Adam-family bindings exist, but the current wrapper behaves like full-batch optimization. That limits the ML use case substantially. |
| 94 | + |
| 95 | +### 5. Inference utilities beyond point estimation |
| 96 | + |
| 97 | +Expand the econometrics side with reusable inference tools: |
| 98 | + |
| 99 | +- sandwich covariance |
| 100 | +- HC0-HC3 robust standard errors |
| 101 | +- clustered standard errors |
| 102 | +- HAC / Newey-West |
| 103 | +- Wald, likelihood-ratio, and score tests |
| 104 | +- delta method |
| 105 | +- marginal effects |
| 106 | +- bootstrap helpers for MLE models |
| 107 | + |
| 108 | +Rationale: |
| 109 | +The package already goes in this direction for GMM. Extending it to MLE models would make it much more useful for empirical work. |
| 110 | + |
| 111 | +### 6. Model selection and evaluation tools |
| 112 | + |
| 113 | +Add workflow-level evaluation and tuning utilities: |
| 114 | + |
| 115 | +- train / validation splitting |
| 116 | +- K-fold cross-validation |
| 117 | +- time-series cross-validation |
| 118 | +- standard supervised metrics |
| 119 | +- calibration diagnostics |
| 120 | +- hyperparameter search |
| 121 | +- early stopping support |
| 122 | + |
| 123 | +Metrics should include at least: |
| 124 | + |
| 125 | +- RMSE |
| 126 | +- MAE |
| 127 | +- log loss |
| 128 | +- AUC |
| 129 | + |
| 130 | +Rationale: |
| 131 | +Several notebooks currently hand-roll comparison and tuning logic that should live in the library. |
| 132 | + |
| 133 | +### 7. Higher-level causal and panel estimators |
| 134 | + |
| 135 | +Potential estimator layer additions include: |
| 136 | + |
| 137 | +- `SyntheticControl` |
| 138 | +- balancing weights estimators |
| 139 | +- ridge-augmented synthetic control |
| 140 | +- matrix-completion synthetic control |
| 141 | +- DiD and event-study estimators |
| 142 | +- IV / 2SLS / LIML |
| 143 | +- doubly robust or orthogonal-score estimators |
| 144 | + |
| 145 | +Rationale: |
| 146 | +This is a natural applied econometrics extension, though a substantial part of this already exists in the sibling `synthlearners` repository. |
| 147 | + |
| 148 | +### 8. Formula and DataFrame ergonomics |
| 149 | + |
| 150 | +Improve usability for empirical workflows: |
| 151 | + |
| 152 | +- formula interface |
| 153 | +- automatic intercept handling |
| 154 | +- categorical encoding |
| 155 | +- missing-data policy |
| 156 | +- sample weights |
| 157 | +- grouped / clustered identifiers |
| 158 | +- pandas-friendly summaries |
| 159 | + |
| 160 | +Rationale: |
| 161 | +Econometrics users often work from tabular data first, not prebuilt dense matrices. |
| 162 | + |
| 163 | +## Suggested Implementation Order |
| 164 | + |
| 165 | +1. Estimator classes for core GLMs |
| 166 | +2. Regularization support |
| 167 | +3. True separable-objective and mini-batch support |
| 168 | +4. Inference utilities for MLE models |
| 169 | +5. Productized JAX autodiff bridge |
| 170 | +6. Evaluation and model-selection utilities |
| 171 | +7. Selective integration points with `synthlearners` |
| 172 | +8. Additional causal and panel estimators only where they belong in this repo |
| 173 | + |
| 174 | +## Repo Boundary |
| 175 | + |
| 176 | +Current working assumption: |
| 177 | + |
| 178 | +- `pyensmallen` should focus on optimization primitives, reusable objectives, supervised estimators, autodiff integration, and inference utilities. |
| 179 | +- `synthlearners` should remain the home for most panel and synthetic-control estimators, while depending on `pyensmallen` where useful. |
| 180 | + |
0 commit comments