All problems
Feature Interaction Product
Problem
Build an interaction feature by multiplying two feature lists element-wise: a_i * b_i.
Return the product list; empty input returns [].
Hint
Multiply the values pairwise.
Test cases
case 1
in: [[1,2,3],[4,5,6]]
expected: [4,10,18]
case 2
in: [[-1,0,2],[3,-2,4]]
expected: [-3,0,8]
case 3
in: [[1.5,2.5],[2,4]]
expected: [3,10]
case 4
in: [[],[]]
expected: []
Starter codePython
def interaction_feature(a, b):
# Your code here
pass4 test cases · run your code against them in the editor