Skip to content

Instantly share code, notes, and snippets.

@Wapiti08
Created June 21, 2022 09:20
Show Gist options
  • Save Wapiti08/f917d46ef528e691604713dadb61d76a to your computer and use it in GitHub Desktop.
Save Wapiti08/f917d46ef528e691604713dadb61d76a to your computer and use it in GitHub Desktop.
dgcnn
dgcnn = DeepGraphCNN(
layer_sizes = self.gcn_layers_size,
activations = ['tanh', 'tanh', 'tanh', 'tanh'],
k = self.gcn_nrows,
generator = generator,
bias=False,
)
# get the gnn out and gnn input
gnn_inp, gnn_out = dgcnn.in_out_tensors()
# buid cnn with gnn out as the input
x_out = Conv1D(filters=16, kernel_size=sum(self.gcn_layers_size), strides=sum(self.gcn_layers_size))(gnn_out)
x_out = MaxPool1D(pool_size=2)(x_out)
x_out = Conv1D(filters=32, kernel_size=5, strides=1)(x_out)
x_out = Flatten()(x_out)
x_out = Dense(128, activation='relu')(x_out)
x_out = Dropout(0.5)(x_out)
predictions = Dense(class_num, activation='softmax')(x_out)
model = Model(inputs=gnn_inp, outputs=predictions)
model.compile(optimizer=Adam(lr=0.001), loss=categorical_crossentropy, metrics=['accuracy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment