spopt.region.RegionKMeansHeuristic

class spopt.region.RegionKMeansHeuristic(data, n_clusters, w, drop_islands=True, seed=0)[source]

Solve the region-K-means problem with the constraint that each cluster forms a spatially connected component.

Parameters:
data{numpy.ndarray, list}, required

The observations to cluster shaped (n_samples, n_features).

n_clustersint

The number of clusters to form.

wlibpysal.weights.W, required

Weights object created from given data.

drop_islandsbool

Drop observations that are islands (True) or keep them (False). Default is True.

seedint

Random state to pass into _seeds(). Default is 0.

Attributes:
labels_numpy.array

Region IDs for observations.

centroids_numpy.ndarray

Floating point array of centroids in the shape of (k, n_features) found at the last iteration of region_k_means.

iters_int

The number of iterations for the reassignment phase.

__init__(data, n_clusters, w, drop_islands=True, seed=0)[source]

Methods

__init__(data, n_clusters, w[, ...])

solve()

Solve the region k-means heuristic.

solve()[source]

Solve the region k-means heuristic.