예제 #1
0
 def __init__(self, *args, **kwargs):
     self.num_nodes = num_node
     self.edges = neighbor
     self.self_loops = [(i, i) for i in range(self.num_nodes)]
     self.A_binary = tools.get_adjacency_matrix(self.edges, self.num_nodes)
     self.A_binary_with_I = tools.get_adjacency_matrix(
         self.edges + self.self_loops, self.num_nodes)
예제 #2
0
파일: magcn.py 프로젝트: zqylen/MAGCN
    def __init__(self,  in_channels, drop_out, adj_filename, id_filename, num_of_vertices, num_for_predict,
                 num_of_hours,num_of_days,num_of_weeks,):
        super(Model, self).__init__()
        A = get_adjacency_matrix(adj_filename, num_of_vertices, id_filename)

        # num_pre = bool(num_of_hours) + bool(num_of_days) + bool(num_of_weeks)
        #self.data_bn = nn.BatchNorm1d(num_pre * num_of_vertices * 3)

        self.l1 = STMultiAdaptiveGCN(in_channels, 64, A, residual=False)
        self.l2 = STMultiAdaptiveGCN(64, 64, A,)
        self.l3 = STMultiAdaptiveGCN(64, 64, A,)

        self.final_conv = nn.Conv2d(int(num_for_predict/num_of_hours), num_for_predict, kernel_size=(1, 64))

        if drop_out:
            self.drop_out = nn.Dropout(drop_out)
        else:
            self.drop_out = lambda x: x