Skip to content

Channel shuffling causes inconsistent similarity loss computation #5

Description

@jorgelerre

Description

In _process_one_batch() (exp02_ccm.py), channels are always shuffled:

shuffled_indices = torch.randperm(channel)
batch_x = batch_x[:, :, shuffled_indices]
batch_y = batch_y[:, :, shuffled_indices]

This is done regardless of whether CCM is enabled.
Later, the similarity matrix is computed as:

simMatrix = self.get_similarity_matrix(batch_x)

using the original channel ordering.
The clustering loss is then computed as:

loss_s = self.similarity_loss_batch(self.model.cluster_prob, simMatrix)

However, self.model.cluster_prob corresponds to shuffled channels whereas simMatrix corresponds to the original ordering.
As a result, the similarity loss is effectively comparing two representations that refer to different channel index permutations, making the supervision signal inconsistent.

This introduces a silent misalignment in the clustering objective, potentially degrading training stability and interpretability.

Expected behavior

Either:

  • apply the same permutation when computing simMatrix, or
  • compute the similarity matrix using the shuffled channels.

Otherwise, the clustering loss seems to be computed using mismatched information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions