PlanetAlign.algorithms.BRIGHT
- class BRIGHT(restart_prob: float = 0.15, out_dim: int = 128, neg_sample_size: int = 500, margin: float = 10, lr: float = 0.001, dtype: dtype = torch.float32)[source]
Bases:
BaseModelEmbedding-based method BRIGHT for pairwise network alignment. BRIGHT is proposed by the paper “BRIGHT: A Bridging Algorithm for Network Alignment.” in WWW 2021.
- Parameters:
restart_prob (float, optional) – The restart probability for random walk with restart. Default is 0.15.
out_dim (int, optional) – The dimension of the output embeddings. Default is 128.
neg_sample_size (int, optional) – The number of negative samples per anchor link. Default is 500.
margin (float, optional) – The margin for the ranking loss. Default is 10.
lr (float, optional) – The learning rate for the optimizer. Default is 1e-3.
dtype (torch.dtype, optional) – Data type of the tensors, choose from torch.float32 or torch.float64. Default is torch.float32.
- test(dataset: Dataset, gids: List[int] | Tuple[int, ...], metrics: tuple[str] | list[str] = None)
- Parameters:
dataset (Dataset) – The dataset containing the graphs to be aligned and the training/test data.
gids (list[int] or tuple[int, ...]) – The indices of the graphs in the dataset to be aligned.
metrics (tuple[str] or list[str], optional) – The metrics to be computed after alignment. Default is None, which computes Hits@K (K=1, 10, 30, 50) and MRR metrics.
- train(dataset: Dataset, gid1: int, gid2: int, use_attr: bool = True, total_epochs: int = 250, save_log: bool = True, verbose: bool = True)[source]
Parameters dataset : Dataset
The dataset containing the graphs to be aligned and the training/test data.
- gid1int
The index of the first graph in the dataset to be aligned.
- gid2int
The index of the second graph in the dataset to be aligned.
- use_attrbool, optional
Whether to use node and edge attributes for alignment. Default is True.
- save_log: bool, optional
Whether to save the training log. Default is True.
- verbosebool, optional
Whether to print the progress during training. Default is True.