stgraph.dataset.temporal package¶
Submodules¶
stgraph.dataset.temporal.hungarycp_dataloader module¶
County level chicken pox cases in Hungary.
- class stgraph.dataset.temporal.hungarycp_dataloader.HungaryCPDataLoader(verbose: bool = False, lags: int = 4, cutoff_time: int | None = None, redownload: bool = False)[source]¶
Bases:
STGraphTemporalDatasetCounty level chicken pox cases in Hungary.
This dataset comprises information on weekly occurrences of chickenpox in Hungary from 2005 to 2015. The graph structure is static with nodes representing the counties and edges are neighbourhoods between them. Vertex features are lagged weekly counts of the chickenpox cases.
This class provides functionality for loading, processing, and accessing the Hungary Chickenpox dataset for use in deep learning tasks such as County level case count prediction.
gdata¶ num_nodes
num_edges
total_timestamps
20
102
521
Example
from stgraph.dataset import HungaryCPDataLoader hungary = HungaryCPDataLoader(verbose=True) num_nodes = hungary.gdata["num_nodes"] edge_list = hungary.get_edges()
- 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
stgraph.dataset.temporal.metrla_dataloader module¶
Traffic forecasting based on Los Angeles city.
- class stgraph.dataset.temporal.metrla_dataloader.METRLADataLoader(verbose: bool = False, num_timesteps_in: int = 12, num_timesteps_out: int = 12, cutoff_time: int | None = None, redownload: bool = False)[source]¶
Bases:
STGraphTemporalDatasetTraffic forecasting dataset based on the Los Angeles city.
A dataset for predicting traffic patterns in the Los Angeles Metropolitan area, comprising traffic data obtained from 207 loop detectors on highways in Los Angeles County. The dataset includes aggregated 5-minute interval readings spanning a four-month period from March 2012 to June 2012.
This class provides functionality for loading, processing, and accessing the METRLA dataset for use in deep learning tasks such as traffic forecasting.
gdata¶ num_nodes
num_edges
total_timestamps
207
1722
100
Example
from stgraph.dataset import METRLADataLoader metrla = METRLADataLoader(verbose=True) num_nodes = metrla.gdata["num_nodes"] num_edges = metrla.gdata["num_edges"] total_timestamps = metrla.gdata["total_timestamps"] edge_list = metrla.get_edges() edge_weights = metrla.get_edge_weights() feats = metrla.get_all_features() targets = metrla.get_all_targets()
- Parameters:
verbose (bool, optional) – Flag to control whether to display verbose info (default is False)
num_timesteps_in (int, optional) – The number of timesteps the sequence model sees (default is 12)
num_timesteps_out (int, optional) – The number of timesteps the sequence model has to predict (default is 12)
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
stgraph.dataset.temporal.montevideobus_dataloader module¶
Passenger inflow at bus stops in Montevideo city.
- class stgraph.dataset.temporal.montevideobus_dataloader.MontevideoBusDataLoader(verbose: bool = False, lags: int = 4, cutoff_time: int | None = None, redownload: bool = False)[source]¶
Bases:
STGraphTemporalDatasetPassenger 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
stgraph.dataset.temporal.pedalme_dataloader module¶
PedalMe Bicycle deliver orders in London.
- class stgraph.dataset.temporal.pedalme_dataloader.PedalMeDataLoader(verbose: bool = False, lags: int = 4, cutoff_time: int | None = None, redownload: bool = False)[source]¶
Bases:
STGraphTemporalDatasetPedalMe Bicycle deliver orders in London.
This class provides functionality for loading, processing, and accessing the PedalMe dataset for use in deep learning tasks such as node classification.
gdata¶ num_nodes
num_edges
total_timestamps
15
225
36
Example
from stgraph.dataset import PedalMeDataLoader pedal = PedalMeDataLoader(verbose=True) num_nodes = pedal.gdata["num_nodes"] num_edges = pedal.gdata["num_edges"] total_timestamps = pedal.gdata["total_timestamps"] edge_list = pedal.get_edges() edge_weights = pedal.get_edge_weights() targets = pedal.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
stgraph.dataset.temporal.stgraph_temporal_dataset module¶
Base class for all STGraph temporal graph datasets.
- class stgraph.dataset.temporal.stgraph_temporal_dataset.STGraphTemporalDataset[source]¶
Bases:
STGraphDatasetBase class for temporal graph datasets.
This class is a subclass of
STGraphDatasetand provides the base structure for handling temporal graph datasets.
stgraph.dataset.temporal.wikimath_dataloader module¶
Vital mathematical articles sourced from Wikipedia.
- class stgraph.dataset.temporal.wikimath_dataloader.WikiMathDataLoader(verbose: bool = False, lags: int = 8, cutoff_time: int | None = None, redownload: bool = False)[source]¶
Bases:
STGraphTemporalDatasetVital mathematical articles sourced from Wikipedia.
The graph dataset is static, with vertices representing Wikipedia pages and edges representing links. The graph is both directed and weighted, where the weights indicate the number of links originating from the source page connecting to the target page. The target is the daily user visits to the Wikipedia pages between March 16th 2019 and March 15th 2021 which results in 731 periods.
This class provides functionality for loading, processing, and accessing the Hungary Chickenpox dataset for use in deep learning tasks such as County level case count prediction.
gdata¶ num_nodes
num_edges
total_timestamps
1068
27079
731
Example
from stgraph.dataset import WikiMathDataLoader wiki = WikiMathDataLoader(verbose=True) num_nodes = wiki.gdata["num_nodes"] num_edges = wiki.gdata["num_edges"] total_timestamps = wiki.gdata["total_timestamps"] edge_list = wiki.get_edges() edge_weights = wiki.get_edge_weights() targets = wiki.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 8)
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
stgraph.dataset.temporal.windmilloutput_dataloader module¶
Hourly energy output of windmills.
- class stgraph.dataset.temporal.windmilloutput_dataloader.WindmillOutputDataLoader(verbose: bool = False, lags: int = 8, cutoff_time: int | None = None, size: str = 'large', redownload: bool = False)[source]¶
Bases:
STGraphTemporalDatasetHourly energy output of windmills.
This class provides functionality for loading, processing, and accessing the Windmill output dataset for use in deep learning such as regression tasks.
gdata for Windmill Output Small¶ num_nodes
num_edges
total_timestamps
11
121
17472
gdata for Windmill Output Medium¶ num_nodes
num_edges
total_timestamps
26
676
17472
gdata for Windmill Output Large¶ num_nodes
num_edges
total_timestamps
319
101761
17472
Example
from stgraph.dataset import WindmillOutputDataLoader wind_small = WindmillOutputDataLoader(verbose=True, size="small") num_nodes = wind_small.gdata["num_nodes"] num_edges = wind_small.gdata["num_edges"] total_timestamps = wind_small.gdata["total_timestamps"] edge_list = wind_small.get_edges() edge_weights = wind_small.get_edge_weights() targets = wind_small.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 8)
cutoff_time (int, optional) – The cutoff timestamp for the temporal dataset (default is None)
size (str, optional) – The dataset size among large, medium and small (default is large)
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
Module contents¶
Collection of dataset loaders for Temporal real-world datasets.