PlanetAlign.algorithms.CrossMNA

class CrossMNA(batch_size: int = 4096, neg_samples: int = 1, node_emb_dims: int = 200, graph_emb_dims: int = 100, lr: float = 0.02, dtype: dtype = torch.float32)[source]

Bases: BaseModel

Embedding-based method CrossMNA for plain multi-network alignment. CrossMNA is proposed by the paper: “Cross-Network Embedding for Multi-Network Alignment.” in WWW 2019.

Parameters:
  • batch_size (int, optional) – Batch size for training. Default is 4096.

  • neg_samples (int, optional) – Number of negative samples per positive sample. Default is 1.

  • node_emb_dims (int, optional) – Dimensions of output node embeddings. Default is 200.

  • graph_emb_dims (int, optional) – Dimensions of output graph embeddings. Default is 100.

  • lr (float, optional) – Learning rate for the optimizer. Default is 0.02.

  • 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, gids: List[int] | Tuple[int, ...], use_attr: bool = False, total_epochs: int = 400, save_log: bool = True, verbose: bool = True)[source]
Parameters:
  • dataset (Dataset) – The dataset containing the graphs to be aligned and the training/test data.

  • gids (list or tuple) – The indices of the graphs in the dataset to be aligned.

  • use_attr (bool, optional) – Whether to use node attributes for alignment. Default is True.

  • total_epochs (int, optional) – Total number of training epochs. Default is 400.

  • save_log (bool, optional) – Whether to save the training log. Default is True.

  • verbose (bool, optional) – Whether to print training progress. Default is True.