karateclub

重叠社区检测

class EgoNetSplitter(resolution: float = 1.0, seed: int = 42, weight: Optional[str] = 'weight')[源代码]

一个实现来自KDD '17论文“Ego-Splitting Framework: from Non-Overlapping to Overlapping Clusters”的“Ego-Splitting”。该工具首先创建节点的自我网络。然后创建一个角色图,该图通过Louvain方法进行聚类。最终的重叠聚类成员资格存储为字典。

参数:
  • resolution (float) – Python Louvain 的分辨率参数。默认值为 1.0。
  • seed (int) – 随机种子值。默认值为 42。
  • weight (str) – 图中用作权重的键。默认为 'weight'。指定为 None 以强制使用未加权的图版本。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个Ego-Splitter聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_memberships() → Dict[int, int][源代码]

获取节点的集群成员资格。

Return types:
  • memberships (dictionary of lists) - Cluster memberships.
class DANMF(layers: List[int] = [32, 8], pre_iterations: int = 100, iterations: int = 100, seed: int = 42, lamb: float = 0.01)[源代码]

一个实现来自CIKM '18论文“用于社区检测的深度自编码器式非负矩阵分解”的“DANMF”。该过程使用伸缩式非负矩阵分解来学习节点上的聚类成员分布。该方法可以以重叠和非重叠的方式使用。

参数:
  • layers (list) – 自编码器层大小的整数列表。默认值为 [32, 8]。
  • pre_iterations (int) – 预训练轮数。默认值为 100。
  • iterations (int) – 训练轮数。默认值为 100。
  • seed (int) – 权重初始化的随机种子。默认值为 42。
  • lamb (float) – 正则化参数。默认值为 0.01。
  • seed – 随机种子值。默认值为 42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个DANMF聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_embedding() → numpy.array[来源]

获取瓶颈层嵌入。

Return types:
  • embedding (Numpy array) - The bottleneck layer embedding of nodes.
get_memberships() → Dict[int, int][源代码]

获取节点的集群成员资格。

Return types:
  • memberships (dict): Node cluster memberships.
class NNSED(dimensions: int = 32, iterations: int = 10, seed: int = 42, noise: float = 1e-06)[来源]

CIKM '17论文“一种用于社区检测的非负对称编码器-解码器方法”中“NNSED”的实现。该过程使用非负矩阵分解来学习节点上的未归一化聚类成员分布。该方法可以以重叠和非重叠的方式使用。

参数:
  • layers (int) – 嵌入层大小。默认为32。
  • iterations (int) – 训练轮数。默认为10。
  • seed (int) – 权重初始化的随机种子。默认为42。
  • noise (float) – 用于归一化稳定性的随机噪声。默认为10**-6。
fit(graph: networkx.classes.graph.Graph)[来源]

拟合一个NNSED聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_embedding() → numpy.array[来源]

获取瓶颈层嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
get_memberships() → Dict[int, int][来源]

获取节点的集群成员资格。

Return types:
  • memberships (dict) - Node cluster memberships.
class MNMF(dimensions: int = 128, clusters: int = 10, lambd: float = 0.2, alpha: float = 0.05, beta: float = 0.05, iterations: int = 200, lower_control: float = 1e-15, eta: float = 5.0, seed: int = 42)[源代码]

一个实现自AAAI '17论文“社区保持网络嵌入”中的“M-NMF”。 该过程使用基于模块化的联合非负矩阵分解来进行正则化,以学习节点的集群成员分布。该方法可以以重叠和非重叠的方式使用。

Parameters:
  • dimensions (int) – Number of dimensions. Default is 128.
  • clusters (int) – Number of clusters. Default is 10.
  • lambd (float) – KKT penalty. Default is 0.2
  • alpha (float) – Clustering penalty. Default is 0.05.
  • beta (float) – Modularity regularization penalty. Default is 0.05.
  • iterations (int) – Number of power iterations. Default is 200.
  • lower_control (float) – Floating point overflow control. Default is 10**-15.
  • eta (float) – Similarity mixing parameter. Default is 5.0.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph)[来源]

拟合一个M-NMF聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_cluster_centers() → numpy.array[来源]

获取节点嵌入。

Return types:
  • centers (Numpy array) - The cluster centers.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
get_memberships() → Dict[int, int][来源]

获取节点的集群成员资格。

Return types:
  • memberships (dict) - Node cluster memberships.
class BigClam(dimensions: int = 8, iterations: int = 50, learning_rate: float = 0.005, seed: int = 42)[源代码]

一个实现来自WSDM '13论文“大规模重叠社区检测:非负矩阵分解方法”的“BigClam”。该过程使用梯度上升来创建一个嵌入,用于决定节点-集群的归属。

参数:
  • dimensions (int) – 嵌入维度数。默认值为8。
  • iterations (int) – 训练迭代次数。默认值为50。
  • learning_rate (float) – 梯度上升学习率。默认值为0.005。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个BigClam聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
get_memberships() → Dict[int, int][源代码]

获取节点的集群成员资格。

Return types:
  • memberships (dict) - Node cluster memberships.
class SymmNMF(dimensions: int = 32, iterations: int = 200, rho: float = 100.0, seed: int = 42)[源代码]

一个实现来自SDM’12论文“Symmetric Nonnegative Matrix Factorization for Graph Clustering”的“Symm-NMF”。该过程使用基于ADMM的非负矩阵分解技术分解归一化邻接矩阵的二次幂。这导致了一个节点嵌入,每个节点都与创建的潜在空间中的嵌入因子相关联。

