示例#1
0
 def __init__(self, in_channel: int, hidden_size: int, nc: int,
              max_nodes: int):
     super().__init__()
     self.gcn_1 = nn.DenseSAGEConv(in_channel, hidden_size)
     self.gcn_2 = nn.DenseSAGEConv(hidden_size, hidden_size)
     self.pooling = DiffPool(hidden_size, int(0.25 * max_nodes))
     self.gcn_3 = nn.DenseSAGEConv(hidden_size, 2 * hidden_size)
     self.gcn_4 = nn.DenseSAGEConv(2 * hidden_size, 2 * hidden_size)
     self.classifier = torch.nn.Linear(2 * hidden_size, nc)
    def __init__(self, in_channels, out_channels1, out_channels2,
                 out_channels3, out_channels4, out_channels5, out_channels6,
                 maxnodes):
        super(GraphClass, self).__init__()
        self.sage1 = tnn.DenseSAGEConv(in_channels,
                                       out_channels1,
                                       normalize=True)
        self.sage2 = tnn.DenseSAGEConv(out_channels1,
                                       out_channels2,
                                       normalize=True)

        self.poolit1 = nn.Linear(out_channels1, 50)
        self.poolit2 = nn.Linear(out_channels3, 15)

        self.sage3 = tnn.DenseSAGEConv(out_channels1,
                                       out_channels3,
                                       normalize=True)
        #self.sage4=tnn.DenseSAGEConv(out_channels3,out_channels4,normalize=True)

        self.sage5 = tnn.DenseSAGEConv(out_channels3,
                                       out_channels5,
                                       normalize=True)

        self.tr1 = nn.Linear(out_channels5, out_channels6)
        self.tr2 = nn.Linear(out_channels6, 1)
        self.fin = nn.Linear(15, 1)

        self.drop4 = torch.nn.Dropout(p=0.4)
        self.drop3 = torch.nn.Dropout(p=0.3)
        self.drop2 = torch.nn.Dropout(p=0.2)

        ## Batch Normalization
        self.bano1 = nn.BatchNorm1d(num_features=maxnodes)
        self.bano2 = nn.BatchNorm1d(num_features=maxnodes)
        self.bano3 = nn.BatchNorm1d(num_features=50)
        self.bano4 = nn.BatchNorm1d(num_features=50)
        self.bano5 = nn.BatchNorm1d(num_features=15)
示例#3
0
 def build_conv_model(self, node_in_dim, node_out_dim):
     return pyg_nn.DenseSAGEConv(node_in_dim,node_out_dim)
示例#4
0
 def __init__(self, in_channel, hidden_size):
     super().__init__()
     self.pooling = nn.DenseSAGEConv(in_channel, hidden_size)
示例#5
0
    def __init__(self,in_channels, out_channels1, out_channels2,out_channels3,out_channels4, out_channels5,out_channels6, dropout):
        super(GraphAE, self).__init__()   

        #GAE.reset_parameters(self)

        self.out_channels2=out_channels2
        
        """
        Encoding
        """
        ### Encoding
        """
        self.sage1=tnn.DenseGCNConv(in_channels,out_channels1)
        self.sage2=tnn.DenseGCNConv(out_channels1,out_channels2)
        self.sage3=tnn.DenseGCNConv(out_channels2,out_channels3)
        self.sage4=tnn.DenseGCNConv(out_channels3,out_channels4)

        self.sage5=tnn.DenseGCNConv(out_channels4,out_channels5)
        """
        #DenseSAGEConv(in_channels, out_channels, normalize=False, bias=True)
        self.sage1=tnn.DenseSAGEConv(in_channels,out_channels1,normalize=True)
        self.sage2=tnn.DenseSAGEConv(out_channels1,out_channels2,normalize=True)

        self.sage3=tnn.DenseSAGEConv(out_channels2,out_channels3,normalize=True)
        #self.sage4=tnn.DenseSAGEConv(out_channels3,out_channels4,normalize=True)
        ##self.sage42=nn.Linear(out_channels3,out_channels4)

        self.sage5=tnn.DenseSAGEConv(out_channels3,out_channels5,normalize=True)
        
        ##self.poolit1=tnn.DenseSAGEConv(out_channels2,400)
        self.poolit1=nn.Linear(out_channels2,400)
        self.poolit2=nn.Linear(out_channels3,16)
        ##self.poolit2=tnn.DenseSAGEConv(out_channels4,200)
        #self.poolit3=tnn.DenseSAGEConv(out_channels5,10)
        

        #self.tr1=nn.Linear(out_channels5,out_channels6)
        self.tr2=nn.Linear(out_channels5,64)

        self.tr2=nn.Linear(out_channels5,64)

        self.rev2=nn.Linear(64,out_channels5)
        
        """
        self.revsage1=tnn.DenseGCNConv(out_channels1,in_channels)
        self.revsage2=tnn.DenseGCNConv(out_channels2,out_channels1)

        self.revsage3=tnn.DenseGCNConv(out_channels3,out_channels2)
        self.revsage4=tnn.DenseGCNConv(out_channels4,out_channels3)

        self.revsage5=tnn.DenseGCNConv(out_channels5,out_channels4)
        """
        self.revsage1=tnn.DenseSAGEConv(out_channels1,in_channels,normalize=False)
        self.revsage2=tnn.DenseSAGEConv(out_channels2,out_channels1,normalize=False)

        self.revsage3=tnn.DenseSAGEConv(out_channels3,out_channels2,normalize=False)

        self.revsage5=tnn.DenseSAGEConv(out_channels5,out_channels3,normalize=False)

        self.drop5=torch.nn.Dropout(p=0.5)
        self.drop4=torch.nn.Dropout(p=0.4)
        self.drop3=torch.nn.Dropout(p=0.3)

        ## Batch Normalization
        self.bano1 = nn.BatchNorm1d(num_features=1000)
        self.bano2 = nn.BatchNorm1d(num_features=1000)
        self.bano3 = nn.BatchNorm1d(num_features=400)
        self.bano4 = nn.BatchNorm1d(num_features=400)
        self.bano5 = nn.BatchNorm1d(num_features=16)
        self.bano6 = nn.BatchNorm1d(num_features=10)