b2002a8ef80ecbecee09fd61b910c987648455c7,torch_geometric/datasets/karate.py,KarateClub,__init__,#KarateClub#Any#,20
Before Change
data.num_nodes = edge_index.max().item() + 1
data.x = torch.eye(data.num_nodes, dtype=torch.float)
y = [0 if G.nodes[i]["club"] == "Mr. Hi" else 1 for i in G.nodes]
data.y = torch.tensor(y)
self.data, self.slices = self.collate([data])
def _download(self):
return
After Change
// Compute communities.
partition = community_louvain.best_partition(G)
y = torch.tensor([partition[i] for i in range(G.number_of_nodes())])
// Select a single training node for each community
// (we just use the first one).
train_mask = torch.zeros(y.size(0), dtype=torch.bool)
for i in range(int(y.max()) + 1):
train_mask[(y == i).nonzero(as_tuple=False)[0]] = True
data = Data(x=x, edge_index=edge_index, y=y, train_mask=train_mask)
self.data, self.slices = self.collate([data])
In pattern: SUPERPATTERN
Frequency: 5
Non-data size: 6
Instances
Project Name: rusty1s/pytorch_geometric
Commit Name: b2002a8ef80ecbecee09fd61b910c987648455c7
Time: 2020-08-26
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/datasets/karate.py
Class Name: KarateClub
Method Name: __init__
Project Name: tensorly/tensorly
Commit Name: daa2c7ea2bf2c203ddef038f2eaf9d70bc07c7d4
Time: 2020-01-01
Author: roald.marie@gmail.com
File Name: tensorly/tests/test_parafac2_tensor.py
Class Name:
Method Name: test_validate_parafac2_tensor
Project Name: kengz/SLM-Lab
Commit Name: 4342569bc5e505a9d1a36b3b4a3d1269d3a2bcab
Time: 2018-09-21
Author: kengzwl@gmail.com
File Name: slm_lab/agent/algorithm/hydra_dqn.py
Class Name: MultitaskDQN
Method Name: space_act
Project Name: cornellius-gp/gpytorch
Commit Name: 91b0d220c8e816766fd4565e1d2f5115d3afbefe
Time: 2018-10-12
Author: gpleiss@gmail.com
File Name: test/functions/test_inv_quad_log_det.py
Class Name: TestInvQuadLogDetBatch
Method Name: test_log_det_only
Project Name: Shawn1993/cnn-text-classification-pytorch
Commit Name: 5c177f3d9a29fc7737bd4734315820d1c11c7e87
Time: 2019-07-17
Author: rriva002@ucr.edu
File Name: cnn_text_classification.py
Class Name: CNNClassifier
Method Name: predict