Skip to content

Instantly share code, notes, and snippets.

@sbalnojan
Created June 7, 2019 14:40
Show Gist options
  • Save sbalnojan/17256735531cf279fb8923e7fc28f360 to your computer and use it in GitHub Desktop.
Save sbalnojan/17256735531cf279fb8923e7fc28f360 to your computer and use it in GitHub Desktop.
train_on_weight= np.array([1,1,0])
print("Now we won't do any fancy preprocessing, just basic training.")
NUM_FILTERS = 1
graph_conv_filters = A # you may try np.eye(3)
graph_conv_filters = K.constant(graph_conv_filters)
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()
model.fit(X, Y, batch_size=A.shape[0], sample_weight=train_on_weight, epochs=200, shuffle=False, verbose=0)
Y_pred = model.predict(X, batch_size=A.shape[0])
print(np.argmax(Y_pred, axis=1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment