Skip to content

Instantly share code, notes, and snippets.

@rohithteja
Last active August 21, 2021 14:34
Show Gist options
  • Select an option

  • Save rohithteja/2d94594032a6ca360618f0947246806e to your computer and use it in GitHub Desktop.

Select an option

Save rohithteja/2d94594032a6ca360618f0947246806e to your computer and use it in GitHub Desktop.
Train Spektral GCN Model
from spektral.data.loaders import SingleLoader
learning_rate = 1e-1
epochs = 100
# Train model
loader_tr = SingleLoader(dataset, sample_weights=weights_tr)
model.fit(loader_tr.load(),
steps_per_epoch=loader_tr.steps_per_epoch,
epochs=epochs)
# Evaluate model
loader_te = SingleLoader(dataset, sample_weights=weights_te)
train_results = model.evaluate(loader_tr.load(), steps=loader_tr.steps_per_epoch)
test_results = model.evaluate(loader_te.load(), steps=loader_te.steps_per_epoch)
print('#' * 50)
print('Train Accuracy: %s' %train_results[1] )
print('Test Accuracy: %s' % test_results[1])
print('#' * 50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment