def main(args): """ Characteristic function embedding wrapper. :param args: Arguments object parsed up. """ if args.model_type == "FEATHER": print("\nFitting a node embedding.\n") graph = load_graph(args.graph_input) features = load_features(args.feature_input) model = FEATHER() model.fit(graph, features) elif args.model_type == "FEATHER-G": print("\nFitting a graph level embedding.\n") graphs = load_graphs(args.graphs_input) model = FEATHERG() model.fit(graphs) else: quit() X = model.get_embedding() save_embedding(X, args.output)
# exit() node_count_avg_ref, node_count_avg_pred = [], [] edge_count_avg_ref, edge_count_avg_pred = [], [] degree_mmd, clustering_mmd, orbit_mmd, nspdk_mmd = [], [], [], [] node_label_mmd, edge_label_mmd, node_label_and_degree = [], [], [] print(len(graphs_test_indices)) for i in range(0, len(graphs_pred_indices), eval_args.metric_eval_batch_size): batch_size = min(eval_args.metric_eval_batch_size, len(graphs_pred_indices) - i) graphs_ref_indices = random.sample(graphs_test_indices, batch_size) graphs_ref = load_graphs( train_args.current_dataset_path, graphs_ref_indices) graphs_ref = [patch_graph(g) for g in graphs_ref] graphs_pred = load_graphs( eval_args.current_graphs_save_path, graphs_pred_indices[i: i + batch_size]) graphs_pred = [patch_graph(g) for g in graphs_pred] node_count_avg_ref.append(mean([len(G.nodes()) for G in graphs_ref])) node_count_avg_pred.append(mean([len(G.nodes()) for G in graphs_pred])) edge_count_avg_ref.append(mean([len(G.edges()) for G in graphs_ref])) edge_count_avg_pred.append(mean([len(G.edges()) for G in graphs_pred])) degree_mmd.append(metrics.stats.degree_stats(graphs_ref, graphs_pred))
)) print(LINE_BREAK) if __name__ == "__main__": node_count_avg_ref, node_count_avg_pred = [], [] edge_count_avg_ref, edge_count_avg_pred = [], [] degree_mmd, clustering_mmd, orbit_mmd, nspdk_mmd = [], [], [], [] node_label_mmd, edge_label_mmd, node_label_and_degree = [], [], [] graphs_pred_indices = range(2000) for i in range(0, len(graphs_pred_indices), 32): batch_size = min(32, len(graphs_pred_indices) - i) print(i) graphs_ref = load_graphs('dat_graphs/lung/', graphs_pred_indices[i:i+batch_size]) graphs_ref = [patch_graph(g) for g in graphs_ref] graphs_pred = load_graphs('dat_graphs/yeast/', graphs_pred_indices[i:i+batch_size]) graphs_pred = [patch_graph(g) for g in graphs_pred] node_count_avg_ref.append(mean([len(G.nodes()) for G in graphs_ref])) node_count_avg_pred.append(mean([len(G.nodes()) for G in graphs_pred])) edge_count_avg_ref.append(mean([len(G.edges()) for G in graphs_ref])) edge_count_avg_pred.append(mean([len(G.edges()) for G in graphs_pred])) # print("Edge count done") degree_mmd.append(metrics.stats.degree_stats(graphs_ref, graphs_pred)) # print("Degree MMD done") clustering_mmd.append( metrics.stats.clustering_stats(graphs_ref, graphs_pred))