spopt.region.SA3

class spopt.region.SA3(gdf, w, attrs_name, min_cluster_size=15, extraction='eom', **kwargs)[source]

Spatial Adaptive Agglomerative Aggregation (SA3) clustering.

The algorithm carries out sklearn.cluster.AgglometariveClustering per the specified parameters and extracts clusters from it, using density-clustering extraction algorithms - Excess of Mass or Leaf. This results in multiscale, contiguous clusters with noise.

Parameters:
gdfgeopandas.GeoDataFrame

Geodataframe containing original data.

wlibpysal.weights.W | libpysal.graph.Graph

Weights or Graph object created from given data.

attrs_namelist

Strings for attribute names (cols of geopandas.GeoDataFrame).

min_cluster_sizeint

The minimum number of observations to form a cluster.

extraction: str (default “eom”)

The cluster extraction scheme. “eom” is Excess of Mass, “leaf” is Leaf extraction.

**kwargs

Additional keyword arguments to be used in sklearn.cluster.AgglometariveClustering.

Attributes:
labels_numpy.array

Cluster labels for observations.

__init__(gdf, w, attrs_name, min_cluster_size=15, extraction='eom', **kwargs)[source]

Methods

__init__(gdf, w, attrs_name[, ...])

solve()

Compute the labels.

solve()[source]

Compute the labels.