Example #1
0
"""
Settings                    : default -> for Kipf GCN settings, quick -> for running the whole thing fast (to check that everything works)
labels_percent_list         : determines how many labeled nodes will be used for training. Percent with respect to the training set, 100% means the whole training set
list adj                    : used to display stats on connection to known nodes of wrongly/correctly classified nodes.
maintain_label_balance_list : will (try) to keep the same ratio of classes in labeled training set
with_test_features_list     : Hides testing features by modifying the Adj matrix if set to False
models_list                 : Models to try. Subsample GCN strictly uses subsmaple nodes, GCN uses all the features

"""
if __name__ == "__main__":
    # Tensorflow settings
    flags = tf.app.flags

    FLAGS = flags.FLAGS
    settings = graph_settings()['default']
    set_tf_flags(settings['params'], flags, verbose=True)

    # Verbose settings
    SHOW_TEST_VAL_DATASET_STATS = False
    VERBOSE_TRAINING = False

    # Random seed
    seed = settings['seed']
    np.random.seed(seed)

    SAMPLING_TRIALS = 16  # How many time the same experiment will be repeated to get standard dev.
    # Load data. Features and labels.
    adj, features, y_train, y_val, y_test, initial_train_mask, val_mask, test_mask = load_data(
        FLAGS.dataset)
    # Some preprocessing
    features = preprocess_features(features)
Example #2
0
                    'incorrect_paths_to_known': incorrect_paths_to_known
                }
            }
            pk.dump(dict_output,
                    open(
                        os.path.join('results', fileinfo + 'w_test_features=' + str(WITH_TEST) + '_label_balance=' +
                                     str(MAINTAIN_LABEL_BALANCE) + '_results.p'), 'wb'))
            result.clear()


if __name__ == "__main__":
    # Settings
    flags = tf.app.flags
    FLAGS = flags.FLAGS
    settings = graph_settings()['default']
    set_tf_flags(settings['params'], flags)
    # Verbose settings
    SHOW_TEST_VAL_DATASET_STATS = False
    VERBOSE_TRAINING = False

    # Random seed
    seed = settings['seed']
    np.random.seed(seed)

    # Load data
    adj, features, y_train, y_val, y_test, initial_train_mask, val_mask, test_mask = load_data(FLAGS.dataset)
    # Some preprocessing
    features = preprocess_features(features)

    labels_percent_list = [0.1, 5, 10, 20, 40, 50, 75, 100]
    list_adj = get_adj_powers(adj.toarray())