Skip to content

Commit 56c57ea

Browse files
authored
Merge pull request #214 from sjsrey/region-docs
Region docs
2 parents 863f40b + 0b289ba commit 56c57ea

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

spopt/region/azp_util.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,9 @@ def __init__(self, spatially_extensive_attr, threshold, decorated_strategy):
153153
Parameters
154154
----------
155155
spatially_extensive_attr : numpy.ndarray
156-
See corresponding argument in
157-
``region.max_p_regions.heuristics.MaxPRegionsHeu.fit_from_scipy_sparse_matrix``.
156+
Values that will serve as domain for the threshold constraint
158157
threshold : numbers.Real or numpy.ndarray
159-
See corresponding argument in
160-
``region.max_p_regions.heuristics.MaxPRegionsHeu.fit_from_scipy_sparse_matrix``
158+
Value for the threshold constraint
161159
decorated_strategy : AllowMoveStrategy
162160
The ``AllowMoveStrategy`` related to the algorithms local search.
163161
"""

spopt/region/maxp.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
Journal of Geographical Information Science. Accepted 2020-04-12.
77
"""
88

9+
__author__ = ["Ran Wei", "Serge Rey", "Elijah Knaap"]
10+
__email__ = "[email protected]"
11+
912
from ..BaseClass import BaseSpOptHeuristicSolver
1013
from .base import (
1114
w_to_g,
@@ -727,8 +730,8 @@ class MaxPHeuristic(BaseSpOptHeuristicSolver):
727730
Set to ``True`` for reporting solution progress/debugging.
728731
Default is ``False``.
729732
730-
Returns
731-
-------
733+
Attributes
734+
----------
732735
733736
max_p : int
734737
The number of regions.

spopt/region/region_k_means.py

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
"""
2+
Region k-means
3+
4+
5+
K-means with the constraint that all clusters form a spatially connected component.
6+
"""
7+
8+
__author__ = "Serge Rey"
9+
__email__ = "[email protected]"
10+
11+
112
from collections import defaultdict
213
import numpy
314
from ..BaseClass import BaseSpOptHeuristicSolver
@@ -14,7 +25,7 @@
1425

1526

1627
def region_k_means(X, n_clusters, w):
17-
"""Solve the region-K-means problem, the K-means with the constraint
28+
"""Solve the region-K-means problem with the constraint
1829
that each cluster forms a spatially connected component.
1930
2031
Parameters
@@ -119,7 +130,7 @@ def region_k_means(X, n_clusters, w):
119130

120131

121132
class RegionKMeansHeuristic(BaseSpOptHeuristicSolver):
122-
"""Solve the region-K-means problem, the K-means with the constraint
133+
"""Solve the region-K-means problem with the constraint
123134
that each cluster forms a spatially connected component.
124135
125136
@@ -138,14 +149,15 @@ class RegionKMeansHeuristic(BaseSpOptHeuristicSolver):
138149
Attributes
139150
----------
140151
141-
labels_ :
142-
...
143-
144-
centroids_ :
145-
...
152+
labels_ : numpy.array
153+
Region IDs for observations
146154
147-
iters_ :
148-
...
155+
centroids_ : numpy.ndarray
156+
Floating point array of centroids in the shape of ``(k, n_features)``
157+
found at the last iteration of ``region_k_means``.
158+
159+
iters : int
160+
The number of iterations for the reassignment phase.
149161
150162
"""
151163

0 commit comments

Comments
 (0)