Skip to content

Commit db89e51

Browse files
committed
fix doc
1 parent a7f4e11 commit db89e51

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Documentation of the API of *PyGenStability*.
1313
constructors
1414
app
1515
plotting
16+
dataclustering
1617
optimal_scales
1718
io
1819
examples/example

src/pygenstability/data_clustering.py

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -100,33 +100,34 @@ class DataClustering(_GraphConstruction):
100100
101101
- 'knn-mst' will use k-Nearest Neighbor graph combined with Miniumus Spanning Tree.
102102
- 'cknn-mst' will use Continunous k-Nearest Neighbor graph [2]_ combined with
103-
Miniumus Spanning Tree.
103+
Miniumus Spanning Tree.
104104
- 'precomputed' assumes that data is already provided as adjacency matrix of a
105-
sparse graph.
105+
sparse graph.
106106
107107
k : int, default=5
108108
Number of neighbors considered in graph construction. This parameter is expected
109109
to be positive.
110110
111111
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.
114114
115115
distance_threshold : float, optional
116116
Optional thresholding of distance matrix.
117117
118-
**pgs_kwargs : dict, optional
118+
pgs_kwargs : dict, optional
119119
Parameters for PyGenStability, see documentation. Some possible arguments:
120+
120121
- 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.
122123
- min_scale (float): minimum Markov scale
123124
- max_scale (float): maximum Markov scale
124125
- n_scale (int): number of scale steps
125126
- with_spectral_gap (bool): normalise scale by spectral gap
126127
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)
130131
Sparse adjacency matrix of constructed graph.
131132
132133
results_ : dict
@@ -135,12 +136,12 @@ class DataClustering(_GraphConstruction):
135136
labels_ : list of ndarray
136137
List of robust partitions identified with optimal scale selection.
137138
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
141142
community detection', *Applied Network Science*, vol. 5, no. 1, p. 3,
142143
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
144145
topological data analysis', *Foundations of Data Science*, vol. 1, no. 1,
145146
p. 1-38, Feb. 2019, doi: 10.3934/fods.2019001.
146147
"""
@@ -192,13 +193,13 @@ def labels_(self):
192193
def fit(self, X):
193194
"""Fit multiscale graph-based data clustering with PyGenStability from data.
194195
195-
Parameters:
196-
-----------
196+
Parameters
197+
----------
197198
X : {array-like, sparse matrix} of shape (n_samples,n_features) or \
198199
(n_samples,n_samples) if graph_method='precomputed'
199200
Data to fit
200201
201-
Returns:
202+
Returns
202203
-------
203204
self : DataClustering
204205
The fitted multiscale graph-based data clustering.
@@ -214,8 +215,8 @@ def fit(self, X):
214215
def scale_selection(self, kernel_size=0.1, window_size=0.1, max_nvi=1, basin_radius=0.01):
215216
"""Identify optimal scales [3].
216217
217-
Parameters:
218-
-----------
218+
Parameters
219+
----------
219220
kernel_size : int or float, default=0.1
220221
Size of kernel for average-pooling of the NVI(t,t') matrix. If float smaller
221222
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
231232
Radius of basin around local minima of the pooled diagonal. If float smaller
232233
than one it's the relative number of scales.
233234
234-
Returns:
235-
--------
235+
Returns
236+
-------
236237
labels_ : list of ndarray
237238
List of robust partitions identified with optimal scale selection.
238239
239-
References:
240-
-----------
240+
References
241+
----------
241242
.. [3] D. J. Schindler, J. Clarke, and M. Barahona, 'Multiscale Mobility Patterns and
242243
the Restriction of Human Movement', *arXiv:2201.06323*, 2023
243244
"""
@@ -272,7 +273,7 @@ def plot_robust_partitions(
272273
):
273274
"""Plot robust partitions with graph layout.
274275
275-
Parameters:
276+
Parameters
276277
----------
277278
x_coord : ndarray of shape (n_samples,)
278279
X-coordinates provided for samples.
@@ -292,8 +293,8 @@ def plot_robust_partitions(
292293
show : book, default=True
293294
Show the figures.
294295
295-
Returns:
296-
--------
296+
Returns
297+
-------
297298
figs : All matplotlib figures
298299
299300
"""
@@ -335,8 +336,8 @@ def plot_sankey(
335336
):
336337
"""Plot Sankey diagram.
337338
338-
Parameters:
339-
-----------
339+
Parameters
340+
----------
340341
optimal_scales : bool, default=True
341342
Plot Sankey diagram of robust partitions only or not.
342343
@@ -349,8 +350,8 @@ def plot_sankey(
349350
scale_index : bool
350351
Plot Sankey diagram for provided scale indices.
351352
352-
Returns:
353-
--------
353+
Returns
354+
-------
354355
fig : plotly figure
355356
Sankey diagram figure.
356357
"""

0 commit comments

Comments
 (0)