All problems
IQL Expectile Loss
Problem
Compute the IQL expectile regression loss.
For each sample diff = q - target and the weight is tau when diff >= 0, otherwise 1 - tau; the loss is the mean of weight * diff^2. An empty batch returns 0.0.
Hint
The expectile controls how pessimistic the value estimate is on the offline data.
Test cases
case 1
in: [[2,1],[1,2],0.5]
expected: 0.5
case 2
in: [[2,1],[1,2],0.7]
expected: 0.5
case 3
in: [[3],[3],0.9]
expected: 0
case 4
in: [[],[],0.5]
expected: 0
Starter codePython
def iql_expectile_loss(q_values, targets, tau):
# Your code here
pass4 test cases · run your code against them in the editor