PlanetAlign.algorithms.IsoRank
- class IsoRank(alpha: float = 0.4, dtype: dtype = torch.float32)[source]
Bases:
BaseModelConsistency-based method IsoRank for pairwise plain network alignment. IsoRank is proposed by the paper “Global alignment of multiple protein interaction networks with application to functional orthology detection” in PNAS 2008.
- Parameters:
alpha (float, optional) – The decay factor for the optimization. Default is 0.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 = False, total_epochs: int = 100, tol: float = 1e-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. Must be False for IsoRank. Default is False.
total_epochs (int, optional) – Maximum number of training epochs. Default is 100.
tol (float, optional) – Tolerance for convergence. Default is 1e-10.
save_log (bool, optional) – Flag for saving the logs. Default is True.
verbose (bool, optional) – Flag for printing the logs. Default is True.
- Returns:
The final similarity matrix S.
- Return type:
torch.Tensor