Skip to main content

FOST Python Package

Project description

FOST

FOST(Forecasting open source tool) aims to provide an easy-use tool for spatial-temporal forecasting. The users only need to organize their data into a certain format and then get the prediction results with one command. FOST automatically handles the missing and abnormal values, and captures both spatial and temporal correlations efficiently.

Framework of FOST

Following is the framework of FOST, basically it contains 4 main components:

FOST framework

Module name Description
Preprocessing Preprocessing module aims at handle varies data situation, currently FOST designed sub-module to handle issues such as missing value, unalignment timestamp and feature selection.
Modeling FOST contains implements for different mainstream deep learning models such as RNN, MLP and GNN, for better performance on varies custom data. Further model implements such as Transformer, N-beats are in progress.
Fusion Fusion module aims at automatically select and ensemble model predictions.
Utils There are many other utils in FOST, such as neural-network trainer and predictor, result plotter and so on.

Quick Start

Installation

Installation of dependency packages

1. Prerequisites

This project relies on pytorch >= 1.8 and torch-geometric >= 1.7.2

2. Installation

You can install fost with pip:

pip install fostool

Train with FOST

1. Import forecasting pipeline

from fostool.pipeline import Pipeline

2. Setting data path and lookahead

You need to pass your train.csv and graph.csv for model training, see dataformat for data preparing.

train_path = '/path/to/your/train.csv'
graph_path = '/path/to/your/graph.csv' # graph_path is alternative
lookahead = 7 # Forward steps you would like to predict.

3. Fit and predict

We provide a default config file in config/default.yaml. You could use your config file through config_path augment.

fost = Pipeline(lookahead=lookahead, train_path=train_path, graph_path=graph_path)
fost.fit()
result = fost.predict()

4. Plot results

fost.plot(result)

Data Format

You can fetch sample data on /examples

1. train.csv

3 columns are required for train.csv:

  • Node: node name for current data
  • Date: date or timestamp for current data
  • TARGET: target for prediction

A valid format may look like:

Node Date TARGET
Alaska 1960-01-01 800592.0
Alaska 1961-01-01 933600.0
Alabama 1960-01-01 10141633.0
Alabama 1961-01-01 9885992.0
Alabama 1962-01-01 10497917.0

Columns except above will be regarded as feature columns.

2. graph.csv (option)

graph.csv should only contains 3 columns:

  • node_0: node name for fist node, node name should align with node name in train.csv.
  • node_1: node name for second node, node name should align with node name in train.csv.
  • weight: weight on connection for node_0 to node_1.

If graph.csv is not provided, identity graph will be used.

Examples

We prepared several examples on examples:

  1. Predict simulation cosine curve
  2. Predict States Energy Data
  3. Save and load model

Contact Us

  • If you have any issues, please create issue here or send messages in gitter.
  • For other reasons, you are welcome to contact us by email(fostool@microsoft.com).

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

fostool-0.0.2.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

fostool-0.0.2-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file fostool-0.0.2.tar.gz.

File metadata

  • Download URL: fostool-0.0.2.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.13

File hashes

Hashes for fostool-0.0.2.tar.gz
Algorithm Hash digest
SHA256 adfc09ed62cd3b002587f5085882fb22279fa98d490a7468030ac6c9b733c738
MD5 b2191d7ef6d57c6d73a3be2e65bc1a8a
BLAKE2b-256 c091ce45d502325c7dc4c1382926335fd3217e2808cf6187bdaafbc7892993e9

See more details on using hashes here.

File details

Details for the file fostool-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: fostool-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 32.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.13

File hashes

Hashes for fostool-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ffc20388e939ad598732855c21d1ec27bc8112640e49fe15395f288a0d31973a
MD5 bd5414fe97736706aef58fe021705093
BLAKE2b-256 81db8fbc61734163fc1dc8cbf78df3ab054463aa9254f144b1080b33236a6206

See more details on using hashes here.

Supported by

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