'argparse' imported but unused:
1 import argparse'copy' imported but unused:
6 import copy'json' imported but unused:
7 import json'torch_geometric.data.DataLoader' imported but unused:
12 from torch_geometric.data import DataLoader'torch_geometric.data.Data' imported but unused:
13 from torch_geometric.data import Data'.utils_data_prep.separate_data' imported but unused:
16 from .utils_data_prep import separate_data, separate_data_given_split'.utils_data_prep.separate_data_given_split' imported but unused:
16 from .utils_data_prep import separate_data, separate_data_given_split'ogb.graphproppred.PygGraphPropPredDataset' imported but unused:
17 from ogb.graphproppred import Evaluator, PygGraphPropPredDatasetLocal variable 'evaluator' is assigned to but never used:
255 evaluator = Evaluator('ogbg-ppa')Local variable 'device' is assigned to but never used:
276 device = torch.device("cuda:" + str(self.device_idx) if torch.cuda.is_available() else "cpu")Line too long (107 > 79 characters):
19 from .utils_graph_processing import subgraph_isomorphism_edge_counts, subgraph_isomorphism_vertex_counts, \Line too long (83 > 79 characters):
20 induced_edge_automorphism_orbits, edge_automorphism_orbits, automorphism_orbitsLine too long (83 > 79 characters):
35 # set multiprocessing to true in order to do the precomputation in parallelLine too long (88 > 79 characters):
59 # parser.add_argument('--input_vn_encoder', type=str, default='one_hot_encoder')Line too long (147 > 79 characters):
65 # - edge_automorphism: induced edge automorphism or line graph edge automorphism (slightly larger group than the induced edge automorphism)Line too long (93 > 79 characters):
82 # binning and minmax encoding parameters. NB: not used in our experimental evaluationLine too long (84 > 79 characters):
89 # parser.add_argument('--id_embedding', type=str, default='one_hot_encoder')Line too long (88 > 79 characters):
91 # parser.add_argument('--degree_embedding', type=str, default='one_hot_encoder')Line too long (81 > 79 characters):
92 # parser.add_argument('--d_out_degree_embedding', type=int, default=None)Line too long (107 > 79 characters):
105 # - jk_mlp: set it to True to use an MLP after each jk layer, otherwise a linear layer will be usedLine too long (87 > 79 characters):
107 # parser.add_argument('--random_features', type=parse.str2bool, default=False)Line too long (80 > 79 characters):
119 # parser.add_argument('--train_eps', type=parse.str2bool, default=False)Line too long (93 > 79 characters):
123 # parser.add_argument('--final_projection', type=parse.str2list2bool, default=[True])Line too long (88 > 79 characters):
131 # general (general formulation with MLPs - eq 3,4 of the main paper)Line too long (92 > 79 characters):
132 # ogb (extends the architecture used in ogb with structural identifiers)Line too long (92 > 79 characters):
133 # - inject*: passes the relevant variable to deeper layers akin to skip connections.Line too long (96 > 79 characters):
134 # If set to False, then the variable is used only as input to the first layerLine too long (83 > 79 characters):
144 # args, extract_ids_fn, count_fn, automorphism_fn = process_arguments(args)Line too long (94 > 79 characters):
148 ###### choose the function that computes the automorphism group and the orbits #######Line too long (120 > 79 characters):
150 self.automorphism_fn = induced_edge_automorphism_orbits if self.id_scope == 'local' else automorphism_orbitsLine too long (112 > 79 characters):
152 self.automorphism_fn = edge_automorphism_orbits if self.id_scope == 'local' else automorphism_orbitsLine too long (82 > 79 characters):
156 ###### choose the function that computes the subgraph isomorphisms #######Line too long (124 > 79 characters):
157 self.count_fn = subgraph_isomorphism_edge_counts if self.id_scope == 'local' else subgraph_isomorphism_vertex_countsLine too long (80 > 79 characters):
160 ###### except for 'all_simple_graphs' where they need to be precomputed,Line too long (101 > 79 characters):
171 self.custom_edge_list = get_custom_edge_list(list(range(k_min, k_max + 1)), self.id_type)Line too long (104 > 79 characters):
179 # self.custom_edge_list = get_custom_edge_list(self.k, self.id_type.replace('_chosen_k',''))Line too long (111 > 79 characters):
185 # args['custom_edge_list'] = get_custom_edge_list(list(range(k_min, k_max + 1)), filename=filename)Line too long (91 > 79 characters):
189 # args['custom_edge_list'] = get_custom_edge_list(args['k'], filename=filename)Line too long (95 > 79 characters):
197 # assert args['custom_edge_list'] is not None, "Custom edge list must be provided."Line too long (110 > 79 characters):
200 # raise NotImplementedError("Identifiers {} are not currently supported.".format(args['id_type']))Line too long (111 > 79 characters):
202 # define if degree is going to be used as a feature and when (for each layer or only at initialization)Line too long (85 > 79 characters):
204 self.degree_as_tag = [self.degree_as_tag for _ in range(self.num_layers)]Line too long (99 > 79 characters):
206 self.degree_as_tag = [self.degree_as_tag] + [False for _ in range(self.num_layers - 1)]Line too long (99 > 79 characters):
208 # define if existing features are going to be retained when the degree is used as a featureLine too long (98 > 79 characters):
209 self.retain_features = [self.retain_features] + [True for _ in range(self.num_layers - 1)]Line too long (117 > 79 characters):
211 # replicate d_out dimensions if the rest are not defined (msg function, mlp hidden dimension, encoders, etc.)Line too long (80 > 79 characters):
216 # args['d_msg'] = [args['d_out'] for _ in range(args['num_layers'])]Line too long (80 > 79 characters):
218 # args['d_msg'] = [args['d_msg'] for _ in range(args['num_layers'])]Line too long (111 > 79 characters):
220 # args['d_h'] = [[args['d_out']] * (args['num_mlp_layers'] - 1) for _ in range(args['num_layers'])]Line too long (109 > 79 characters):
222 # args['d_h'] = [[args['d_h']] * (args['num_mlp_layers'] - 1) for _ in range(args['num_layers'])]Line too long (93 > 79 characters):
224 # args['d_out_edge_encoder'] = [args['d_out'] for _ in range(args['num_layers'])]Line too long (106 > 79 characters):
226 # args['d_out_edge_encoder'] = [args['d_out_edge_encoder'] for _ in range(args['num_layers'])]Line too long (84 > 79 characters):
243 # args['train_eps'] = [args['train_eps'] for _ in range(args['num_layers'])]Line too long (114 > 79 characters):
246 # args['final_projection'] = [args['final_projection'][0] for _ in range(args['num_layers'])] + [True]Line too long (127 > 79 characters):
249 # args['dropout_features'] = [args['dropout_features'] for _ in range(args['num_layers'])] + [args['dropout_features']]Line too long (101 > 79 characters):
276 device = torch.device("cuda:" + str(self.device_idx) if torch.cuda.is_available() else "cpu")Line too long (111 > 79 characters):
278 ## ----------------------------------- datasets: prepare and preprocess (count or load subgraph counts)Line too long (83 > 79 characters):
285 graphs_ptg, num_classes, orbit_partition_sizes = prepare_dataset(root_path,Line too long (86 > 79 characters):
286 self.dataset,Line too long (91 > 79 characters):
287 self.dataset_name,Line too long (87 > 79 characters):
288 self.id_scope,Line too long (86 > 79 characters):
289 self.id_type,Line too long (80 > 79 characters):
290 self.k,Line too long (92 > 79 characters):
291 self.extract_id_fn,Line too long (87 > 79 characters):
292 self.count_fn,Line too long (94 > 79 characters):
293 self.automorphism_fn,Line too long (94 > 79 characters):
294 self.multiprocessing,Line too long (92 > 79 characters):
295 self.num_processes,Line too long (91 > 79 characters):
296 **subgraph_params)Line too long (91 > 79 characters):
315 d_in_node_encoder, d_in_edge_encoder = [d_in_node_encoder], [d_in_edge_encoder]Line too long (98 > 79 characters):
319 ## ----------------------------------- encode ids and degrees (and possibly edge features)Line too long (85 > 79 characters):
335 graphs_ptg, encoder_ids, d_id, encoder_degrees, d_degree = encode(graphs_ptg,Line too long (86 > 79 characters):
336 id_encoding,Line too long (90 > 79 characters):
337 degree_encoding,Line too long (96 > 79 characters):
338 **encoding_parameters)