OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Models

Crossformer

Crossformer is an open-source PyTorch implementation of a Transformer model for multivariate time-series forecasting. It embeds time segments within each variable, learns temporal and cross-variable dependencies through two-stage attention, and uses a hierarchical encoder-decoder to forecast at multiple scales.

Independent OpenViST project profile, based on linked sources.

Crossformer — OpenViST project profile in AI Models.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use Crossformer when you need a documented Python/PyTorch research implementation for multivariate forecasting and can prepare data in the repository’s expected format.

Who it is for

  • Researchers running multivariate time-series forecasting experiments
  • Practitioners prototyping forecasts that model relationships across variables
  • Teams comparing transformer-based forecasting approaches on benchmark datasets

Documented uses

  • Train and evaluate forecasts using historical observations from multiple variables
  • Adapt a documented CSV-based workflow to a custom multivariate dataset
  • Save predictions and ground truth for evaluation
Before you choose

Requirements & limits

The public GitHub repository identifies the project as Apache-2.0 licensed.

  • The documented environment pins Python 3.7.10 and specific NumPy, pandas, PyTorch and einops versions.
  • Custom data must be formatted as a date or blank first column followed by the multivariate series.
  • The architecture uses Dimension-Segment-Wise embedding, two-stage attention with routers, and a hierarchical encoder-decoder.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Train and evaluate with a custom CSV dataset

Use the documented AirQuality example to train Crossformer and save forecasts alongside ground-truth series.

Before you start

  • Python 3.7.10
  • numpy==1.20.3, pandas==1.3.2, torch==1.8.1 and einops==0.4.1
  • A CSV formatted with a date column (or a blank first column) followed by 13 time-series columns
  • Place the formatted CSV in the datasets/ folder

Steps

  1. Format AirQualityUCI.csv with the first column as the date or blank and the remaining 13 columns as series; place it in datasets/.

  2. Run the command below.

    Documented command
    python main_crossformer.py --data AirQuality --data_path AirQualityUCI.csv --data_dim 13 --in_len 168 --out_len 24 --seg_len 6
  3. Run the command below.

    Documented command
    python eval_crossformer.py --setting_name Crossformer_AirQuality_il168_ol24_sl6_win2_fa10_dm256_nh4_el3_itr0 --save_pred

Expected outcome

The evaluation produces predictions and ground-truth series in the documented AirQuality results directory.

Guide limitations

  • The example specifies hourly data, a 168-hour history, a 24-hour forecast and segment length 6.
  • The repository instructions do not establish that other data layouts work without adapting the dataset.
Source-based practical guide

Reproduce the documented ETTh1 experiment

Train and test Crossformer on ETTh1 using the repository’s specified history, forecast and segment lengths.

Before you start

  • Python 3.7.10
  • numpy==1.20.3, pandas==1.3.2, torch==1.8.1 and einops==0.4.1
  • The ETTh1 dataset in the datasets/ folder

Steps

  1. Place the dataset in datasets/.

  2. Run the command below.

    Documented command
    python main_crossformer.py --data ETTh1 --in_len 168 --out_len 24 --seg_len 6 --itr 1

Expected outcome

The documented workflow trains and tests the model, saves the trained model under checkpoints/ and writes evaluation metrics under results/.

Guide limitations

  • This command documents the ETTh1 configuration with a 168-step input, 24-step output and segment length 6.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
17 October 2026
Original website title
Thinklab-SJTU/Crossformer · Official homepage title · retained in its source language