MontevideoBusDataLoader

class stgraph.dataset.MontevideoBusDataLoader(verbose: bool = False, lags: int = 4, cutoff_time: int | None = None, redownload: bool = False)[source]

Bases: STGraphTemporalDataset

Passenger inflow at bus stops in Montevideo city.

This dataset compiles hourly passenger inflow data for 11 key bus lines in Montevideo, Uruguay, during October 2020. Focused on routes to the city center, it encompasses bus stop vertices, interlinked by edges representing connections with weights indicating road distances. The target variable is passenger inflow, sourced from diverse data outlets within Montevideo’s Metropolitan Transportation System (STM).

This class provides functionality for loading, processing, and accessing the Montevideo Bus dataset for use in deep learning tasks such as passenger inflow prediction.

gdata

num_nodes

num_edges

total_timestamps

675

690

744

Example

from stgraph.dataset import MontevideoBusDataLoader

monte = MontevideoBusDataLoader(verbose=True)
num_nodes = monte.gdata["num_nodes"]
num_edges = monte.gdata["num_edges"]
total_timestamps = monte.gdata["total_timestamps"]

edge_list = monte.get_edges()
edge_weights = monte.get_edge_weights()
feats = monte.get_all_features()
targets = monte.get_all_targets()
Parameters:
  • verbose (bool, optional) – Flag to control whether to display verbose info (default is False)

  • lags (int, optional) – The number of time lags (default is 4)

  • cutoff_time (int, optional) – The cutoff timestamp for the temporal dataset (default is None)

  • redownload (bool, optional (default is False)) – Redownload the dataset online and save to cache

name

The name of the dataset.

Type:

str

gdata

Graph meta data.

Type:

dict

get_all_features() ndarray[source]

Return the features for each timestamp.

get_all_targets() ndarray[source]

Return the targets for each timestamp.

get_edge_weights() ndarray[source]

Return the edge weights.

get_edges() list[source]

Return the edge list.