local2global.example.Voronoi_patches

Voronoi_patches(points, sample_size=100, min_degree=None, min_overlap=None, min_size=None, eps=1.6, return_graph=False, kmeans=True)[source]

Create patches for points. Starts by sampling patch centers and assigning points to the nearest center and any center that is within eps of the nearest center to create patches. Patches are then grown by incrementally adding the next closest point until the patch degree constraint is satisfied. Finally patches that are smaller than min_size are expanded and shortest edges are added to make the patch graph connected if necessary.

Parameters
  • points (np.ndarray) – ndarray of floats of shape (N,d), d dimension embedding.

  • sample_size (int) – number of patches splitting the set of N points

  • min_degree (int) – minimum patch degree, defaults to d+1

  • min_overlap (int) – minimum overlap to consider two patches connected, defaults to d+1

  • min_size (int) – minimum patch size, defaults to len(points)/sample_size

  • eps (float) – tolerance for expanding initial Voronoi patches

  • return_graph (bool) – if True, return patch graph as a networkx Graph

  • kmeans (bool) – if True, choose patch centers using kmeans, otherwise patch centers are sampled uniformly at random from points.

Returns

list of patches, (patch graph if return_graph==True)