Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-300

CORAL Covariance Align

Problem

Compute the CORAL domain-alignment loss.

Build the population covariance matrix of each feature set (rows are samples), then return ||C_source - C_target||_F^2 / (4 * d^2) rounded to 4 decimal places, where d is the feature dimension.

Test cases

case 1
in: [[[1],[2]],[[1],[2]]]
expected: 0
case 2
in: [[[1],[2]],[[1],[4]]]
expected: 1
case 3
in: [[[1],[2],[3]],[[2],[4],[6]]]
expected: 1
Starter codePython
def coral_loss(source, target):
    # Your code here
    pass

3 test cases · run your code against them in the editor