libcity.model.traffic_flow_prediction.DGCN¶
-
class
libcity.model.traffic_flow_prediction.DGCN.
DGCN
(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
(batch)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
predict
(batch)[source]¶ 输入一个batch的数据,返回对应的预测值,一般应该是**多步预测**的结果,一般会调用nn.Moudle的forward()方法
- Parameters
batch (Batch) – a batch of input
- Returns
predict result of this batch
- Return type
torch.tensor
-
training
: bool¶
-
-
class
libcity.model.traffic_flow_prediction.DGCN.
SATT_2
(c_in, num_nodes)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(seq)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training
: bool¶
-
-
class
libcity.model.traffic_flow_prediction.DGCN.
SATT_3
(c_in, num_nodes)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(seq)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training
: bool¶
-
-
class
libcity.model.traffic_flow_prediction.DGCN.
ST_BLOCK_2
(c_in, c_out, num_nodes, tem_size, K, Kt, device)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x, supports)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training
: bool¶
-
-
class
libcity.model.traffic_flow_prediction.DGCN.
TATT_1
(c_in, num_nodes, tem_size, device)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(seq)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training
: bool¶
-
-
class
libcity.model.traffic_flow_prediction.DGCN.
T_cheby_conv_ds
(c_in, c_out, K, Kt, device)[source]¶ Bases:
torch.nn.modules.module.Module
x : [batch_size, feat_in, num_node ,tem_size] - input of all time step nSample : number of samples = batch_size nNode : number of node in graph tem_size: length of temporal feature c_in : number of input feature c_out : number of output feature adj : laplacian K : size of kernel(number of cheby coefficients) W : cheby_conv weight [K * feat_in, feat_out]
-
forward
(x, adj)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training
: bool¶
-
-
libcity.model.traffic_flow_prediction.DGCN.
cheb_polynomial
(l_tilde, k)[source]¶ compute a list of chebyshev polynomials from T_0 to T_{K-1}
- Parameters
l_tilde (np.ndarray) – scaled Laplacian, shape (N, N)
k (int) – the maximum order of chebyshev polynomials
- Returns
cheb_polynomials, length: K, from T_0 to T_{K-1}
- Return type
list(np.ndarray)