def process(self): data_list = [] indices_train = [] indices_val = [] indices_test = [] infile = open("test_al_10.index", "r") for line in infile: indices_test = line.split(",") indices_test = [int(i) for i in indices_test] infile = open("val_al_10.index", "r") for line in infile: indices_val = line.split(",") indices_val = [int(i) for i in indices_val] infile = open("train_al_10.index", "r") for line in infile: indices_train = line.split(",") indices_train = [int(i) for i in indices_train] targets = dp.get_dataset("alchemy_full", multigregression=True) tmp_1 = targets[indices_train].tolist() tmp_2 = targets[indices_val].tolist() tmp_3 = targets[indices_test].tolist() targets = tmp_1 targets.extend(tmp_2) targets.extend(tmp_3) node_labels = pre.get_all_node_labels_allchem(True, True, indices_train, indices_val, indices_test) matrices = pre.get_all_matrices_wl("alchemy_full", indices_train) matrices.extend(pre.get_all_matrices_wl("alchemy_full", indices_val)) matrices.extend(pre.get_all_matrices_wl("alchemy_full", indices_test)) for i, m in enumerate(matrices): edge_index_1 = torch.tensor(matrices[i][0]).t().contiguous() edge_index_2 = torch.tensor(matrices[i][1]).t().contiguous() data = Data() data.edge_index_1 = edge_index_1 data.edge_index_2 = edge_index_2 one_hot = np.eye(83)[node_labels[i]] data.x = torch.from_numpy(one_hot).to(torch.float) data.y = data.y = torch.from_numpy(np.array([targets[i] ])).to(torch.float) data_list.append(data) data, slices = self.collate(data_list) torch.save((data, slices), self.processed_paths[0])
def process(self): data_list = [] indices_train = [] indices_val = [] indices_test = [] infile = open("test.index.txt", "r") for line in infile: indices_test = line.split(",") indices_test = [int(i) for i in indices_test] infile = open("val.index.txt", "r") for line in infile: indices_val = line.split(",") indices_val = [int(i) for i in indices_val] infile = open("train.index.txt", "r") for line in infile: indices_train = line.split(",") indices_train = [int(i) for i in indices_train] dp.get_dataset("ZINC_train", regression=True) dp.get_dataset("ZINC_test", regression=True) dp.get_dataset("ZINC_val", regression=True) node_labels = pre.get_all_node_labels_ZINC(True, True, indices_train, indices_val, indices_test) targets = pre.read_targets("ZINC_train", indices_train) targets.extend(pre.read_targets("ZINC_val", indices_val)) targets.extend(pre.read_targets("ZINC_test", indices_test)) matrices = pre.get_all_matrices_wl("ZINC_train", indices_train) matrices.extend(pre.get_all_matrices_wl("ZINC_val", indices_val)) matrices.extend(pre.get_all_matrices_wl("ZINC_test", indices_test)) for i, m in enumerate(matrices): edge_index_1 = torch.tensor(matrices[i][0]).t().contiguous() edge_index_2 = torch.tensor(matrices[i][1]).t().contiguous() data = Data() data.edge_index_1 = edge_index_1 data.edge_index_2 = edge_index_2 one_hot = np.eye(445)[node_labels[i]] data.x = torch.from_numpy(one_hot).to(torch.float) data.y = data.y = torch.from_numpy(np.array([targets[i] ])).to(torch.float) data_list.append(data) data, slices = self.collate(data_list) torch.save((data, slices), self.processed_paths[0])
def process(self): data_list = [] dp.get_dataset("ZINC_test", regression=True) # TODO Change this node_labels = pre.get_all_node_labels("ZINC_full", True, True) targets = pre.read_targets("ZINC_test", list(range(0, 5000))) node_labels_1 = node_labels[220011:225011] matrices = pre.get_all_matrices_wl("ZINC_test", list(range(0, 5000))) targets_1 = targets for i, m in enumerate(matrices): edge_index_1 = torch.tensor(matrices[i][0]).t().contiguous() edge_index_2 = torch.tensor(matrices[i][1]).t().contiguous() data = Data() data.edge_index_1 = edge_index_1 data.edge_index_2 = edge_index_2 # one_hot = np.eye(492)[node_labels[i]] data.x = torch.from_numpy(np.array(node_labels_1[i])).to( torch.float) data.y = data.y = torch.from_numpy(np.array([targets_1[i] ])).to(torch.float) data_list.append(data) data, slices = self.collate(data_list) torch.save((data, slices), self.processed_paths[0])
def process(self): data_list = [] indices_val = list(range(225011, 249456)) dp.get_dataset("ZINC_val", regression=True) node_labels = pre.get_all_node_labels("ZINC_full", True, True) targets = pre.read_targets("ZINC_val", list(range(0, 24445))) node_labels_1 = node_labels[225011:249456] matrices = pre.get_all_matrices_wl("ZINC_val", list(range(0, 24445))) targets_1 = targets for i, m in enumerate(matrices): edge_index_1 = torch.tensor(matrices[i][0]).t().contiguous() edge_index_2 = torch.tensor(matrices[i][1]).t().contiguous() data = Data() data.edge_index_1 = edge_index_1 data.edge_index_2 = edge_index_2 data.x = torch.from_numpy(np.array(node_labels_1[i])).to( torch.float) data.y = data.y = torch.from_numpy(np.array([targets_1[i] ])).to(torch.float) data_list.append(data) data, slices = self.collate(data_list) torch.save((data, slices), self.processed_paths[0])
def process(self): data_list = [] indices_train = list(range(0, 220011)) indices_val = list(range(0, 24445)) indices_test = list(range(0, 5000)) dp.get_dataset("ZINC_train", regression=True) dp.get_dataset("ZINC_test", regression=True) dp.get_dataset("ZINC_val", regression=True) node_labels = pre.get_all_node_labels_ZINC(True, True, indices_train, indices_val, indices_test) targets = pre.read_targets("ZINC_train", indices_train) targets.extend(pre.read_targets("ZINC_val", indices_val)) targets.extend(pre.read_targets("ZINC_test", indices_test)) node_labels_1 = node_labels[150000:200000] matrices = pre.get_all_matrices_wl("ZINC_train", list(range(150000, 200000))) targets_1 = targets[150000:200000] for i, m in enumerate(matrices): edge_index_1 = torch.tensor(matrices[i][0]).t().contiguous() edge_index_2 = torch.tensor(matrices[i][1]).t().contiguous() data = Data() data.edge_index_1 = edge_index_1 data.edge_index_2 = edge_index_2 # one_hot = np.eye(492)[node_labels[i]] data.x = torch.from_numpy(np.array(node_labels_1[i])).to( torch.float) data.y = data.y = torch.from_numpy(np.array([targets_1[i] ])).to(torch.float) data_list.append(data) data, slices = self.collate(data_list) torch.save((data, slices), self.processed_paths[0])
def process(self): data_list = [] targets = dp.get_dataset("alchemy_full", multigregression=True).tolist() node_labels = pre.get_all_node_labels("alchemy_full", True, True) matrices = pre.get_all_matrices_wl("alchemy_full", list(range(202579))) for i, m in enumerate(matrices): edge_index_1 = torch.tensor(matrices[i][0]).t().contiguous() edge_index_2 = torch.tensor(matrices[i][1]).t().contiguous() data = Data() data.edge_index_1 = edge_index_1 data.edge_index_2 = edge_index_2 one_hot = np.eye(83)[node_labels[i]] data.x = torch.from_numpy(one_hot).to(torch.float) data.y = data.y = torch.from_numpy(np.array([targets[i] ])).to(torch.float) data_list.append(data) data, slices = self.collate(data_list) torch.save((data, slices), self.processed_paths[0])