Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions AFL/double_agent/Labeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,23 @@ def calculate(self, dataset):
class ClusterMembershipProbability(PipelineOp):
"""Compute soft cluster membership probabilities from similarity and labels.

Given a phase labels for every measurement and pair similarity (N,N) between every pair
of measurements, this method computes the cluster membership as a renormalized average
similarity between a measurement and all other measurements in the cluster.

For each sample *i* and cluster *k*:

1. **Affinity/Similarity** – take the *mean* pairwise affinity/similarity between *i*
and every *other* sample assigned to cluster *k*
(self-similarity optionally removed).

2. **Softness / sharpness** – raise that average to the power
``v`` (``v > 1`` ⇒ crisper assignments, ``0 < v < 1`` ⇒ softer).

3. **Renormalise** across clusters so the values for sample *i*
sum to 1, yielding a probability table
``P(cluster=k | sample=i)`` with shape ``(n_samples, n_clusters)``.

Parameters
----------
similarity_variable : str
Expand Down
Loading