BlogCatalog social network dataset. Splits: graph, label, train, test Train and test splits are used for link prediction purpose.
| 398 | |
| 399 | |
| 400 | class BlogCatalog(Dataset): |
| 401 | """ |
| 402 | BlogCatalog social network dataset. |
| 403 | |
| 404 | Splits: |
| 405 | graph, label, train, test |
| 406 | |
| 407 | Train and test splits are used for link prediction purpose. |
| 408 | """ |
| 409 | |
| 410 | def __init__(self): |
| 411 | super(BlogCatalog, self).__init__( |
| 412 | "blogcatalog", |
| 413 | urls={ |
| 414 | "graph": "https://www.dropbox.com/s/cf21ouuzd563cqx/BlogCatalog-dataset.zip?dl=1", |
| 415 | "label": "https://www.dropbox.com/s/cf21ouuzd563cqx/BlogCatalog-dataset.zip?dl=1", |
| 416 | "train": [], # depends on `graph` |
| 417 | "valid": [], # depends on `graph` |
| 418 | "test": [] # depends on `graph` |
| 419 | }, |
| 420 | members={ |
| 421 | "graph": "BlogCatalog-dataset/data/edges.csv", |
| 422 | "label": "BlogCatalog-dataset/data/group-edges.csv" |
| 423 | } |
| 424 | ) |
| 425 | |
| 426 | def graph_preprocess(self, raw_file, save_file): |
| 427 | self.csv2txt(raw_file, save_file) |
| 428 | |
| 429 | def label_preprocess(self, raw_file, save_file): |
| 430 | self.csv2txt(raw_file, save_file) |
| 431 | |
| 432 | def train_preprocess(self, train_file): |
| 433 | valid_file = train_file[:train_file.rfind("train.txt")] + "valid.txt" |
| 434 | test_file = train_file[:train_file.rfind("train.txt")] + "test.txt" |
| 435 | self.link_prediction_split(self.graph, [train_file, valid_file, test_file], portions=[100, 1, 1]) |
| 436 | |
| 437 | def valid_preprocess(self, valid_file): |
| 438 | train_file = valid_file[:valid_file.rfind("valid.txt")] + "train.txt" |
| 439 | test_file = valid_file[:valid_file.rfind("valid.txt")] + "test.txt" |
| 440 | self.link_prediction_split(self.graph, [train_file, valid_file, test_file], portions=[100, 1, 1]) |
| 441 | |
| 442 | def test_preprocess(self, test_file): |
| 443 | train_file = test_file[:test_file.rfind("test.txt")] + "train.txt" |
| 444 | valid_file = test_file[:test_file.rfind("test.txt")] + "valid.txt" |
| 445 | self.link_prediction_split(self.graph, [train_file, valid_file, test_file], portions=[100, 1, 1]) |
| 446 | |
| 447 | |
| 448 | class Youtube(Dataset): |