scikit-network 0.31.0__cp310-cp310-win_amd64.whl → 0.32.1__cp310-cp310-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.
- {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/AUTHORS.rst +3 -0
- {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/METADATA +19 -3
- {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/RECORD +112 -105
- {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/WHEEL +1 -1
- sknetwork/__init__.py +1 -1
- sknetwork/classification/base.py +1 -1
- sknetwork/classification/base_rank.py +3 -3
- sknetwork/classification/diffusion.py +21 -13
- sknetwork/classification/knn.py +19 -13
- sknetwork/classification/metrics.py +1 -1
- sknetwork/classification/pagerank.py +12 -8
- sknetwork/classification/propagation.py +22 -15
- sknetwork/classification/tests/test_diffusion.py +10 -0
- sknetwork/classification/vote.cp310-win_amd64.pyd +0 -0
- sknetwork/classification/vote.cpp +14549 -8668
- sknetwork/clustering/__init__.py +3 -1
- sknetwork/clustering/base.py +1 -1
- sknetwork/clustering/kcenters.py +253 -0
- sknetwork/clustering/leiden.py +241 -0
- sknetwork/clustering/leiden_core.cp310-win_amd64.pyd +0 -0
- sknetwork/clustering/leiden_core.cpp +31564 -0
- sknetwork/clustering/leiden_core.pyx +124 -0
- sknetwork/clustering/louvain.py +118 -83
- sknetwork/clustering/louvain_core.cp310-win_amd64.pyd +0 -0
- sknetwork/clustering/louvain_core.cpp +21876 -16332
- sknetwork/clustering/louvain_core.pyx +86 -94
- sknetwork/clustering/postprocess.py +2 -2
- sknetwork/clustering/propagation_clustering.py +4 -4
- sknetwork/clustering/tests/test_API.py +7 -3
- sknetwork/clustering/tests/test_kcenters.py +92 -0
- sknetwork/clustering/tests/test_leiden.py +34 -0
- sknetwork/clustering/tests/test_louvain.py +2 -3
- sknetwork/data/load.py +2 -4
- sknetwork/data/parse.py +41 -20
- sknetwork/data/tests/test_parse.py +9 -12
- sknetwork/embedding/__init__.py +0 -1
- sknetwork/embedding/base.py +20 -19
- sknetwork/embedding/force_atlas.py +3 -2
- sknetwork/embedding/louvain_embedding.py +1 -1
- sknetwork/embedding/random_projection.py +5 -3
- sknetwork/embedding/spectral.py +0 -73
- sknetwork/embedding/tests/test_API.py +4 -28
- sknetwork/embedding/tests/test_louvain_embedding.py +4 -9
- sknetwork/embedding/tests/test_spectral.py +2 -5
- sknetwork/embedding/tests/test_svd.py +1 -1
- sknetwork/gnn/base_layer.py +3 -3
- sknetwork/gnn/gnn_classifier.py +40 -86
- sknetwork/gnn/layer.py +1 -1
- sknetwork/gnn/loss.py +1 -1
- sknetwork/gnn/optimizer.py +4 -3
- sknetwork/gnn/tests/test_base_layer.py +4 -4
- sknetwork/gnn/tests/test_gnn_classifier.py +12 -39
- sknetwork/gnn/utils.py +8 -8
- sknetwork/hierarchy/base.py +27 -0
- sknetwork/hierarchy/louvain_hierarchy.py +45 -41
- sknetwork/hierarchy/paris.cp310-win_amd64.pyd +0 -0
- sknetwork/hierarchy/paris.cpp +27521 -20771
- sknetwork/hierarchy/paris.pyx +7 -7
- sknetwork/hierarchy/postprocess.py +16 -16
- sknetwork/hierarchy/tests/test_algos.py +5 -0
- sknetwork/linalg/__init__.py +1 -1
- sknetwork/linalg/diteration.cp310-win_amd64.pyd +0 -0
- sknetwork/linalg/diteration.cpp +13916 -8050
- sknetwork/linalg/{normalization.py → normalizer.py} +17 -14
- sknetwork/linalg/operators.py +1 -1
- sknetwork/linalg/ppr_solver.py +1 -1
- sknetwork/linalg/push.cp310-win_amd64.pyd +0 -0
- sknetwork/linalg/push.cpp +23187 -16973
- sknetwork/linalg/tests/test_normalization.py +3 -7
- sknetwork/linalg/tests/test_operators.py +2 -6
- sknetwork/linalg/tests/test_ppr.py +1 -1
- sknetwork/linkpred/base.py +12 -1
- sknetwork/linkpred/nn.py +6 -6
- sknetwork/path/distances.py +11 -4
- sknetwork/path/shortest_path.py +1 -1
- sknetwork/path/tests/test_distances.py +7 -0
- sknetwork/path/tests/test_search.py +2 -2
- sknetwork/ranking/base.py +11 -6
- sknetwork/ranking/betweenness.cp310-win_amd64.pyd +0 -0
- sknetwork/ranking/betweenness.cpp +5256 -2190
- sknetwork/ranking/pagerank.py +13 -12
- sknetwork/ranking/tests/test_API.py +0 -2
- sknetwork/ranking/tests/test_betweenness.py +1 -1
- sknetwork/ranking/tests/test_pagerank.py +11 -5
- sknetwork/regression/base.py +18 -1
- sknetwork/regression/diffusion.py +24 -10
- sknetwork/regression/tests/test_diffusion.py +8 -0
- sknetwork/topology/__init__.py +3 -1
- sknetwork/topology/cliques.cp310-win_amd64.pyd +0 -0
- sknetwork/topology/cliques.cpp +23528 -16848
- sknetwork/topology/core.cp310-win_amd64.pyd +0 -0
- sknetwork/topology/core.cpp +22849 -16581
- sknetwork/topology/cycles.py +243 -0
- sknetwork/topology/minheap.cp310-win_amd64.pyd +0 -0
- sknetwork/topology/minheap.cpp +19495 -13469
- sknetwork/topology/structure.py +2 -42
- sknetwork/topology/tests/test_cycles.py +65 -0
- sknetwork/topology/tests/test_structure.py +2 -16
- sknetwork/topology/triangles.cp310-win_amd64.pyd +0 -0
- sknetwork/topology/triangles.cpp +5283 -1397
- sknetwork/topology/triangles.pyx +7 -4
- sknetwork/topology/weisfeiler_lehman_core.cp310-win_amd64.pyd +0 -0
- sknetwork/topology/weisfeiler_lehman_core.cpp +14781 -8915
- sknetwork/utils/format.py +1 -1
- sknetwork/utils/membership.py +2 -2
- sknetwork/visualization/__init__.py +2 -2
- sknetwork/visualization/dendrograms.py +55 -7
- sknetwork/visualization/graphs.py +261 -44
- sknetwork/visualization/tests/test_dendrograms.py +9 -9
- sknetwork/visualization/tests/test_graphs.py +63 -57
- sknetwork/embedding/louvain_hierarchy.py +0 -142
- sknetwork/embedding/tests/test_louvain_hierarchy.py +0 -19
- {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/LICENSE +0 -0
- {scikit_network-0.31.0.dist-info → scikit_network-0.32.1.dist-info}/top_level.txt +0 -0
sknetwork/hierarchy/paris.pyx
CHANGED
|
@@ -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)
|
sknetwork/linalg/__init__.py
CHANGED
|
@@ -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.
|
|
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
|
|
Binary file
|