参数:
  • dimensions (int) – 维度数。默认值为32。
  • iterations (int) – 幂迭代次数。默认值为200。
  • rho (float) – 正则化调整参数。默认值为100.0。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个Symm-NMF聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
get_memberships() → Dict[int, int][源代码]

获取节点的集群成员资格。

Return types:
  • memberships (dict) - Node cluster memberships.

非重叠社区检测

class GEMSEC(walk_number: int = 5, walk_length: int = 80, dimensions: int = 32, negative_samples: int = 5, window_size: int = 5, learning_rate: float = 0.1, clusters: int = 10, gamma: float = 0.1, seed: int = 42)[源代码]

一个实现来自ASONAM '19论文“GEMSEC: 图嵌入与自聚类”的“GEMSEC”。该过程使用随机游走来近似通过池化归一化邻接矩阵幂获得的点互信息矩阵。该矩阵通过一种近似分解技术进行分解,该技术与类似k-means的聚类成本相结合。节点嵌入和聚类是联合学习的。

Parameters:
  • walk_number (int) – Number of random walks. Default is 5.
  • walk_length (int) – Length of random walks. Default is 80.
  • dimensions (int) – Dimensionality of embedding. Default is 32.
  • negative_samples (int) – Number of negative samples. Default is 5.
  • window_size (int) – Matrix power order. Default is 5.
  • learning_rate (float) – Gradient descent learning rate. Default is 0.1.
  • clusters (int) – Number of cluster centers. Default is 10.
  • gamma (float) – Clustering cost weight coefficient. Default is 0.1.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个GEMSEC模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array): The embedding of nodes.
get_memberships() → Dict[int, int][源代码]

获取节点的集群成员资格。

Return types:
  • memberships (dict): Node cluster memberships.
class EdMot(component_count: int = 2, cutoff: int = 50, seed: int = 42)[源代码]

一个实现来自KDD '19论文“EdMot: An Edge Enhancement Approach for Motif-aware Community Detection”的“Edge Motif Clustering”。该工具首先创建高阶主题的图。这个图通过Louvain方法进行聚类。最终的聚类成员关系存储为一个字典。

参数:
  • component_count (int) – 提取的模体超图组件数量。默认值为2。
  • cutoff (int) – 模体边界的截断值。默认值为50。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个边缘主题聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_memberships() → Dict[int, int][来源]

获取节点的集群成员资格。

Return types:
  • memberships (dictionary of ints) - Cluster memberships.
class SCD(iterations: int = 25, eps: float = 1e-06, seed: int = 42)[源代码]

一个实现来自WWW '14论文“High Quality, Scalable and Parallel Community Detection for Large Real Graphs”的“SCD”。该过程贪婪地优化了近似加权社区聚类度量。首先,围绕高度聚类的节点构建集群。其次,我们通过使用近似WCC来优化初始分区。这些优化针对整个顶点集进行。

参数:
  • iterations (int) – 细化迭代次数。默认值为25。
  • eps (float) – 用于零除校正的Epsilon分数。默认值为10**-6。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个标签传播聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_memberships() → Dict[int, int][来源]

获取节点的集群成员资格。

Return types:
  • memberships (dict) - Node cluster memberships.
class LabelPropagation(seed: int = 42, iterations: int = 100)[源代码]

一个实现自“标签传播聚类”的工具,源自2007年《物理评论》论文“在大规模网络中检测社区结构的近线性时间算法”。该工具执行一系列带有唯一标签的标签传播。最终的标签被用作集群成员资格。

参数:
  • seed (int) – 随机种子。默认值为42。
  • iterations (int) – 传播迭代次数。默认值为100。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个标签传播聚类模型。

Arg types:
  • graph (NetworkX graph) - The graph to be clustered.
get_memberships() → Dict[int, int][源代码]

获取节点的集群成员资格。

Return types:
  • memberships (dict) - Node cluster memberships.

基于邻域的节点嵌入

class SocioDim(dimensions: int = 128, seed: int = 42)[来源]

一个实现来自KDD '09论文“通过潜在社交维度进行关系学习”的“SocioDim”。该过程提取与图模块化矩阵的最大特征值对应的特征向量。这些向量被用作节点嵌入。

参数:
  • dimensions (int) – 嵌入的维度。默认值为128。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个社会维度模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class RandNE(dimensions: int = 128, alphas: list = [0.5, 0.5], seed: int = 42)[源代码]

ICDM '18 论文“Billion-scale Network Embedding with Iterative Random Projection”中“RandNE”的实现。该过程在正交化的随机生成的基础节点嵌入矩阵上使用基于归一化邻接矩阵的平滑。

参数:
  • dimensions (int) – 嵌入维度的数量。默认值为128。
  • alphas (list) – 邻接矩阵幂的平滑权重。默认值为[0.5, 0.5]。
  • seed (int) – 随机种子。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个NetMF模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class GLEE(dimensions: int = 128, seed: int = 42)[源代码]

一个实现来自《复杂网络》期刊20年论文“GLEE: Geometric Laplacian Eigenmap Embedding”的“几何拉普拉斯特征映射”。 该过程提取了图拉普拉斯矩阵的最大特征值对应的特征向量。这些向量被用作节点嵌入。

参数:
  • dimensions (int) – 嵌入的维度。默认值为128。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个几何拉普拉斯特征映射模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class Diff2Vec(diffusion_number: int = 10, diffusion_cover: int = 80, dimensions: int = 128, workers: int = 4, window_size: int = 5, epochs: int = 1, learning_rate: float = 0.05, min_count: int = 1, seed: int = 42)[源代码]

