libcity.model.road_representation¶
-
class
libcity.model.road_representation.
ChebConv
(config, data_feature)[source]¶ Bases:
libcity.model.abstract_traffic_state_model.AbstractTrafficStateModel
-
calculate_loss
(batch)[source]¶ - Parameters
batch – dict, need key ‘node_features’, ‘node_labels’, ‘mask’
Returns:
-
forward
(batch)[source]¶ 自回归任务
- Parameters
batch – dict, need key ‘node_features’ contains tensor shape=(N, feature_dim)
- Returns
N, feature_dim
- Return type
torch.tensor
-
training
: bool¶
-
-
class
libcity.model.road_representation.
DeepWalk
(config, data_feature)[source]¶ Bases:
libcity.model.abstract_traffic_tradition_model.AbstractTraditionModel
-
class
libcity.model.road_representation.
GAT
(config, data_feature)[source]¶ Bases:
libcity.model.abstract_traffic_state_model.AbstractTrafficStateModel
-
calculate_loss
(batch)[source]¶ - Parameters
batch – dict, need key ‘node_features’, ‘node_labels’, ‘mask’
Returns:
-
forward
(batch)[source]¶ 自回归任务 :param batch: dict, need key ‘node_features’ contains tensor shape=(N, feature_dim)
- Returns
N, feature_dim
- Return type
torch.tensor
-
training
: bool¶
-
-
class
libcity.model.road_representation.
GeomGCN
(config, data_feature)[source]¶ Bases:
libcity.model.abstract_traffic_state_model.AbstractTrafficStateModel
-
calculate_loss
(batch)[source]¶ - Parameters
batch – dict, need key ‘node_features’, ‘node_labels’, ‘mask’
Returns:
-
forward
(batch)[source]¶ 自回归任务
- Parameters
batch – dict, need key ‘node_features’ contains tensor shape=(N, feature_dim)
- Returns
N, output_classes
- Return type
torch.tensor
-
training
: bool¶
-
-
class
libcity.model.road_representation.
LINE
(config, data_feature)[source]¶ Bases:
libcity.model.abstract_traffic_state_model.AbstractTrafficStateModel
-
calculate_loss
(batch)[source]¶ 输入一个batch的数据,返回训练过程的loss,也就是需要定义一个loss函数
- Parameters
batch (Batch) – a batch of input
- Returns
return training loss
- Return type
torch.tensor
-
forward
(I, J)[source]¶ - Parameters
I – origin indices of node i ; (B,)
J – origin indices of node j ; (B,)
- Returns
[u_j^T * u_i for (i,j) in zip(I, J)]; (B,) elif order == ‘second’:
[u’_j^T * v_i for (i,j) in zip(I, J)]; (B,)
- Return type
if order == ‘first’
-
training
: bool¶
-
-
class
libcity.model.road_representation.
Node2Vec
(config, data_feature)[source]¶ Bases:
libcity.model.abstract_traffic_tradition_model.AbstractTraditionModel