Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to adapt the models to grid data and the correspondence between data and models? #368

Open
aptx1231 opened this issue Oct 11, 2023 · 3 comments

Comments

@aptx1231
Copy link
Member

aptx1231 commented Oct 11, 2023

For the details, please visit https://bigscity-libcity-docs.readthedocs.io/en/latest/user_guide/data/dataset_for_task.html

Note 5. There are some models that require three inputs, i.e., CLOSENESS, PERIOD, TREND, such as STResNet, ACFM, ASTGCN. for such models we implemented corresponding generalized versions with only CLOSENESS inputs for fair comparisons, i.e., STResNetCommon, ACFMCommon, ASTGCNCommon.

@aptx1231 aptx1231 pinned this issue Oct 11, 2023
@aptx1231
Copy link
Member Author

aptx1231 commented Oct 11, 2023

Here is how to generalize models used for point-based data for grid-based data.

(1) If the dataset class used by the model is TrafficStatePointDataset, such as AGCRN, ASTGCNCommon, CCRNN, etc., you can directly set dataset_class to TrafficStateGridDataset in task_file.json or through a custom configuration file(--config_file). Then set the parameter use_row_column of TrafficStateGridDataset to False.

(2) If the dataset class used by the model is the subclass of TrafficStatePointDataset, such as ASTGCNDataset, CONVGCNDataset, STG2SeqDataset, etc., you can modify the file of the dataset class to make it inherit TrafficStateGridDataset instead of the current TrafficStatePointDataset. Then set the parameter use_row_column in the function init() to False.

Example (1):

Before modification:

task_config.json
"RNN": {
"dataset_class": "TrafficStatePointDataset",
},
TrafficStateGridDataset.json
{
"use_row_column": true
}

After modification:

task_config.json
"RNN": {
"dataset_class": "TrafficStateGridDataset",
},
TrafficStateGridDataset.json
{
"use_row_column": false
}

Example (2)::

Before modification:

task_config.json
"STG2Seq": {
"dataset_class": "STG2SeqDataset",
},
STG2SeqDataset.json
{
"use_row_column": false
}
stg2seq_dataset.py
from libcity.data.dataset import TrafficStatePointDataset
class STG2SeqDataset(TrafficStatePointDataset):
def init(self, config):
super().init(config)
pass

After modification:

task_config.json
"STG2Seq": {
"dataset_class": "STG2SeqDataset",
},
STG2SeqDataset.json
{
"use_row_column": false
}
stg2seq_dataset.py
from libcity.data.dataset import TrafficStateGridDataset
class STG2SeqDataset(TrafficStateGridDataset):
def init(self, config):
super().init(config)
self.use_row_column = False
pass

@aptx1231
Copy link
Member Author

image image

@aptx1231
Copy link
Member Author

Additional processing may be required for some special models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant