Skip to content
DeepForgeby svx
All problems

IQL Expectile Update Step

Problem

Take one IQL expectile regression update for a set of values.

Given a reference estimate, weight each value by tau when it is at or above the reference and by 1 - tau otherwise, then return the weighted mean sum(w * v) / sum(w). An empty list or zero total weight returns the reference unchanged.

Hint

Expectile regression with tau above 0.5 leans the value toward the upper tail.

Test cases

case 1
in: [[1,2,3],2,0.5]
expected: 2
case 2
in: [[1,2,3],0,0.7]
expected: 2
case 3
in: [[1,2,3],2.5,0.9]
expected: 2.727272727272727
case 4
in: [[],5,0.5]
expected: 5
case 5
in: [[2],1,0]
expected: 1
Starter codePython
def iql_expectile_update(values, reference, tau):
    # Your code here
    pass

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