﻿# PEMS-BAY and METR-LA: sensor order must match the graph matrix

Preserve sensor IDs across traffic table columns, generated forecasting tensors and DCRNN adjacency matrices instead of relying on matching dimensions.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-pems-dcrnn-sensor-axis-adjacency-identity/
Language: en

## Matching node counts do not establish a shared graph

A traffic forecaster can accept a valid adjacency matrix and a valid observation tensor while connecting every reading to the wrong road sensor. The problem is positional identity rather than shape. If a preprocessing step sorts traffic columns differently from graph construction, the neural network receives another spatial problem. Check the node mapping before interpreting forecast errors as evidence about the architecture or adjusting graph-convolution parameters to compensate.

## Retain the traffic column identities

The [DCRNN data instructions](https://raw.githubusercontent.com/liyaguang/DCRNN/master/README.md) describe time-indexed traffic frames and the METR-LA and PEMS-BAY files. Preserve their column identifiers when producing a numerical array. Display labels invented for an example do not authorize rebuilding identities from sequential node numbers. Store the actual source-column sequence beside exported tensors, including any filtering or renaming performed before model-specific feature construction.

## Read the graph artifact as more than a matrix

The [adjacency generator](https://raw.githubusercontent.com/liyaguang/DCRNN/master/scripts/gen_adj_mx.py) constructs a sensor-to-index mapping from an ordered identifier list and returns that list, mapping and adjacency array together. Keep the bundle intact. If the traffic axis must be reordered, apply the corresponding permutation to both graph axes. Permuting only matrix rows or sorting labels without moving the values does not preserve the graph represented by the original artifact.

## Inspect what tensor generation no longer names

The [training-data generator](https://raw.githubusercontent.com/liyaguang/DCRNN/master/scripts/generate_training_data.py) expands frame values into observation tensors and assembles temporal features and windows. Once a column-labelled frame becomes an array, its numerical positions no longer carry readable sensor identity by themselves. Retain a sidecar schema and confirm that the selected graph belongs to the same dataset. A graph for another city cannot be made equivalent merely by cropping it to an equal node count.

## Test identity with a deliberately reordered input

Choose a diagnostic sensor and trace its reading and graph neighbours through export and reload. A deliberate column permutation should either be consistently propagated or rejected by validation. [Tensor-axis documentation](/journal/tensor-axes-batch-sequence-hidden/) and [data-artifact integrity](/journal/safetensors-artifact-validation/) offer related techniques. This check establishes spatial correspondence, not a new traffic benchmark. Report it separately from normalization, chronological holdouts and measured inference speed, which depend on additional and independently specified choices.
