I am happy to announce a new Stata package which I wrote together with Mark Schaffer and Chris Hansen.

pystacked implements stacked generalization (Wolpert, 1992) via scikit-learn’s sklearn.ensemble.StackingRegressor and sklearn.ensemble.StackingClassifier. Stacking is a way of combining predictions from multiple supervised machine learners (the “base learners”) into a final prediction to improve performance. The currently-supported base learners are:
  • Linear regression
  • Logistic regression
  • Lasso, ridge and elastic net
  • Support vector machines
  • Gradient boosted trees
  • Random forest
  • Neural nets (Multi-layer Perceptron)
pystacked can also be used with a single base learner and, thus, provides an easy-to-use API for scikit-learn’s machine learning algorithms.



Plenty of examples are provided on our website: https://statalasso.github.io/docs/pystacked/

This is the first publicly released version of pystacked -- Feedback and bug reports are very much welcome.

pystacked is not yet on SSC. You can install it from github:

Code:
net install pystacked, from(https://raw.githubusercontent.com/aahrens1/pystacked/main) replace
See also installation instructions here.