-
Notifications
You must be signed in to change notification settings - Fork 0
Stepshift
ViEWS uses a bespoke modelling approach which involves shifting all independent variables in time, in order to train models that can predict future values of the dependent variable. This approach is described in more detail in Appendix A of Hegre et al. (2020).
The modelling technique is implemented in a python package called stepshift, which can be installed using pip:
pip install stepshift
Stepshift has a module called stepshift.views which contains a class called
StepshiftedModels. This class wraps the stepshifting procedure, exposing a
simple, Scikit-Learn-like (but not equivalent) API. The model takes three
arguments: A scikit learn estimator, a list containing integers, which denotes
the steps, and a string variable which is the name of the dependent variable:
from sklearn.linear_model import LogisticRegression
from stepshift.views import StepshiftedModels
mdl = StepshiftedModels(LogisticRegression(),[1,2,3,4,5,6,7,8],"outcome")
- Hegre H, Bell C, Colaresi M, et al. ViEWS2020: Revising and evaluating the ViEWS political Violence Early-Warning System. Journal of Peace Research. 2021;58(3):599-611. doi:10.1177/0022343320962157