Skip to main content

No project description provided

Project description

GitHub License GitHub branch check runs GitHub Issues or Pull Requests GitHub Release

VIEWS Twitter Header

Stepshifter: Time-series Forecasting Model 🔮

Part of the VIEWS Platform ecosystem for large-scale conflict forecasting.


📚 Table of Contents

  1. Overview
  2. Role in the VIEWS Pipeline
  3. Features
  4. Installation
  5. Usage
  6. Architecture
  7. Project Structure
  8. Contributing
  9. License
  10. Acknowledgements

🧠 Overview

Stepshifter is a machine learning model designed for time-series forecasting using Darts. It solves [regression and classification] tasks.

Key Capabilities:

  • Probabilistic Outputs: Binary outputs and point predictions.
  • Learning Approach:
  1. LinearRegressionModel,
  2. RandomForest,
  3. LightGBMModel,
  4. XGBModel,
  5. HurdleModel.
  • Integration-Ready: Built to seamlessly integrate into the larger VIEWS Pipeline.

🌍 Role in the VIEWS Pipeline

Stepshifter serves as part of the Violence & Impacts Early Warning System (VIEWS) pipeline. It complements the following repositories:

Integration Workflow

Stepshifter fits into the pipeline as follows:

  1. Data Input: Processes preprocessed data from views-pipeline-core.
  2. Model Execution: This modeling approach involves shifting all independent variables in time, in order to train models that can predict future values of the dependent variable.
  3. Post-Processing: Outputs are sent to views-evaluation for further analysis.

✨ Features

  • Darts models: Stepshifter model class supports multiple Darts forecasting models, including LinearRegressionModel, RandomForest, LightGBMModel, and XGBModel.
  • Automated Data Cleanup: Stepshifter model class automatically processes missing data and ensures consistent multi-index formatting for time-series data.
  • Hurdle model: Hurdle model class inherits from StepshifterModel. A hurdle model consists of two stages:
    1. Binary stage: Predicts whether the target variable is 0 or > 0.
    2. Positive stage: Predicts the value of the target variable when it is > 0.

⚙️ Installation

Prerequisites

  • Python >= 3.11
  • Access to views-pipeline-core.

Steps

See the organization/pipeline level docs


🚀 Usage

1. Run Training Locally

See the organization/pipeline level docs

2. Use in the VIEWS Pipeline

Stepshifter integrates seamlessly with the VIEWS pipeline. After processing, outputs can be passed to views-evaluation for further calibration or ensembling.


🏗 Architecture

1. Stepshifter Model

This modeling approach involves shifting all independent variables in time, in order to train models that can predict future values of the dependent variable. More details can be found in Appendix A of Hegre et al. (2020).

2. Hurdle Model

This approach differs from a traditional implementation in three aspects:

  1. In the first stage, since Darts doesn't support classification models, a regression model is used instead. These estimates are not strictly bounded between 0 and 1, but this is acceptable for the purpose of this step.
  2. To determine whether an observation is classified as "positive," we apply a threshold. The default threshold is 1, meaning that predictions above this value are considered positive outcomes. It is not set as 0 because most predictions won't be exactly 0. This threshold can be adjusted as a tunable hyperparameter to better suit specific requirements.
  3. In the second stage, a regression model is used to predict for the selected time series. Since Darts time series require a continuous timestamp, we can't get rid of those timestamps with negative prediction produced in the first stage like a traditional implementation. Instead we include the entire time series for countries or PRIO grids where the first stage yielded at least one positive prediction.

🚦 Workflow

  1. Input: VIEWS historical conflict data.
  2. Processing: Converting to Darts time series data.
  3. Prediction: Regression predictions.

Refer to the Appendix A of Hegre et al. (2020) for an in-depth explanation.

For more detailed information about the VIEWS Stepshifter models themselves, refer to the VIEWS models catalog.


🗂 Project Structure

views-stepshifter/
├── README.md          # Documentation
├── tests              # Unit and integration tests
├──  views-stepshifter # Main source code
│   ├── manager        # Management of stepshifter model lifecycle
│   ├── models         # Model algorithms
│   ├── src            # Folder template
│   ├── __init__.py    # Package initialization
├── .gitignore         # Git ignore rules
├── pyproject.toml     # Poetry project file
├── poetry.lock        # Dependency lock file

🤝 Contributing

We welcome contributions to this project! Please follow the guidelines in the VIEWS Documentation.


📜 License

This project is licensed under the LICENSE file.


💬 Acknowledgements

Views Funders

Special thanks to the VIEWS MD&D Team for their collaboration and support.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

views_stepshifter-0.4.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

views_stepshifter-0.4.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file views_stepshifter-0.4.0.tar.gz.

File metadata

  • Download URL: views_stepshifter-0.4.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for views_stepshifter-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b6a7489a5276c65d9d7f30dc2dd6d1c6188d77c6900c996ec006b865c04c5a9e
MD5 97c8dc8c9f2ce46a733c1d9da3564c76
BLAKE2b-256 3807c6217ea54e9a2102499cf04b6341bcc7753f81ef64be21807e6311c9a935

See more details on using hashes here.

File details

Details for the file views_stepshifter-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: views_stepshifter-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for views_stepshifter-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7539c66b6873ec07b42436785245274ed409da35400875cd93735dc3a2563df6
MD5 037aa8a0289d55c06ad834ab60198174
BLAKE2b-256 7ae23598786fb1d4ec968fd02a109cea9c460713dcd5b3f0d91995f7ca84bf3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page