b2002a8ef80ecbecee09fd61b910c987648455c7,torch_geometric/datasets/karate.py,KarateClub,__init__,#KarateClub#Any#,20
Before Change
data = Data(edge_index=edge_index)
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])
After Change
edge_index = torch.stack([row, col], dim=0)
// 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: 4
Non-data size: 5
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: pytorch/tutorials
Commit Name: a61996ae5406ddfee4ac65ab647ebe858fc16260
Time: 2018-09-17
Author: matthewinkawhich@gmail.com
File Name: beginner_source/chatbot_tutorial.py
Class Name:
Method Name: evaluate
Project Name: facebookresearch/Horizon
Commit Name: 16ba3819bbfde4e49711b51ccd357cb92d1de386
Time: 2020-05-21
Author: kittipat@fb.com
File Name: reagent/gym/preprocessors/default_preprocessors.py
Class Name: RecsimObsPreprocessor
Method Name: __call__
Project Name: pytorch/tutorials
Commit Name: 69d978ed497856d05730c05564597e604713f5c4
Time: 2018-09-16
Author: minkawhich@fb.com
File Name: beginner_source/chatbot_tutorial.py
Class Name:
Method Name: evaluate