Beispiel #1
0
def main():
    num_reps = 10

    # Smaller datasets.
    dataset = [["IMDB-BINARY", False], ["IMDB-MULTI", False], ["NCI1", True],
               ["NCI109", True], ["PROTEINS", True], ["PTC_FM", True],
               ["REDDIT-BINARY", False], ["ENZYMES", True]]

    results = []
    for d, use_labels in dataset:
        dp.get_dataset(d)

        acc, s_1, s_2 = gnn_evaluation(GIN0,
                                       d, [1, 2, 3, 4, 5], [32, 64, 128],
                                       max_num_epochs=200,
                                       batch_size=64,
                                       start_lr=0.01,
                                       num_repetitions=num_reps,
                                       all_std=True)
        print(d + " " + "GIN0 " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GIN0 " + str(acc) + " " + str(s_1) + " " +
                       str(s_2))

        acc, s_1, s_2 = gnn_evaluation(GIN,
                                       d, [1, 2, 3, 4, 5], [32, 64, 128],
                                       max_num_epochs=200,
                                       batch_size=64,
                                       start_lr=0.01,
                                       num_repetitions=num_reps,
                                       all_std=True)
        print(d + " " + "GIN " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GIN " + str(acc) + " " + str(s_1) + " " +
                       str(s_2))

    num_reps = 3

    # Larger datasets with edge labels.
    dataset = [["Yeast", True], ["YeastH", True], ["UACC257", True],
               ["UACC257H", True], ["OVCAR-8", True], ["OVCAR-8H", True]]
    dataset = [["YeastH", True], ["UACC257", True], ["UACC257H", True],
               ["OVCAR-8", True], ["OVCAR-8H", True]]

    for d, use_labels in dataset:
        dp.get_dataset(d)

        acc, s_1, s_2 = gnn_evaluation(GINE,
                                       d, [2], [64],
                                       max_num_epochs=200,
                                       batch_size=64,
                                       start_lr=0.01,
                                       num_repetitions=num_reps,
                                       all_std=True)
        print(d + " " + "GINE " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GINE " + str(acc) + " " + str(s_1) + " " +
                       str(s_2))

        acc, s_1, s_2 = gnn_evaluation(GINE0,
                                       d, [2], [64],
                                       max_num_epochs=200,
                                       batch_size=64,
                                       start_lr=0.01,
                                       num_repetitions=num_reps,
                                       all_std=True)
        print(d + " " + "GINE0 " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GINE0 " + str(acc) + " " + str(s_1) + " " +
                       str(s_2))
Beispiel #2
0
import auxiliarymethods.datasets as dp
from auxiliarymethods.gnn_evaluation import gnn_evaluation
from gnn_baselines.gnn_architectures import GIN
from auxiliarymethods.reader import tud_to_networkx

dataset = "PROTEINS"
use_labels = True

# Download dataset.
dp.get_dataset(dataset)

# Optimize the number of layers ({1,2,3,4,5}) and
# the number of hidden features ({32,64,128}),
# set the maximum nummber of epochs to 200,
# batch size to 64,
# start learning rate to 0.01, and
# number of repetitions for 10-CV to 10.
print(
    gnn_evaluation(GIN,
                   dataset, [1, 2, 3, 4, 5], [32, 64, 128],
                   max_num_epochs=200,
                   batch_size=64,
                   start_lr=0.01,
                   num_repetitions=10,
                   all_std=True))
Beispiel #3
0
def main():
    num_reps = 10

    ### Smaller datasets.
    dataset = [["IMDB-BINARY", False], ["IMDB-MULTI", False], ["NCI1", True], ["PROTEINS", True],
               ["REDDIT-BINARY", False], ["ENZYMES", True]]

    results = []
    for d, use_labels in dataset:
        # Download dataset.
        dp.get_dataset(d)

        # GIN, dataset d, layers in [1:6], hidden dimension in {32,64,128}.
        acc, s_1, s_2 = gnn_evaluation(GIN, d, [1, 2, 3, 4, 5], [32, 64, 128], max_num_epochs=200, batch_size=64,
                                       start_lr=0.01, num_repetitions=num_reps, all_std=True)
        print(d + " " + "GIN " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GIN " + str(acc) + " " + str(s_1) + " " + str(s_2))

        # GIN with jumping knowledge, dataset d, layers in [1:6], hidden dimension in {32,64,128}.
        acc, s_1, s_2 = gnn_evaluation(GINWithJK, d, [1, 2, 3, 4, 5], [32, 64, 128], max_num_epochs=200,
                                       batch_size=64,
                                       start_lr=0.01, num_repetitions=num_reps, all_std=True)
        print(d + " " + "GINWithJK " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GINWithJK " + str(acc) + " " + str(s_1) + " " + str(s_2))

    num_reps = 3
    print(num_reps)

    ### Midscale datasets.
    dataset = [["MOLT-4", True, True], ["Yeast", True, True], ["MCF-7", True, True]]

    for d, use_labels, _ in dataset:
        print(d)
        dp.get_dataset(d)

        # GINE (GIN with edge labels), dataset d, 3 layers, hidden dimension in {64}.
        acc, s_1, s_2 = gnn_evaluation(GINE, d, [3], [64], max_num_epochs=200,
                                       batch_size=64, start_lr=0.01,
                                       num_repetitions=num_reps, all_std=True)
        print(d + " " + "GINE " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GINE " + str(acc) + " " + str(s_1) + " " + str(s_2))

        # GINE (GIN with edge labels) with jumping knowledge, dataset d, 3 layers, hidden dimension in {64}.
        acc, s_1, s_2 = gnn_evaluation(GINEWithJK, d, [3], [64], max_num_epochs=200,
                                       batch_size=64,
                                       start_lr=0.01,
                                       num_repetitions=num_reps, all_std=True)
        print(d + " " + "GINEJK " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GINEJK " + str(acc) + " " + str(s_1) + " " + str(s_2))

    dataset = [["reddit_threads", False, False],
               ["github_stargazers", False, False],
               ]

    for d, use_labels, _ in dataset:
        print(d)
        dp.get_dataset(d)

        # GINE (GIN with edge labels), dataset d, 3 layers, hidden dimension in {64}.
        acc, s_1, s_2 = gnn_evaluation(GIN, d, [3], [64], max_num_epochs=200,
                                       batch_size=64, start_lr=0.01,
                                       num_repetitions=num_reps, all_std=True)
        print(d + " " + "GIN " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GIN " + str(acc) + " " + str(s_1) + " " + str(s_2))

        # GINE (GIN with edge labels) with jumping knowledge, dataset d, 3 layers, hidden dimension in {64}.
        acc, s_1, s_2 = gnn_evaluation(GINWithJK, d, [3], [64], max_num_epochs=200,
                                       batch_size=64,
                                       start_lr=0.01,
                                       num_repetitions=num_reps, all_std=True)
        print(d + " " + "GINJK " + str(acc) + " " + str(s_1) + " " + str(s_2))
        results.append(d + " " + "GINJK " + str(acc) + " " + str(s_1) + " " + str(s_2))

    for r in results:
        print(r)