scikit-network 0.31.0__cp39-cp39-win_amd64.whl → 0.32.1__cp39-cp39-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of scikit-network might be problematic. Click here for more details.

Files changed (114) hide show
  1. {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/AUTHORS.rst +3 -0
  2. {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/METADATA +19 -3
  3. {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/RECORD +112 -105
  4. {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/WHEEL +1 -1
  5. sknetwork/__init__.py +1 -1
  6. sknetwork/classification/base.py +1 -1
  7. sknetwork/classification/base_rank.py +3 -3
  8. sknetwork/classification/diffusion.py +21 -13
  9. sknetwork/classification/knn.py +19 -13
  10. sknetwork/classification/metrics.py +1 -1
  11. sknetwork/classification/pagerank.py +12 -8
  12. sknetwork/classification/propagation.py +22 -15
  13. sknetwork/classification/tests/test_diffusion.py +10 -0
  14. sknetwork/classification/vote.cp39-win_amd64.pyd +0 -0
  15. sknetwork/classification/vote.cpp +14549 -8668
  16. sknetwork/clustering/__init__.py +3 -1
  17. sknetwork/clustering/base.py +1 -1
  18. sknetwork/clustering/kcenters.py +253 -0
  19. sknetwork/clustering/leiden.py +241 -0
  20. sknetwork/clustering/leiden_core.cp39-win_amd64.pyd +0 -0
  21. sknetwork/clustering/leiden_core.cpp +31564 -0
  22. sknetwork/clustering/leiden_core.pyx +124 -0
  23. sknetwork/clustering/louvain.py +118 -83
  24. sknetwork/clustering/louvain_core.cp39-win_amd64.pyd +0 -0
  25. sknetwork/clustering/louvain_core.cpp +21876 -16332
  26. sknetwork/clustering/louvain_core.pyx +86 -94
  27. sknetwork/clustering/postprocess.py +2 -2
  28. sknetwork/clustering/propagation_clustering.py +4 -4
  29. sknetwork/clustering/tests/test_API.py +7 -3
  30. sknetwork/clustering/tests/test_kcenters.py +92 -0
  31. sknetwork/clustering/tests/test_leiden.py +34 -0
  32. sknetwork/clustering/tests/test_louvain.py +2 -3
  33. sknetwork/data/load.py +2 -4
  34. sknetwork/data/parse.py +41 -20
  35. sknetwork/data/tests/test_parse.py +9 -12
  36. sknetwork/embedding/__init__.py +0 -1
  37. sknetwork/embedding/base.py +20 -19
  38. sknetwork/embedding/force_atlas.py +3 -2
  39. sknetwork/embedding/louvain_embedding.py +1 -1
  40. sknetwork/embedding/random_projection.py +5 -3
  41. sknetwork/embedding/spectral.py +0 -73
  42. sknetwork/embedding/tests/test_API.py +4 -28
  43. sknetwork/embedding/tests/test_louvain_embedding.py +4 -9
  44. sknetwork/embedding/tests/test_spectral.py +2 -5
  45. sknetwork/embedding/tests/test_svd.py +1 -1
  46. sknetwork/gnn/base_layer.py +3 -3
  47. sknetwork/gnn/gnn_classifier.py +40 -86
  48. sknetwork/gnn/layer.py +1 -1
  49. sknetwork/gnn/loss.py +1 -1
  50. sknetwork/gnn/optimizer.py +4 -3
  51. sknetwork/gnn/tests/test_base_layer.py +4 -4
  52. sknetwork/gnn/tests/test_gnn_classifier.py +12 -39
  53. sknetwork/gnn/utils.py +8 -8
  54. sknetwork/hierarchy/base.py +27 -0
  55. sknetwork/hierarchy/louvain_hierarchy.py +45 -41
  56. sknetwork/hierarchy/paris.cp39-win_amd64.pyd +0 -0
  57. sknetwork/hierarchy/paris.cpp +27521 -20771
  58. sknetwork/hierarchy/paris.pyx +7 -7
  59. sknetwork/hierarchy/postprocess.py +16 -16
  60. sknetwork/hierarchy/tests/test_algos.py +5 -0
  61. sknetwork/linalg/__init__.py +1 -1
  62. sknetwork/linalg/diteration.cp39-win_amd64.pyd +0 -0
  63. sknetwork/linalg/diteration.cpp +13916 -8050
  64. sknetwork/linalg/{normalization.py → normalizer.py} +17 -14
  65. sknetwork/linalg/operators.py +1 -1
  66. sknetwork/linalg/ppr_solver.py +1 -1
  67. sknetwork/linalg/push.cp39-win_amd64.pyd +0 -0
  68. sknetwork/linalg/push.cpp +23187 -16973
  69. sknetwork/linalg/tests/test_normalization.py +3 -7
  70. sknetwork/linalg/tests/test_operators.py +2 -6
  71. sknetwork/linalg/tests/test_ppr.py +1 -1
  72. sknetwork/linkpred/base.py +12 -1
  73. sknetwork/linkpred/nn.py +6 -6
  74. sknetwork/path/distances.py +11 -4
  75. sknetwork/path/shortest_path.py +1 -1
  76. sknetwork/path/tests/test_distances.py +7 -0
  77. sknetwork/path/tests/test_search.py +2 -2
  78. sknetwork/ranking/base.py +11 -6
  79. sknetwork/ranking/betweenness.cp39-win_amd64.pyd +0 -0
  80. sknetwork/ranking/betweenness.cpp +5256 -2190
  81. sknetwork/ranking/pagerank.py +13 -12
  82. sknetwork/ranking/tests/test_API.py +0 -2
  83. sknetwork/ranking/tests/test_betweenness.py +1 -1
  84. sknetwork/ranking/tests/test_pagerank.py +11 -5
  85. sknetwork/regression/base.py +18 -1
  86. sknetwork/regression/diffusion.py +24 -10
  87. sknetwork/regression/tests/test_diffusion.py +8 -0
  88. sknetwork/topology/__init__.py +3 -1
  89. sknetwork/topology/cliques.cp39-win_amd64.pyd +0 -0
  90. sknetwork/topology/cliques.cpp +23528 -16848
  91. sknetwork/topology/core.cp39-win_amd64.pyd +0 -0
  92. sknetwork/topology/core.cpp +22849 -16581
  93. sknetwork/topology/cycles.py +243 -0
  94. sknetwork/topology/minheap.cp39-win_amd64.pyd +0 -0
  95. sknetwork/topology/minheap.cpp +19495 -13469
  96. sknetwork/topology/structure.py +2 -42
  97. sknetwork/topology/tests/test_cycles.py +65 -0
  98. sknetwork/topology/tests/test_structure.py +2 -16
  99. sknetwork/topology/triangles.cp39-win_amd64.pyd +0 -0
  100. sknetwork/topology/triangles.cpp +5283 -1397
  101. sknetwork/topology/triangles.pyx +7 -4
  102. sknetwork/topology/weisfeiler_lehman_core.cp39-win_amd64.pyd +0 -0
  103. sknetwork/topology/weisfeiler_lehman_core.cpp +14781 -8915
  104. sknetwork/utils/format.py +1 -1
  105. sknetwork/utils/membership.py +2 -2
  106. sknetwork/visualization/__init__.py +2 -2
  107. sknetwork/visualization/dendrograms.py +55 -7
  108. sknetwork/visualization/graphs.py +261 -44
  109. sknetwork/visualization/tests/test_dendrograms.py +9 -9
  110. sknetwork/visualization/tests/test_graphs.py +63 -57
  111. sknetwork/embedding/louvain_hierarchy.py +0 -142
  112. sknetwork/embedding/tests/test_louvain_hierarchy.py +0 -19
  113. {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/LICENSE +0 -0
  114. {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/top_level.txt +0 -0
@@ -157,21 +157,21 @@ class Paris(BaseHierarchy):
157
157
 
158
158
  Parameters
159
159
  ----------
160
- weights :
160
+ weights : str
161
161
  Weights of nodes.
162
162
  ``'degree'`` (default) or ``'uniform'``.
163
- reorder :
163
+ reorder : bool
164
164
  If ``True`` (default), reorder the dendrogram in non-decreasing order of height.
165
165
 
166
166
  Attributes
167
167
  ----------
168
- dendrogram_ :
168
+ dendrogram_ : np.ndarray
169
169
  Dendrogram of the graph.
170
- dendrogram_row_ :
170
+ dendrogram_row_ : np.ndarray
171
171
  Dendrogram for the rows, for bipartite graphs.
172
- dendrogram_col_ :
172
+ dendrogram_col_ : np.ndarray
173
173
  Dendrogram for the columns, for bipartite graphs.
174
- dendrogram_full_ :
174
+ dendrogram_full_ : np.ndarray
175
175
  Dendrogram for both rows and columns, indexed in this order, for bipartite graphs.
176
176
 
177
177
  Examples
@@ -217,7 +217,7 @@ class Paris(BaseHierarchy):
217
217
 
218
218
  Parameters
219
219
  ----------
220
- input_matrix :
220
+ input_matrix : sparse.csr_matrix, np.ndarray
221
221
  Adjacency matrix or biadjacency matrix of the graph.
222
222
 
223
223
  Returns
@@ -75,17 +75,17 @@ def cut_straight(dendrogram: np.ndarray, n_clusters: Optional[int] = None, thres
75
75
 
76
76
  Parameters
77
77
  ----------
78
- dendrogram:
78
+ dendrogram : np.ndarray
79
79
  Dendrogram.
80
- n_clusters :
80
+ n_clusters : int
81
81
  Number of clusters (optional).
82
82
  The number of clusters can be larger than n_clusters in case of equal heights in the dendrogram.
83
- threshold :
83
+ threshold : float
84
84
  Threshold on height (optional).
85
85
  If both n_clusters and threshold are ``None``, n_clusters is set to 2.
86
- sort_clusters :
86
+ sort_clusters : bool
87
87
  If ``True``, sorts clusters in decreasing order of size.
88
- return_dendrogram :
88
+ return_dendrogram : bool
89
89
  If ``True``, returns the dendrogram formed by the clusters up to the root.
90
90
  Returns
91
91
  -------
@@ -135,13 +135,13 @@ def cut_balanced(dendrogram: np.ndarray, max_cluster_size: int = 20, sort_cluste
135
135
 
136
136
  Parameters
137
137
  ----------
138
- dendrogram:
138
+ dendrogram : np.ndarray
139
139
  Dendrogram
140
- max_cluster_size :
140
+ max_cluster_size : int
141
141
  Maximum size of each cluster.
142
- sort_clusters :
142
+ sort_clusters : bool
143
143
  If ``True``, sort labels in decreasing order of cluster size.
144
- return_dendrogram :
144
+ return_dendrogram : bool
145
145
  If ``True``, returns the dendrogram formed by the clusters up to the root.
146
146
  Returns
147
147
  -------
@@ -179,19 +179,19 @@ def aggregate_dendrogram(dendrogram: np.ndarray, n_clusters: int = 2, return_cou
179
179
 
180
180
  Parameters
181
181
  ----------
182
- dendrogram:
182
+ dendrogram : np.ndarray
183
183
  The input to aggregate.
184
- n_clusters:
184
+ n_clusters : int
185
185
  Number of clusters (or leaves) to keep.
186
- return_counts
186
+ return_counts : bool
187
187
  If ``True``, returns an array of counts corresponding to the sizes of the merged subtrees.
188
188
  The sum of the counts is equal to the number of samples in the input dendrogram.
189
189
 
190
190
  Returns
191
191
  -------
192
- new_dendrogram:
192
+ new_dendrogram : np.ndarray
193
193
  Aggregated dendrogram. The nodes are reindexed from 0.
194
- counts:
194
+ counts : np.ndarray
195
195
  Size of the subtrees corresponding to each leaf in new_dendrogram.
196
196
  """
197
197
  n_nodes: int = dendrogram.shape[0] + 1
@@ -220,12 +220,12 @@ def get_index(tree):
220
220
 
221
221
  Parameters
222
222
  ----------
223
- tree:
223
+ tree :
224
224
  The tree to be indexed
225
225
 
226
226
  Returns
227
227
  -------
228
- index:
228
+ index :
229
229
  The index of the root of the given tree
230
230
  """
231
231
  if type(tree) != list:
@@ -27,3 +27,8 @@ class TestLouvainHierarchy(unittest.TestCase):
27
27
  self.assertEqual(dendrogram.shape, (input_matrix.shape[0] - 1, 4))
28
28
  if algo.bipartite:
29
29
  self.assertEqual(algo.dendrogram_full_.shape, (sum(input_matrix.shape) - 1, 4))
30
+ adjacency = test_graph()
31
+ algo = Paris()
32
+ dendrogram = algo.fit_predict(adjacency)
33
+ dendrogram_ = algo.predict()
34
+ self.assertAlmostEqual(np.linalg.norm(dendrogram - dendrogram_), 0)
@@ -2,7 +2,7 @@
2
2
  from sknetwork.linalg.basics import safe_sparse_dot
3
3
  from sknetwork.linalg.eig_solver import EigSolver, LanczosEig
4
4
  from sknetwork.linalg.laplacian import get_laplacian
5
- from sknetwork.linalg.normalization import diagonal_pseudo_inverse, get_norms, normalize
5
+ from sknetwork.linalg.normalizer import diagonal_pseudo_inverse, get_norms, normalize
6
6
  from sknetwork.linalg.operators import Regularizer, Laplacian, Normalizer, CoNeighbor
7
7
  from sknetwork.linalg.polynome import Polynome
8
8
  from sknetwork.linalg.sparse_lowrank import SparseLR