Created
June 7, 2019 14:59
-
-
Save sbalnojan/cadba64cceb9f58d6039aa1a8c857294 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("this simply ignores the connected edges, thus receives a pretty bad test_acc:") | |
graph_conv_filters = np.eye(A_norm.shape[0]) | |
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: 0099 train_acc= 1.0000 test_acc= 0.5130 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment