src.algorithms.deep package

Subpackages

Submodules

src.algorithms.deep.ARGA module

class src.algorithms.deep.ARGA.ARGA(graph: Graph, num_clusters: int, lr: float = 0.001, latent_dim: int = 16, epochs: int = 100, k: int = 3, use_pretrained: bool = True, save_model: bool = False)[source]

Bases: DeepAlgorithm

Adversarially Regularized Graph Autoencoder algorithm

Parameters:
  • graph (Graph) – Graph object

  • lr (float) – Learning rate

  • latent_dim (int) – Latent dimension

  • epochs (int) – Number of epochs to run

  • k (int) – Number of iterations to train the discriminator

  • use_pretrained (bool) – Boolean flag to indicate if pretrained model should be used

  • save_model (bool) – Boolean flag to indicate if the model should be saved after training

src.algorithms.deep.DeepAlgorithm module

class src.algorithms.deep.DeepAlgorithm.DeepAlgorithm(graph: Graph, num_clusters: int, lr: float = 0.001, latent_dim: int = 16, epochs: int = 100, use_pretrained: bool = True, save_model: bool = False)[source]

Bases: Algorithm

Base class for Deep Graph Clustering algorithms

Parameters:
  • graph (Graph) – Graph object

  • lr (float) – Learning rate

  • latent_dim (int) – Latent dimension

  • epochs (int) – Number of epochs to run

  • use_pretrained (bool) – Boolean flag to indicate if pretrained model should be used

  • save_model (bool) – Boolean flag to indicate if the model should be saved after training

run() None[source]

Trains the model and runs k-means clustering on the node embeddings.

src.algorithms.deep.GAE module

class src.algorithms.deep.GAE.GAE(graph: Graph, num_clusters: int, lr: float = 0.001, latent_dim: int = 16, epochs: int = 100, use_pretrained: bool = True, save_model: bool = False)[source]

Bases: DeepAlgorithm

Graph Autoencoder algorithm

Parameters:
  • graph (Graph) – Graph object

  • lr (float) – Learning rate

  • latent_dim (int) – Latent dimension

  • epochs (int) – Number of epochs to run

  • use_pretrained (bool) – Boolean flag to indicate if pretrained model should be used

  • save_model (bool) – Boolean flag to indicate if the model should be saved after training

src.algorithms.deep.MVGRL module

class src.algorithms.deep.MVGRL.MVGRL(graph: Graph, num_clusters: int, lr: float = 0.001, latent_dim: int = 16, epochs: int = 100, use_pretrained: bool = True, save_model: bool = False)[source]

Bases: DeepAlgorithm

Multi-View Graph Representation Learning algorithm

Parameters:
  • graph (Graph) – Graph object

  • lr (float) – Learning rate

  • latent_dim (int) – Latent dimension

  • epochs (int) – Number of epochs to run

  • use_pretrained (bool) – Boolean flag to indicate if pretrained model should be used

  • save_model (bool) – Boolean flag to indicate if the model should be saved after training

src.algorithms.deep.utils module

src.algorithms.deep.utils.compute_diffusion_matrix(adj: ndarray, alpha: float = 0.2) ndarray[source]

Computes the diffusion matrix for MVGRL using PageRank

Parameters:
  • adj (np.ndarray) – Adjacency matrix

  • alpha (float) – Teleport probability

Returns:

Diffusion matrix

Return type:

np.ndarray

src.algorithms.deep.utils.get_clusters(z: ndarray, n_clusters: int, method: str = 'kmeans') ndarray[source]

Cluster the encoded data using the specified method

Parameters:
  • z (np.ndarray) – Latent space

  • n_clusters (int) – Number of clusters

  • method (str) – Clustering method

Returns:

Cluster labels

Return type:

np.ndarray

Module contents