Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
print("this filter includes the edges, so it should perform considerably better than before.:")
graph_conv_filters = A_norm
graph_conv_filters = K.constant(graph_conv_filters)
num_filters = 1
model = Sequential()
model.add(GraphCNN(Y.shape[1], num_filters, graph_conv_filters, input_shape=(X.shape[1],), activation='elu',
kernel_regularizer=l2(5e-4)))
model.add(Activation('softmax'))
model.compile(loss='categorical_crossentropy', optimizer=Adam(lr=0.01), metrics=['acc'])
model.summary()
nb_epochs = 100
for epoch in range(nb_epochs):
model.fit(X, y_train, sample_weight=train_mask, batch_size=A.shape[0], epochs=1, shuffle=False, verbose=0)
Y_pred = model.predict(X, batch_size=A.shape[0])
_, train_acc = utils.evaluate_preds(Y_pred, [y_train], [idx_train])
_, test_acc = utils.evaluate_preds(Y_pred, [y_test], [idx_test])
print("Epoch: {:04d}".format(epoch), "train_acc= {:.4f}".format(train_acc[0]), "test_acc= {:.4f}".format(test_acc[0]))
#
# Epoch: 0017 train_acc= 1.0000 test_acc= 0.6950
# Epoch: 0099 train_acc= 1.0000 test_acc= 0.7600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment