forked from LibCity/Bigscity-LibCity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* node2vec * node2vec
- Loading branch information
Showing
12 changed files
with
336 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"output_dim": 128, | ||
"is_directed": true, | ||
"p": 2, | ||
"q": 1, | ||
"num_walks": 10, | ||
"walk_length": 80, | ||
"window_size": 10, | ||
"num_workers": 10, | ||
"max_epoch": 1000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
from libcity.data.dataset import TrafficStateDataset | ||
|
||
|
||
class RoadNetWorkDataset(TrafficStateDataset): | ||
def __init__(self, config): | ||
self.config = config | ||
self.dataset = self.config.get('dataset', '') | ||
self.data_path = './raw_data/' + self.dataset + '/' | ||
self.geo_file = self.config.get('geo_file', self.dataset) | ||
self.rel_file = self.config.get('rel_file', self.dataset) | ||
assert os.path.exists(self.data_path + self.geo_file + '.geo') | ||
assert os.path.exists(self.data_path + self.rel_file + '.rel') | ||
super().__init__(config) | ||
|
||
def get_data(self): | ||
""" | ||
返回数据的DataLoader,此类只负责返回路网结构adj_mx,而adj_mx在data_feature中,这里什么都不返回 | ||
""" | ||
return None, None, None | ||
|
||
def get_data_feature(self): | ||
""" | ||
返回一个 dict,包含数据集的相关特征 | ||
Returns: | ||
dict: 包含数据集的相关特征的字典 | ||
""" | ||
return {"adj_mx": self.adj_mx, "num_nodes": self.num_nodes} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from libcity.utils import get_evaluator, ensure_dir | ||
from libcity.executor.abstract_executor import AbstractExecutor | ||
|
||
|
||
class GensimExecutor(AbstractExecutor): | ||
def __init__(self, config, model): | ||
self.evaluator = get_evaluator(config) | ||
self.config = config | ||
self.model = model | ||
self.exp_id = config.get('exp_id', None) | ||
|
||
self.cache_dir = './libcity/cache/{}/model_cache'.format(self.exp_id) | ||
self.evaluate_res_dir = './libcity/cache/{}/evaluate_cache'.format(self.exp_id) | ||
ensure_dir(self.cache_dir) | ||
ensure_dir(self.evaluate_res_dir) | ||
|
||
def evaluate(self, test_dataloader): | ||
""" | ||
use model to test data | ||
""" | ||
self.evaluator.evaluate() | ||
|
||
def train(self, train_dataloader, eval_dataloader): | ||
""" | ||
use data to train model with config | ||
""" | ||
self.model.run() | ||
|
||
def load_model(self, cache_name): | ||
pass | ||
|
||
def save_model(self, cache_name): | ||
pass |
Oops, something went wrong.