# spopt.region.SA3

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

  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:
    gdf `geopandas.GeoDataFrame`

      Geodataframe containing original data.

    w `libpysal.weights.W` | `libpysal.graph.Graph`

      Weights or Graph object created from given data.

    attrs_name `python:list`

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

    min_cluster_size `python:int`

      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)

  Methods

  `__init__`(gdf, w, attrs_name[, ...]) |
  `solve`() | Compute the labels.

  solve()

    Compute the labels.