@@ -100,33 +100,34 @@ class DataClustering(_GraphConstruction):
100
100
101
101
- 'knn-mst' will use k-Nearest Neighbor graph combined with Miniumus Spanning Tree.
102
102
- 'cknn-mst' will use Continunous k-Nearest Neighbor graph [2]_ combined with
103
- Miniumus Spanning Tree.
103
+ Miniumus Spanning Tree.
104
104
- 'precomputed' assumes that data is already provided as adjacency matrix of a
105
- sparse graph.
105
+ sparse graph.
106
106
107
107
k : int, default=5
108
108
Number of neighbors considered in graph construction. This parameter is expected
109
109
to be positive.
110
110
111
111
delta : float, default=1.0
112
- Density parameter for Continunous k-Nearest Neighbor graph. This parameter is
113
- expected to be positive.
112
+ Density parameter for Continunous k-Nearest Neighbor graph. This parameter is expected
113
+ to be positive.
114
114
115
115
distance_threshold : float, optional
116
116
Optional thresholding of distance matrix.
117
117
118
- ** pgs_kwargs : dict, optional
118
+ pgs_kwargs : dict, optional
119
119
Parameters for PyGenStability, see documentation. Some possible arguments:
120
+
120
121
- constructor (str/function): name of the generalized Markov Stability constructor,
121
- or custom constructor function. It must have two arguments, graph and scale.
122
+ or custom constructor function. It must have two arguments, graph and scale.
122
123
- min_scale (float): minimum Markov scale
123
124
- max_scale (float): maximum Markov scale
124
125
- n_scale (int): number of scale steps
125
126
- with_spectral_gap (bool): normalise scale by spectral gap
126
127
127
- Attributes:
128
- -----------
129
- adjacency_ : sparse matrix of shape (n_samples,n_samples)
128
+ Attributes
129
+ ----------
130
+ adjacency_ : sparse matrix of shape (n_samples, n_samples)
130
131
Sparse adjacency matrix of constructed graph.
131
132
132
133
results_ : dict
@@ -135,12 +136,12 @@ class DataClustering(_GraphConstruction):
135
136
labels_ : list of ndarray
136
137
List of robust partitions identified with optimal scale selection.
137
138
138
- References:
139
- -----------
140
- .. [1] Z. Liu and M. Barahona, 'Graph-based data clustering via multiscale
139
+ References
140
+ ----------
141
+ .. [1] Z. Liu and M. Barahona, 'Graph-based data clustering via multiscale
141
142
community detection', *Applied Network Science*, vol. 5, no. 1, p. 3,
142
143
Dec. 2020, doi: 10.1007/s41109-019-0248-7.
143
- .. [2] T. Berry and T. Sauer, 'Consistent manifold representation for
144
+ .. [2] T. Berry and T. Sauer, 'Consistent manifold representation for
144
145
topological data analysis', *Foundations of Data Science*, vol. 1, no. 1,
145
146
p. 1-38, Feb. 2019, doi: 10.3934/fods.2019001.
146
147
"""
@@ -192,13 +193,13 @@ def labels_(self):
192
193
def fit (self , X ):
193
194
"""Fit multiscale graph-based data clustering with PyGenStability from data.
194
195
195
- Parameters:
196
- -----------
196
+ Parameters
197
+ ----------
197
198
X : {array-like, sparse matrix} of shape (n_samples,n_features) or \
198
199
(n_samples,n_samples) if graph_method='precomputed'
199
200
Data to fit
200
201
201
- Returns:
202
+ Returns
202
203
-------
203
204
self : DataClustering
204
205
The fitted multiscale graph-based data clustering.
@@ -214,8 +215,8 @@ def fit(self, X):
214
215
def scale_selection (self , kernel_size = 0.1 , window_size = 0.1 , max_nvi = 1 , basin_radius = 0.01 ):
215
216
"""Identify optimal scales [3].
216
217
217
- Parameters:
218
- -----------
218
+ Parameters
219
+ ----------
219
220
kernel_size : int or float, default=0.1
220
221
Size of kernel for average-pooling of the NVI(t,t') matrix. If float smaller
221
222
than one it's the relative number of scales.
@@ -231,13 +232,13 @@ def scale_selection(self, kernel_size=0.1, window_size=0.1, max_nvi=1, basin_rad
231
232
Radius of basin around local minima of the pooled diagonal. If float smaller
232
233
than one it's the relative number of scales.
233
234
234
- Returns:
235
- --------
235
+ Returns
236
+ -------
236
237
labels_ : list of ndarray
237
238
List of robust partitions identified with optimal scale selection.
238
239
239
- References:
240
- -----------
240
+ References
241
+ ----------
241
242
.. [3] D. J. Schindler, J. Clarke, and M. Barahona, 'Multiscale Mobility Patterns and
242
243
the Restriction of Human Movement', *arXiv:2201.06323*, 2023
243
244
"""
@@ -272,7 +273,7 @@ def plot_robust_partitions(
272
273
):
273
274
"""Plot robust partitions with graph layout.
274
275
275
- Parameters:
276
+ Parameters
276
277
----------
277
278
x_coord : ndarray of shape (n_samples,)
278
279
X-coordinates provided for samples.
@@ -292,8 +293,8 @@ def plot_robust_partitions(
292
293
show : book, default=True
293
294
Show the figures.
294
295
295
- Returns:
296
- --------
296
+ Returns
297
+ -------
297
298
figs : All matplotlib figures
298
299
299
300
"""
@@ -335,8 +336,8 @@ def plot_sankey(
335
336
):
336
337
"""Plot Sankey diagram.
337
338
338
- Parameters:
339
- -----------
339
+ Parameters
340
+ ----------
340
341
optimal_scales : bool, default=True
341
342
Plot Sankey diagram of robust partitions only or not.
342
343
@@ -349,8 +350,8 @@ def plot_sankey(
349
350
scale_index : bool
350
351
Plot Sankey diagram for provided scale indices.
351
352
352
- Returns:
353
- --------
353
+ Returns
354
+ -------
354
355
fig : plotly figure
355
356
Sankey diagram figure.
356
357
"""
0 commit comments