Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(FlickrDataset, self).__init__(path, filename, url)
@register_dataset("wikipedia")
class WikipediaDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "wikipedia", "POS"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(WikipediaDataset, self).__init__(path, filename, url)
@register_dataset("ppi")
class PPIDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "ppi", "Homo_sapiens"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(PPIDataset, self).__init__(path, filename, url)
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(BlogcatalogDataset, self).__init__(path, filename, url)
@register_dataset("flickr")
class FlickrDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "flickr", "flickr"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(FlickrDataset, self).__init__(path, filename, url)
@register_dataset("wikipedia")
class WikipediaDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "wikipedia", "POS"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(WikipediaDataset, self).__init__(path, filename, url)
@register_dataset("ppi")
class PPIDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "ppi", "Homo_sapiens"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(PPIDataset, self).__init__(path, filename, url)
data = Data(edge_index=edge_index, edge_attr=edge_attr, x=None, y=y)
torch.save(data, self.processed_paths[0])
@register_dataset("blogcatalog")
class BlogcatalogDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "blogcatalog", "blogcatalog"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(BlogcatalogDataset, self).__init__(path, filename, url)
@register_dataset("flickr")
class FlickrDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "flickr", "flickr"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(FlickrDataset, self).__init__(path, filename, url)
@register_dataset("wikipedia")
class WikipediaDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "wikipedia", "POS"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(WikipediaDataset, self).__init__(path, filename, url)
def __init__(self, root, name, url):
self.name = name
self.url = url
super(MatlabMatrix, self).__init__(root)
self.data = torch.load(self.processed_paths[0])
def __init__(self, root, name, url):
self.name = name
self.url = url
super(MatlabMatrix, self).__init__(root)
with open(self.processed_paths[0], 'rb') as input:
self.data = pickle.load(input)
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(FlickrDataset, self).__init__(path, filename, url)
@register_dataset("wikipedia")
class WikipediaDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "wikipedia", "POS"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(WikipediaDataset, self).__init__(path, filename, url)
@register_dataset("ppi")
class PPIDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "ppi", "Homo_sapiens"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(PPIDataset, self).__init__(path, filename, url)
smat = scipy.io.loadmat(path)
adj_matrix, group = smat["network"], smat["group"]
y = torch.from_numpy(group.todense()).to(torch.float)
row_ind, col_ind = adj_matrix.nonzero()
edge_index = torch.stack([torch.tensor(row_ind), torch.tensor(col_ind)], dim=0)
edge_attr = torch.tensor(adj_matrix[row_ind, col_ind])
data = Data(edge_index=edge_index, edge_attr=edge_attr, x=None, y=y)
torch.save(data, self.processed_paths[0])
@register_dataset("blogcatalog")
class BlogcatalogDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "blogcatalog", "blogcatalog"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(BlogcatalogDataset, self).__init__(path, filename, url)
@register_dataset("flickr")
class FlickrDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "flickr", "flickr"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(FlickrDataset, self).__init__(path, filename, url)
with open(self.processed_paths[0], 'wb') as output:
pickle.dump(data, output, pickle.HIGHEST_PROTOCOL)
@register_dataset("blogcatalog")
class BlogcatalogDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "blogcatalog", "blogcatalog"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(BlogcatalogDataset, self).__init__(path, filename, url)
@register_dataset("flickr")
class FlickrDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "flickr", "flickr"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(FlickrDataset, self).__init__(path, filename, url)
@register_dataset("wikipedia")
class WikipediaDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "wikipedia", "POS"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(WikipediaDataset, self).__init__(path, filename, url)
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(BlogcatalogDataset, self).__init__(path, filename, url)
@register_dataset("flickr")
class FlickrDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "flickr", "flickr"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(FlickrDataset, self).__init__(path, filename, url)
@register_dataset("wikipedia")
class WikipediaDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "wikipedia", "POS"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(WikipediaDataset, self).__init__(path, filename, url)
@register_dataset("ppi")
class PPIDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "ppi", "Homo_sapiens"
url = "http://snap.stanford.edu/node2vec/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(PPIDataset, self).__init__(path, filename, url)
adj_matrix, group = smat["network"], smat["group"]
y = tf.convert_to_tensor(group.todense(), np.float32)
row_ind, col_ind = adj_matrix.nonzero()
edge_index = tf.stack([tf.convert_to_tensor(row_ind), tf.convert_to_tensor(col_ind)])
edge_attr = tf.convert_to_tensor(adj_matrix[row_ind, col_ind])
data = Data(edge_index=edge_index, edge_attr=edge_attr, x=None, y=y)
with open(self.processed_paths[0], 'wb') as output:
pickle.dump(data, output, pickle.HIGHEST_PROTOCOL)
@register_dataset("blogcatalog")
class BlogcatalogDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "blogcatalog", "blogcatalog"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(BlogcatalogDataset, self).__init__(path, filename, url)
@register_dataset("flickr")
class FlickrDataset(MatlabMatrix):
def __init__(self):
dataset, filename = "flickr", "flickr"
url = "http://leitang.net/code/social-dimension/data/"
path = osp.join(osp.dirname(osp.realpath(__file__)), "../..", "data", dataset)
super(FlickrDataset, self).__init__(path, filename, url)