一个实现来自CompleNet '18论文“Diff2Vec: Fast Sequence Based Embedding with Diffusion Graphs”的“Diff2Vec”。 该过程从图中的每个源节点创建扩散树。这些图通过有向欧拉游走线性化,游走用于运行skip-gram算法以学习基于节点级别邻域的嵌入。

Parameters:
  • diffusion_number (int) – Number of diffusions. Default is 10.
  • diffusion_cover (int) – Number of nodes in diffusion. Default is 80.
  • dimensions (int) – Dimensionality of embedding. Default is 128.
  • workers (int) – Number of cores. Default is 4.
  • window_size (int) – Matrix power order. Default is 5.
  • epochs (int) – Number of epochs. Default is 1.
  • learning_rate (float) – HogWild! learning rate. Default is 0.05.
  • min_count (int) – Minimal count of node occurrences. Default is 1.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph)[来源]

拟合一个Diff2Vec模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class NodeSketch(dimensions: int = 32, iterations: int = 2, decay: float = 0.01, seed: int = 42)[源代码]

一个实现来自KDD '19论文“NodeSketch: Highly-Efficient Graph Embeddings via Recursive Sketching”的“NodeSketch”。该过程首先通过绘制自环增强的图的邻接矩阵来输出低阶节点嵌入,然后基于自环增强的邻接矩阵和(k-1)阶节点嵌入递归生成k阶节点嵌入。

参数:
  • dimensions (int) – 嵌入维度。默认值为32。
  • iterations (int) – 迭代次数(草图顺序减一)。默认值为2。
  • decay (float) – 指数衰减率。默认值为0.01。
  • seed (int) – 随机种子值。默认值为42。
fit(graph)[源代码]

