membership_vectors¶
- fast_plscan.prediction.membership_vectors(clusterer, X, labels=None)¶
Approximate soft cluster membership vectors for unseen points.
This adapts HDBSCAN-style prediction to PLSCAN in distance space. Each new point is attached through its nearest mutual-reachability training neighbor, then blended distance and topology weights are scaled by the probability of belonging to any selected cluster.
- Parameters:
clusterer (
PLSCAN) – A fittedPLSCANestimator trained on feature-vector input.X (
ndarray[tuple[int,int],dtype[single]]) – New feature vectors with shape(n_samples_new, n_features).labels (
ndarray[tuple[int],dtype[int_]] |None, default:None) – Optional cluster labels of shape(n_samples,)used to define the selected clusters and exemplars on the fitted data. WhenNone(default), fittedlabels_are used.
- Return type:
- Returns:
membership_vectors – Float32 array of shape
(n_samples_new, n_clusters). Entry[i, c]is the approximate soft membership of unseen pointiin clusterc. Row sums are less than or equal to 1.- Raises:
NotFittedError – If
clustererhas not been fitted.ValueError – If
clustererwas fitted with precomputed input, or ifXhas an invalid number of features.ValueError – If the shape of
labelsdoes not match the fitted number of samples.