Skip to content

[ENH] Add optional margin for CDW-CE #111

@conradbkay

Description

@conradbkay

Describe the feature or idea you want to propose

Paper by some of the original CDW-CE authors:
https://arxiv.org/abs/2412.01246

The formula doesn't make sense to me assuming log(1 − max(1, yˆi + m)) is always undefined

Describe your proposed solution

I'm guessing they mean something like

if self.margin is not None:
    probs = F.softmax(y_pred, dim=1)
    probs = torch.clamp(probs + self.margin, max=1 - 1e-8)
    log_term = torch.log(1 - probs)
    
    loss = log_term * weights

Describe alternatives you have considered, if relevant

I couldn't find any code implementations for the newer paper

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions