egc.module.pretrain.communitygan package

Submodules

egc.module.pretrain.communitygan.agm_pretrain module

AGM Pretrain C++ Pretrain source code is copied from: https://github.com/SamJia/CommunityGAN

egc.module.pretrain.communitygan.agm_pretrain.agm_pretrain(edges: Tuple, n_clusters: int, n_threads: int = 20, n_epochs: int = 200, rest_args: Dict | None = None, dataset_name: str = 'Cora', overlapping: bool = True) ndarray[source]

AGM Pretrain

Parameters:
  • edges (Tuple) – edges.

  • n_clusters (int) – num of clusters.

  • n_threads (int, optional) – num of threads. Defaults to 20.

  • n_epochs (int, optional) – num of pretrain epochs. Defaults to 200.

  • rest_args (Dict, optional) – other args for agm pretrain. Defaults to {}.

  • dataset_name (str, optional) – dataset name. Defaults to ‘Cora’.

  • overlapping (bool, optional) – whether dataset is overlapping. Defaults to True.

Returns:

node embedding pretrained by AGM

Return type:

np.ndarray

egc.module.pretrain.communitygan.kmeans_pretrain module

Embdding Pretrain using Kmeans

egc.module.pretrain.communitygan.kmeans_pretrain.kmeans_pretrain(features_lil: Tensor, adj_csr: Tensor, n_clusters: int, label: ndarray) csr_matrix[source]

kmeans pretraining

Parameters:
  • features_lil (torch.Tensor) – features.

  • adj_csr (torch.Tensor) – adj.

  • n_clusters (int) – num of clusters.

  • label (np.ndarray) – labels.

Returns:

one hot cluster embbeding for nodes.

Return type:

sp.csr_matrix

Module contents

Pretrain for Community GAN