拟合一个NodeSketch模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding()[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class NetMF(dimensions: int = 32, iteration: int = 10, order: int = 2, negative_samples: int = 1, seed: int = 42)[源代码]

一个实现来自WSDM '18论文“网络嵌入作为矩阵分解:统一DeepWalk、LINE、PTE和Node2Vec”的“NetMF”。该过程使用稀疏截断SVD来学习从归一化邻接矩阵的幂计算的PMI矩阵的池化幂的嵌入。

参数:
  • dimensions (int) – 嵌入维度数。默认值为32。
  • iteration (int) – SVD迭代次数。默认值为10。
  • order (int) – PMI矩阵幂次数。默认值为2。
  • negative_samples (in) – 负样本数。默认值为1。
  • seed (int) – SVD随机种子。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个NetMF模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class BoostNE(dimensions: int = 8, iterations: int = 16, order: int = 2, alpha: float = 0.01, seed: int = 42)[源代码]

一个实现来自ASONAM '19论文“多级网络嵌入与增强低秩矩阵近似”的“BoostNE”。该过程使用非负矩阵分解迭代地分解由先前的分解模型获得的残差。基础目标矩阵是邻接矩阵幂的池化和。

参数:
  • dimensions (int) – 单个嵌入维度的数量。默认值为8。
  • iterations (int) – 提升迭代的次数。默认值为16。
  • order (int) – 邻接矩阵幂的次数。默认值为2。
  • alpha (float) – NMF正则化参数。默认值为0.01。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个BoostNE模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class Walklets(walk_number: int = 10, walk_length: int = 80, dimensions: int = 32, workers: int = 4, window_size: int = 4, epochs: int = 1, learning_rate: float = 0.05, min_count: int = 1, seed: int = 42)[源代码]

一个实现来自ASONAM '17论文“不要走,跳过!在线学习多尺度网络嵌入”中的“Walklets”。该过程使用随机游走来近似通过单个归一化邻接矩阵幂获得的点互信息矩阵。这些矩阵通过近似分解技术进行分解,并将嵌入连接在一起。

Parameters:
  • walk_number (int) – Number of random walks. Default is 10.
  • walk_length (int) – Length of random walks. Default is 80.
  • dimensions (int) – Dimensionality of embedding. Default is 32.
  • workers (int) – Number of cores. Default is 4.
  • window_size (int) – Matrix power order. Default is 4.
  • epochs (int) – Number of epochs. Default is 1.
  • learning_rate (float) – HogWild! learning rate. Default is 0.05.
  • min_count (int) – Minimal count of node occurrences. Default is 1.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个Walklets模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class GraRep(dimensions: int = 32, iteration: int = 10, order: int = 5, seed: int = 42)[源代码]

一个实现来自CIKM '15论文“GraRep: Learning Graph Representations with Global Structural Information”的“GraRep”。该过程使用稀疏截断SVD来学习从归一化邻接矩阵的幂计算的PMI矩阵的幂的嵌入。

参数:
  • dimensions (int) – 单个嵌入维度的数量。默认值为32。
  • iteration (int) – SVD迭代次数。默认值为10。
  • order (int) – PMI矩阵幂的次数。默认值为5。
  • seed (int) – SVD随机种子。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个GraRep模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class DeepWalk(walk_number: int = 10, walk_length: int = 80, dimensions: int = 128, workers: int = 4, window_size: int = 5, epochs: int = 1, learning_rate: float = 0.05, min_count: int = 1, seed: int = 42)[源代码]

一个实现来自KDD '14论文“DeepWalk: Online Learning of Social Representations”的“DeepWalk”。该过程使用随机游走来近似通过池化归一化邻接矩阵幂获得的逐点互信息矩阵。该矩阵通过近似分解技术进行分解。

Parameters:
  • walk_number (int) – Number of random walks. Default is 10.
  • walk_length (int) – Length of random walks. Default is 80.
  • dimensions (int) – Dimensionality of embedding. Default is 128.
  • workers (int) – Number of cores. Default is 4.
  • window_size (int) – Matrix power order. Default is 5.
  • epochs (int) – Number of epochs. Default is 1.
  • learning_rate (float) – HogWild! learning rate. Default is 0.05.
  • min_count (int) – Minimal count of node occurrences. Default is 1.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个DeepWalk模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class Node2Vec(walk_number: int = 10, walk_length: int = 80, p: float = 1.0, q: float = 1.0, dimensions: int = 128, workers: int = 4, window_size: int = 5, epochs: int = 1, learning_rate: float = 0.05, min_count: int = 1, seed: int = 42)[源代码]

一个实现来自KDD '16论文“node2vec: 网络的可扩展特征学习”中的“Node2Vec”。该过程使用有偏二阶随机游走来近似通过池化归一化邻接矩阵幂获得的点互信息矩阵。该矩阵通过近似分解技术进行分解。

Parameters:
  • walk_number (int) – Number of random walks. Default is 10.
  • walk_length (int) – Length of random walks. Default is 80.
  • p (float) – Return parameter (1/p transition probability) to move towards from previous node.
  • q (float) – In-out parameter (1/q transition probability) to move away from previous node.
  • dimensions (int) – Dimensionality of embedding. Default is 128.
  • workers (int) – Number of cores. Default is 4.
  • window_size (int) – Matrix power order. Default is 5.
  • epochs (int) – Number of epochs. Default is 1.
  • learning_rate (float) – HogWild! learning rate. Default is 0.05.
  • min_count (int) – Minimal count of node occurrences. Default is 1.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个DeepWalk模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class NMFADMM(dimensions: int = 32, iterations: int = 100, rho: float = 1.0, seed: int = 42)[来源]

一个实现来自ICASSP '14论文“使用交替方向乘子法解决Beta散度非负矩阵分解”的“NMF-ADMM”。该过程通过学习归一化邻接矩阵的嵌入,使用交替方向乘子法来解决非负矩阵分解问题。

参数:
  • dimensions (int) – 单个嵌入维度的数量。默认值为32。
  • iterations (int) – ADMM迭代次数。默认值为100。
  • rho (float) – ADMM调优参数。默认值为1.0。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[来源]

使用ADMM在归一化的邻接矩阵上拟合NMF模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class LaplacianEigenmaps(dimensions: int = 128, maximum_number_of_iterations: int = 100, seed: int = 42)[源代码]

一个实现来自NIPS '01论文“Laplacian Eigenmaps and Spectral Techniques for Embedding and Clustering”的“Laplacian Eigenmaps”。 该过程提取了图拉普拉斯矩阵的最大特征值对应的特征向量。这些向量被用作节点嵌入。

参数:
  • dimensions (int) – 嵌入的维度。默认值为128。
  • maximum_number_of_iterations (int) – 使用ARPACK执行的最大迭代次数。该值将乘以节点数。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合拉普拉斯特征映射模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.

结构节点嵌入

class GraphWave(sample_number: int = 200, step_size: float = 0.1, heat_coefficient: float = 1.0, approximation: int = 100, mechanism: str = 'approximate', switch: int = 1000, seed: int = 42)[来源]

一个实现来自KDD '18论文“通过扩散小波学习结构节点嵌入”的“GraphWave”。 该过程首先使用热核计算图小波。小波被视为从源节点开始的节点上的概率分布。使用这些,在特定网格点上评估特征函数,以学习顶点的结构节点嵌入。

参数:
  • sample_number (int) – 评估点的数量。默认值为200。
  • step_size (float) – 网格点步长。默认值为0.1。
  • heat_coefficient (float) – 热核系数。默认值为1.0。
  • approximation (int) – 切比雪夫多项式阶数。默认值为100。
  • mechanism (str) – 小波计算方法之一: ("exact", "approximate")。默认值为‘approximate’。
  • switch (int) – 当小波计算方法切换到近似时的顶点基数。默认值为1000。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个GraphWave模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class Role2Vec(walk_number: int = 10, walk_length: int = 80, dimensions: int = 128, workers: int = 4, window_size: int = 2, epochs: int = 1, learning_rate: float = 0.05, down_sampling: float = 0.0001, min_count: int = 10, wl_iterations: int = 2, seed: int = 42, erase_base_features: bool = False)[源代码]

IJCAI '18 论文“基于角色的图嵌入学习”中“Role2vec”的实现。 该过程使用随机游走来近似通过将池化的邻接幂矩阵与结构特征矩阵(在本例中为Weisfeiler-Lehman特征)相乘获得的点互信息矩阵。通过这种方式,可以获得结构节点嵌入。

Parameters:
  • walk_number (int) – Number of random walks. Default is 10.
  • walk_length (int) – Length of random walks. Default is 80.
  • dimensions (int) – Dimensionality of embedding. Default is 128.
  • workers (int) – Number of cores. Default is 4.
  • window_size (int) – Matrix power order. Default is 2.
  • epochs (int) – Number of epochs. Default is 1.
  • learning_rate (float) – HogWild! learning rate. Default is 0.05.
  • down_sampling (float) – Down sampling frequency. Default is 0.0001.
  • min_count (int) – Minimal count of feature occurrences. Default is 10.
  • wl_iterations (int) – Number of Weisfeiler-Lehman hashing iterations. Default is 2.
  • seed (int) – Random seed value. Default is 42.
  • erase_base_features (bool) – Removing the base features. Default is False.
fit(graph: networkx.classes.graph.Graph)[源代码]

拟合一个Role2vec模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.

属性节点嵌入

class FeatherNode(reduction_dimensions: int = 64, svd_iterations: int = 20, theta_max: float = 2.5, eval_points: int = 25, order: int = 5, seed: int = 42)[源代码]

CIKM '20 论文“图上的特征函数:统计描述符到参数模型”中“FEATHER-N”的实现。该过程使用节点特征的特征函数与随机游走权重来描述节点邻域。

参数:
  • reduction_dimensions (int) – SVD 降维维度。默认值为 64。
  • svd_iterations (int) – SVD 迭代次数。默认值为 20。
  • theta_max (float) – 最大评估点。默认值为 2.5。
  • eval_points (int) – 特征函数评估点的数量。默认值为 25。
  • order (int) – 尺度 - 邻接矩阵幂的次数。默认值为 5。
  • seed (int) – 随机种子值。默认值为 42。
fit(graph: networkx.classes.graph.Graph, X: Union[numpy.array, scipy.sparse.coo.coo_matrix])[源代码]

拟合一个FEATHER-N模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • X (Scipy COO or Numpy array) - The matrix of node features.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class AE(walk_number=5, walk_length=80, dimensions=32, workers=4, window_size=3, epochs=5, learning_rate=0.05, down_sampling=0.0001, min_count=1, seed=42)[源代码]

一个实现来自Arxiv '19论文“MUSAE: 多尺度属性节点嵌入”的“AE”。该过程通过属性随机游走来近似池化的邻接矩阵幂节点特征矩阵乘积。该矩阵通过Skip-Gram风格的优化问题隐式分解。

Parameters:
  • walk_number (int) – Number of random walks. Default is 5.
  • walk_length (int) – Length of random walks. Default is 80.
  • dimensions (int) – Dimensionality of embedding. Default is 32.
  • workers (int) – Number of cores. Default is 4.
  • window_size (int) – Matrix power order. Default is 3.
  • epochs (int) – Number of epochs. Default is 1.
  • learning_rate (float) – HogWild! learning rate. Default is 0.05.
  • down_sampling (float) – Down sampling rate in the corpus. Default is 0.0001.
  • min_count (int) – Minimal count of node occurrences. Default is 1.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph, X: Union[numpy.array, scipy.sparse.coo.coo_matrix])[源代码]

拟合一个AE模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • X (Scipy COO array) - The binary matrix of node features.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class MUSAE(walk_number=5, walk_length=80, dimensions=32, workers=4, window_size=3, epochs=5, learning_rate=0.05, down_sampling=0.0001, min_count=1, seed=42)[源代码]

一个实现来自Arxiv '19论文“MUSAE: 多尺度属性节点嵌入”的“MUSAE”。该过程通过属性随机游走来近似邻接矩阵幂节点特征矩阵乘积。矩阵通过Skip-Gram风格的优化器隐式分解。各个嵌入被连接在一起以形成多尺度属性节点嵌入。这样,不同尺度的特征分布是可分离的。

Parameters:
  • walk_number (int) – Number of random walks. Default is 5.
  • walk_length (int) – Length of random walks. Default is 80.
  • dimensions (int) – Dimensionality of embedding. Default is 32.
  • workers (int) – Number of cores. Default is 4.
  • window_size (int) – Matrix power order. Default is 3.
  • epochs (int) – Number of epochs. Default is 1.
  • learning_rate (float) – HogWild! learning rate. Default is 0.05.
  • down_sampling (float) – Down sampling rate in the corpus. Default is 0.0001.
  • min_count (int) – Minimal count of node occurrences. Default is 1.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph, X: Union[numpy.array, scipy.sparse.coo.coo_matrix])[源代码]

拟合一个MUSAE模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • X (Scipy COO array) - The binary matrix of node features.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class SINE(walk_number: int = 10, walk_length: int = 80, dimensions: int = 128, workers: int = 4, window_size: int = 5, epochs: int = 1, learning_rate: float = 0.05, min_count: int = 1, seed: int = 42)[源代码]

一个实现来自ICDM '18论文“SINE: Scalable Incomplete Network Embedding”的“SINE”。该过程隐式地分解了一个联合邻接矩阵幂和特征矩阵。分解发生在截断的随机游走上,并且邻接矩阵幂被汇集在一起。

Parameters:
  • walk_number (int) – Number of random walks. Default is 10.
  • walk_length (int) – Length of random walks. Default is 80.
  • dimensions (int) – Dimensionality of embedding. Default is 128.
  • workers (int) – Number of cores. Default is 4.
  • window_size (int) – Matrix power order. Default is 5.
  • epochs (int) – Number of epochs. Default is 1.
  • learning_rate (float) – HogWild! learning rate. Default is 0.05.
  • min_count (int) – Minimal count of node occurrences. Default is 1.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph, X: Union[numpy.array, scipy.sparse.coo.coo_matrix])[源代码]

拟合一个正弦模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • X (Scipy COO array) - The matrix of node features.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class BANE(dimensions: int = 32, svd_iterations: int = 20, seed: int = 42, alpha: float = 0.3, iterations: int = 100, binarization_iterations: int = 20)[源代码]

一个实现来自ICDM '18论文“二值化属性网络嵌入类”的“BANE”。该过程首先计算邻接-特征矩阵乘积的截断SVD。然后通过基于二进制CCD的技术进一步分解该矩阵。

