esda.silhouettes.silhouette_alist

esda.silhouettes.silhouette_alist(data, labels, alist, indices=None, metric=<function euclidean_distances>)[source]

Compute the silhouette for each edge in an adjacency graph. Given the alist containing focal id, neighbor id, and label_focal, and label_neighbor, this computes:

\[d(i,label_neighbor) - d(i,label_focal) / (max(d(i,label_neighbor), d(i,label_focal)))\]
Parameters:
data(N,P) array to cluster on or DataFrame indexed on the same values as

that in alist.focal/alist.neighbor

labels: (N,) array containing classifications, indexed on the same values

as that in alist.focal/alist.neighbor

alist: adjacency list containing columns focal & neighbor,

describing one edge of the graph.

indices: (N,) array containing the “name” for observations in

alist to be linked to data. indices should be: 1. aligned with data by iteration order 2. include all values in the alist.focal set. if alist.focal and alist.neighbor are strings, then indices should be a list/array of strings aligned with the rows of data. if not provided and labels is a series/dataframe, then its index will be used.

metriccallable(), array,

a function that takes an argument (data) and returns the all-pairs distances/dissimilarity between observations.