Skip to content

its2s

its2s /ˈɪts.tuː.ɛs/ noun
  1. An open-source Python package for interrupted time series, 2-stage counterfactual analysis with moving-block bootstrap confidence intervals.
  2. A modular framework for fitting ITS models with cross-validation, hyperparameter tuning, and reproducible end-to-end workflows.

Why its2s?

  • Flexibility: its2s is designed to be flexible, allowing you to easily use this methodology with any data, model, and settings.
  • Modularity: its2s is designed to be modular, allowing you to use the parts of the pipeline that you need.
  • Reproducibility: its2s is designed to be reproducible via seeding and rigorous parameter documentation, allowing you to reproduce the results of your analysis easily.
  • Efficiency: its2s is 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
from its2s import run_single_its, run_batch

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)
from its2s import compare_models, tune_model

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