参数:
  • dimensions (int) – 嵌入维度数。默认值为32。
  • svd_iterations (int) – SVD迭代次数。默认值为20。
  • seed (int) – 随机种子。默认值为42。
  • alpha (float) – 核矩阵反演参数。默认值为0.3。
  • iterations (int) – 矩阵分解迭代次数。默认值为100。
  • binarization_iterations (int) – 二值化迭代次数。默认值为20。
  • seed – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph, X: Union[numpy.array, scipy.sparse.coo.coo_matrix])[源代码]

拟合一个BANE模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • X (Scipy COO or Numpy array) - The matrix of node features.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class TENE(dimensions=32, lower_control=1e-15, alpha=0.1, beta=0.1, iterations=200, seed=42)[源代码]

一个实现来自ICPR '18论文“Enhanced Network Embedding with Text Information”的“TENE”。该过程使用交替最小二乘法联合分解邻接矩阵和节点特征矩阵。

参数:
  • dimensions (int) – 嵌入维度数。默认值为32。
  • lower_control (float) – 嵌入分数的最小值。默认值为10**-15。
  • alpha (float) – 邻接矩阵正则化系数。默认值为0.1。
  • beta (float) – 特征矩阵正则化系数。默认值为0.1。
  • iterations (int) – ALS迭代次数。默认值为200。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph, T: Union[numpy.array, scipy.sparse.coo.coo_matrix])[源代码]

拟合TENE模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • T (Scipy COO or Numpy array) - The matrix of node features.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class TADW(dimensions: int = 32, reduction_dimensions: int = 64, svd_iterations: int = 20, seed: int = 42, alpha: float = 0.01, iterations: int = 10, lambd: float = 10.0)[源代码]

IJCAI '15论文“具有丰富文本信息的网络表示学习”中“TADW”的实现。该过程使用节点属性矩阵与分解矩阵来重现邻接矩阵的幂,以创建表示。

参数:
  • dimensions (int) – 嵌入维度数。默认值为32。
  • reduction_dimensions (int) – SVD降维维度数。默认值为64。
  • svd_iterations (int) – SVD迭代次数。默认值为20。
  • seed (int) – 随机种子。默认值为42。
  • alpha (float) – 学习率。默认值为0.01。
  • iterations (int) – 矩阵分解迭代次数。默认值为10。
  • lambd (float) – 正则化系数。默认值为10.0。
fit(graph: networkx.classes.graph.Graph, X: Union[numpy.array, scipy.sparse.coo.coo_matrix])[来源]

拟合一个TADW模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • X (Scipy COO or Numpy array) - The matrix of node features.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class FSCNMF(dimensions: int = 32, lower_control: float = 1e-15, iterations: int = 500, alpha_1: float = 1000.0, alpha_2: float = 1.0, alpha_3: float = 1.0, beta_1: float = 1000.0, beta_2: float = 1.0, beta_3: float = 1.0, seed: int = 42)[源代码]

一个实现来自Arxiv '18论文“通过非负矩阵分解融合结构和内容以嵌入信息网络”的“FCNMF”。该过程在邻接矩阵和特征矩阵上使用联合矩阵分解技术。节点和特征嵌入通过共同正则化来对齐嵌入空间。

Parameters:
  • dimensions (int) – Number of embedding dimensions. Default is 32.
  • lower_control (float) – Embedding score minimal value. Default is 10**-15.
  • iterations (int) – Power iterations. Default is 500.
  • alpha_1 (float) – Alignment parameter for adjacency matrix. Default is 1000.0.
  • alpha_2 (float) – Adjacency basis regularization. Default is 1.0.
  • alpha_3 (float) – Adjacency features regularization. Default is 1.0.
  • beta_1 (float) – Alignment parameter for feature matrix. Default is 1000.0.
  • beta_2 (float) – Attribute basis regularization. Default is 1.0.
  • beta_3 (float) – Attribute basis regularization. Default is 1.0.
  • seed (int) – Random seed value. Default is 42.
fit(graph: networkx.classes.graph.Graph, X: Union[numpy.array, scipy.sparse.coo.coo_matrix])[来源]

拟合一个FSCNMF模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • X (Scipy COO or Numpy array) - The matrix of node features.
get_embedding() → numpy.array[源代码]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.
class ASNE(dimensions: int = 128, workers: int = 4, epochs: int = 100, down_sampling: float = 0.0001, learning_rate: float = 0.05, min_count: int = 1, seed: int = 42)[源代码]

一个实现来自TKDE '18论文“属性社交网络嵌入”的“ASNE”。该过程隐式地分解了一个连接的邻接矩阵和特征矩阵。

参数:
  • dimensions (int) – 嵌入的维度。默认值为128。
  • workers (int) – 核心数。默认值为4。
  • epochs (int) – 训练轮数。默认值为100。
  • down_sampling (float) – 下采样频率。默认值为0.0001。
  • learning_rate (float) – HogWild! 学习率。默认值为0.05。
  • min_count (int) – 节点出现的最小次数。默认值为1。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph, X: scipy.sparse.coo.coo_matrix)[源代码]

拟合一个ASNE模型。

Arg types:
  • graph (NetworkX graph) - The graph to be embedded.
  • X (Scipy COO array) - The matrix of node features.
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.

元节点嵌入

class NEU(L1: float = 0.5, L2: float = 0.25, T: int = 1, seed: int = 42)[源代码]

