its2s
- its2s /ˈɪts.tuː.ɛs/ noun
-
- An open-source Python package for interrupted time series, 2-stage counterfactual analysis with moving-block bootstrap confidence intervals.
- A modular framework for fitting ITS models with cross-validation, hyperparameter tuning, and reproducible end-to-end workflows.
Why its2s?¶
- Flexibility:
its2sis designed to be flexible, allowing you to easily use this methodology with any data, model, and settings. - Modularity:
its2sis designed to be modular, allowing you to use the parts of the pipeline that you need. - Reproducibility:
its2sis designed to be reproducible via seeding and rigorous parameter documentation, allowing you to reproduce the results of your analysis easily. - Efficiency:
its2sis designed to run quickly and efficiently, allowing you to run the analysis quickly and easily.
Core API¶
| Function | Overview | Inputs | Outputs |
|---|---|---|---|
run_single_its |
End-to-end ITS pipeline for a single series: split, fit, bootstrap, score, save outputs. | df, intervention_date, model_name (prophet_xgb / prophet_then_xgb / neuralprophet / arima), optional config_path / config_overrides, optional output_dir |
PipelineResult (+ files when output_dir is set) |
run_batch |
Run the pipeline over many series, optionally in parallel. | series_list (list of dicts with series_id, df, intervention_date, …), optional config_path, output_dir, n_jobs, seed |
list of PipelineResult |
Additional functionality¶
| Function | Overview | Inputs | Outputs |
|---|---|---|---|
compare_models |
Fit several models on the same series and compare metrics side-by-side. | df, intervention_date, model_names, optional config / overrides, output_dir |
comparison DataFrame + per-model PipelineResult |
tune_model |
Latin hypercube hyperparameter search via expanding-window CV. Run before run_single_its to pick hyperparameters, then pass best_params via config_overrides. |
df, intervention_date, model_name, n_trials, n_folds, optional metric / cv_end_date |
TuningResult (best params + per-trial scores) |
What's next?¶
- Setup — install the package into a Python environment.
- Quick Start — a minimal example using simulated data, plus your-own-data, outputs, covariates, and configuration.
- Tutorials — six step-by-step notebooks: data splitting, cross-validation, hyperparameter tuning, model variants, moving-block bootstrap, and a full end-to-end workflow.
- API Reference — function signatures and docstrings for the public API.
- Citation — how to cite
its2s.
Getting help and contributing¶
If you have a question, feature request, or bug, please open an issue.
Contact¶
Maintained by: - Arnab Dey: arnabxdey@gmail.com · @arnabkdey on GitHub - Lauren Wilner: wilnerl@uw.edu · @laurenwilner on GitHub