all_points_membership_vectors

fast_plscan.prediction.all_points_membership_vectors(clusterer, labels=None)

Compute soft cluster membership vectors for all points.

Parameters:
  • clusterer (PLSCAN) – A fitted PLSCAN instance. Must have been fitted with feature-vector or (sparse) precomputed distance inputs.

  • labels (ndarray[tuple[int], dtype[int_]] | None, default: None) – An optional integer array of shape (n_samples,) with cluster labels for each point. When None (default), the fitted labels_ are used.

Return type:

ndarray[tuple[int, int], dtype[single]]

Returns:

membership_vectors – Float32 array of shape (n_samples, n_clusters). Entry [i, c] is the soft membership of point i in cluster c. Row sums equal probability_in_some_cluster. When no clusters exist, returns shape (n_samples, 0).

Raises:
  • NotFittedError – If clusterer has not been fitted yet.

  • ValueError – If clusterer was fitted with a precomputed minimum spanning forest.

  • ValueError – If the shape of labels does not match the number of samples in clusterer.