IJCAI 17论文“通过高阶邻近近似快速网络嵌入增强”中“NEU”的实现。 该过程使用任意嵌入,并通过递归元学习算法的高阶邻近性来增强它。

参数:
  • L1 (float) – 低阶邻近度的权重。默认值为0.5
  • L2 (float) – 高阶邻近度的权重。默认值为0.25。
  • T (int) – 迭代次数。默认值为1。
  • seed (int) – 随机种子值。默认值为42。
fit(graph: networkx.classes.graph.Graph, model: karateclub.estimator.Estimator)[源代码]

拟合模型并执行NEU。

参数:
  • graph * (*) –
  • model * (*) –
get_embedding() → numpy.array[来源]

获取节点嵌入。

Return types:
  • embedding (Numpy array) - The embedding of nodes.

全图嵌入

class WaveletCharacteristic(order: int = 5, eval_points: int = 25, theta_max: float = 2.5, tau: float = 1.0, pooling: str = 'mean')[源代码]

一个实现来自CIKM '21论文“基于扩散-小波的节点特征分布表征的图嵌入”中的“WaveCharacteristic”。该过程使用节点特征的特征函数与小波函数权重来描述节点邻域。这些节点级别的特征通过平均池化来创建图级别的统计信息。

参数:
  • order (int) – 邻接矩阵的幂次。默认值为5。
  • eval_points (int) – 特征函数评估的次数。默认值为5。
  • theta_max (float) – 特征函数的最大时间值。默认值为2.5。
  • tau (float) – 波函数热扩散时间。默认值为1.0。
  • pooling (str) – 应用于特征函数的池化函数。默认值为“mean”。
fit(graphs: List[networkx.classes.graph.Graph])[源代码]

拟合几何散射模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[源代码]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs: List[networkx.classes.graph.Graph]) → numpy.array[源代码]

推断图嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.

基于局部度分布的嵌入。

class LDP(bins: int = 32)[源代码]

一个实现来自ICLR图与流形表示学习研讨会'19论文“一个简单但有效的非属性图分类基线”的“LDP”。该过程计算度分布的直方图。这些连接的直方图形成了图的表示。

参数:bins (int) – 直方图的箱数。默认值为32。
fit(graphs)[源代码]

拟合一个LDP模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[来源]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs: List[networkx.classes.graph.Graph])[来源]

推断图的嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.
class FeatherGraph(order: int = 5, eval_points: int = 25, theta_max: float = 2.5, seed: int = 42, pooling: str = 'mean')[源代码]

CIKM '20 论文“图上的特征函数:物以类聚,从统计描述到参数模型”中“FEATHER-G”的实现。该过程使用节点特征的特征函数与随机游走权重来描述节点邻域。这些节点级别的特征通过平均池化来创建图级别的统计量。

参数:
  • order (int) – 邻接矩阵的幂次。默认值为5。
  • eval_points (int) – 评估点的数量。默认值为25。
  • theta_max (int) – 最大评估点值。默认值为2.5。
  • seed (int) – 随机种子值。默认值为42。
  • pooling (str) – 置换不变的池化函数,可选值为: ("mean", "max", "min")。默认值为“mean”。
fit(graphs: List[networkx.classes.graph.Graph]) → None[源代码]

拟合图级别的FEATHER模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[来源]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs: List[networkx.classes.graph.Graph]) → numpy.array[源代码]

使用图级别的FEATHER模型推断图嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.

不变图嵌入模型类。

class IGE(feature_embedding_dimensions: List[int] = [3, 5], spectral_embedding_dimensions: List[int] = [10, 20], histogram_bins: List[int] = [10, 20], seed: int = 42)[源代码]

一个实现来自ICML 2019关于图结构数据学习与推理研讨会的论文“不变图嵌入”的方法。该过程计算了基于谱和节点嵌入特征的混合。具体来说,它使用散射、特征值和池化的节点特征嵌入来创建图描述符。

参数:
  • feature_embedding_dimensions (list) – 特征嵌入维度。默认值为 [3, 5]
  • spectral_embedding_dimensions (list) – 光谱嵌入维度。默认值为 [10, 20]。
  • histogram_bins (list) – 直方图箱数。默认值为 [10, 20]。
  • seed (int) – 随机种子值。默认值为 42。
fit(graphs: List[networkx.classes.graph.Graph])[source]

拟合一个不变图嵌入模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[源代码]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs: List[networkx.classes.graph.Graph]) → numpy.array[源代码]

推断图的嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.
class GeoScattering(order: int = 4, moments: int = 4, seed: int = 42)[源代码]

一个实现来自ICML '19论文“用于图数据分析的几何散射”中的“GeoScattering”。该过程使用小波变换的散射来创建图谱描述符。小波变换特征的矩被用作嵌入的图级特征。

参数:
  • order (int) – 邻接矩阵的幂次。默认值为4。
  • moments (int) – 考虑的未归一化矩。默认值为4。
  • seed (int) – 随机种子值。默认值为42。
fit(graphs: List[networkx.classes.graph.Graph])[源代码]

拟合几何散射模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[来源]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs: List[networkx.classes.graph.Graph]) → numpy.array[源代码]

推断图的嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.
class GL2Vec(wl_iterations: int = 2, dimensions: int = 128, workers: int = 4, down_sampling: float = 0.0001, epochs: int = 10, learning_rate: float = 0.025, min_count: int = 5, seed: int = 42, erase_base_features: bool = False)[源代码]

一个实现来自ICONIP '19论文“GL2vec: Graph Embedding Enriched by Line Graphs with Edge Features”的“GL2Vec”。 首先,算法为图数据集中的每个图创建线图。 该过程为图中的节点创建Weisfeiler-Lehman树特征。使用这些特征,文档(图)-特征共现矩阵被分解以生成图的表示。

该过程假设节点没有字符串特征,并且WL哈希默认为度中心性。然而,如果节点支持具有键“feature”的节点特征,则特征提取将基于此键的值进行。

参数:
  • wl_iterations (int) – Weisfeiler-Lehman迭代次数。默认值为2。
  • dimensions (int) – 嵌入的维度。默认值为128。
  • workers (int) – 核心数。默认值为4。
  • down_sampling (float) – 下采样频率。默认值为0.0001。
  • epochs (int) – 训练轮数。默认值为10。
  • learning_rate (float) – HogWild!学习率。默认值为0.025。
  • min_count (int) – 图特征出现的最小次数。默认值为5。
  • seed (int) – 模型的随机种子。默认值为42。
fit(graphs: List[networkx.classes.graph.Graph])[源代码]

拟合一个GL2Vec模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[源代码]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs) → numpy.array[源代码]

推断图嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.
class NetLSD(scale_min: float = -2.0, scale_max: float = 2.0, scale_steps: int = 250, approximations: int = 200, seed: int = 42)[源代码]

一个实现来自KDD '18论文“NetLSD: Hearing the Shape of a Graph”的“NetLSD”。该过程计算归一化拉普拉斯矩阵在时间尺度向量上的热核迹。如果矩阵很大,则切换到特征值的近似值。

参数:
  • scale_min (float) – 时间尺度间隔最小值。默认值为 -2.0。
  • scale_max (float) – 时间尺度间隔最大值。默认值为 2.0。
  • scale_steps (int) – 时间尺度中的步数。默认值为 250。
  • scale_approximations (int) – 特征值近似值的数量。默认值为 200。
  • seed (int) – 随机种子值。默认值为 42。
fit(graphs: List[networkx.classes.graph.Graph])[source]

拟合一个NetLSD模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[源代码]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs: List[networkx.classes.graph.Graph]) → numpy.array[来源]

推断NetLSD嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.
class SF(dimensions: int = 128, seed: int = 42)[源代码]

一个实现来自NeurIPS关系表示学习研讨会'18论文“图分类的简单基线算法”的“SF”。 该过程计算归一化拉普拉斯算子的k个最低特征值。 如果图的特征值数量少于k,则用零填充表示。

参数:
  • dimensions (int) – 最低特征值的数量。默认值为128。
  • seed (int) – 随机种子值。默认值为42。
fit(graphs)[源代码]

拟合一个SF模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[源代码]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs) → numpy.array[源代码]

推断嵌入向量。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.
class FGSD(hist_bins: int = 200, hist_range: int = 20, seed: int = 42)[源代码]

一个实现来自NeurIPS '17论文“Hunt For The Unique, Stable, Sparse And Fast Feature Learning On Graphs”的“FGSD”。 该过程计算归一化拉普拉斯算子的Moore-Penrose谱。 使用这个谱,谱特征的直方图被用作整个图的表示。

参数:
  • hist_bins (int) – 直方图的箱数。默认值为200。
  • hist_range (int) – 考虑的直方图范围。默认值为20。
  • seed (int) – 随机种子值。默认值为42。
fit(graphs: List[networkx.classes.graph.Graph])[源代码]

拟合一个FGSD模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[源代码]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs: List[networkx.classes.graph.Graph]) → numpy.array[源代码]

推断一组图的嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.
class Graph2Vec(wl_iterations: int = 2, attributed: bool = False, dimensions: int = 128, workers: int = 4, down_sampling: float = 0.0001, epochs: int = 10, learning_rate: float = 0.025, min_count: int = 5, seed: int = 42, erase_base_features: bool = False)[源代码]

一个实现来自MLGWorkshop '17论文“Graph2Vec: Learning Distributed Representations of Graphs”的“Graph2Vec”。该过程为图中的节点创建Weisfeiler-Lehman树特征。使用这些特征,文档(图)-特征共现矩阵被分解以生成图的表示。

该过程假设节点没有字符串特征,并且WL哈希默认为度中心性。然而,如果节点支持具有键“feature”的节点特征,则特征提取将基于此键的值进行。

Parameters:
  • wl_iterations (int) – Number of Weisfeiler-Lehman iterations. Default is 2.
  • attributed (bool) – Presence of graph attributes. Default is False.
  • dimensions (int) – Dimensionality of embedding. Default is 128.
  • workers (int) – Number of cores. Default is 4.
  • down_sampling (float) – Down sampling frequency. Default is 0.0001.
  • epochs (int) – Number of epochs. Default is 10.
  • learning_rate (float) – HogWild! learning rate. Default is 0.025.
  • min_count (int) – Minimal count of graph feature occurrences. Default is 5.
  • seed (int) – Random seed for the model. Default is 42.
  • erase_base_features (bool) – Erasing the base features. Default is False.
fit(graphs: List[networkx.classes.graph.Graph])[源代码]

拟合一个Graph2Vec模型。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
get_embedding() → numpy.array[源代码]

获取图的嵌入。

Return types:
  • embedding (Numpy array) - The embedding of graphs.
infer(graphs) → numpy.array[源代码]

推断图嵌入。

Arg types:
  • graphs (List of NetworkX graphs) - The graphs to be embedded.
Return types:
  • embedding (Numpy array) - The embedding of graphs.