All problems
Quantile Regression Forecast
Problem
Apply a fitted quantile regression lite: forecast each x as intercept + slope * x.
Return the list of fitted values. The coefficients are assumed to come from training at a given quantile level.
Hint
Different quantile levels give different slopes and intercepts.
Test cases
case 1
in: [[1,2,3],2,1]
expected: [3,5,7]
case 2
in: [[0],0.5,-1]
expected: [-1]
case 3
in: [[],1,0]
expected: []
case 4
in: [[-1,1],1,0]
expected: [-1,1]
Starter codePython
def quantile_regression_forecast(x, slope, intercept):
# Your code here
pass4 test cases · run your code against them in the editor