All problems
Linear FA Value Predict
Problem
Predict a value with a linear function approximator that includes a bias.
weights[0] is the bias and weights[i + 1] multiplies features[i]: return weights[0] + w[1:] . features.
Hint
The first weight is a constant feature equal to one.
Test cases
case 1
in: [[1,2,3],[4,5]]
expected: 24
case 2
in: [[0,0],[1]]
expected: 0
case 3
in: [[2,-1,0.5],[2,4]]
expected: 2
case 4
in: [[5],[]]
expected: 5
Starter codePython
def linear_value_predict(weights, features):
# Your code here
pass4 test cases · run your code against them in the editor