Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-271

Data Mixing Weight Effect

Problem

Return the change in loss when mixing weights are sharpened by a temperature: L(mix) - L(base), where L(mix) uses weights normalized after raising them to the temperature and L(base) uses the raw normalized weights. Return 0.0 when the inputs are empty or misaligned, temperature <= 0, or the total weight is zero.

Test cases

case 1
in: [[1,3],[0.5,0.5],2]
expected: 0
case 2
in: [[1,10],[0.9,0.1],2]
expected: -0.7902439024390244
case 3
in: [[2,4],[0.5,0.5],1]
expected: 0
case 4
in: [[],[],2]
expected: 0
Starter codePython
def mix_loss_effect(losses, weights, temperature):
    # Your code here
    pass

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