PlanetAlign.algorithms.PARROT
- class PARROT(alpha: float = 0.5, rwr_restart_prob: float = 0.15, gamma: float = 0.75, lambda_p: float = 0.0005, lambda_e: float = 1e-05, lambda_n: float = 0.005, lambda_a: float = 0.0005, dtype: dtype = torch.float32)[source]
Bases:
BaseModelOT-based method PARROT for pairwise network alignment. PARROT is proposed by the paper “PARROT: Position-Aware Regularized Optimal Transport for Network Alignment.” in WWW 2023.
- Parameters:
alpha (float, optional) – The hyparameter balancing the costs computed by RWR and node attributes. Default is 0.5.
rwr_restart_prob (float, optional) – The restart probability for the random walk with restart (RWR). Default is 0.15.
gamma (float, optional) – The discount factor of RWR. Default is 0.75.
lambda_p (float, optional) – The weight of the proximal point term. Default is 5e-4.
lambda_e (float, optional) – The weight of the edge consistency term. Default is 1e-5.
lambda_n (float, optional) – The weight of the neighborhood consistency term. Default is 5e-3.
lambda_a (float, optional) – The weight of the alignment preference term. Default is 5e-4.
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, max_iters_sep_rwr: int = 100, max_iters_prod_rwr: int = 50, inner_iters: int = 5, outer_iters: int = 10, save_log: bool = True, verbose: bool = True)[source]
- Parameters:
dataset (Dataset) – The dataset containing graphs to be aligned and the training/test data.
gid1 (int) – The graph id of the first graph to be aligned.
gid2 (int) – The graph id of the second graph to be aligned.
use_attr (bool, optional) – Flag for using attributes. Default is True.
max_iters_sep_rwr (int, optional) – Maximum number of iterations for separate RWR. Default is 100.
max_iters_prod_rwr (int, optional) – Maximum number of iterations for product RWR. Default is 50.
inner_iters (int, optional) – Number of inner iterations for the proximal point optimization. Default is 5.
outer_iters (int, optional) – Number of outer iterations for the proximal point optimization. Default is 10.
save_log (bool, optional) – Flag for saving the logs. Default is True.
verbose (bool, optional) – Flag for printing the logs. Default is True.