Error exercise 4

Hi everyone,

I keep getting errors on exercise for in the graded assessment. I tried exhaustively but cant seem to find what I am doing wrong. Could someone please advise.
Forever grateful!
You can find my code and error below.

Exercise 4 - add_interactions
Write code below to add all interactions between every pair of variables to the training and test datasets.

Please do not post or share any codes correct or incorrect, link to graded assignment, notebook.ipynb on public post thread as it is against community guidelines. for better understanding please refer How to Use the Forum and Code of Conduct

test cell ex4: do not edit this cell

add_interactions_test(add_interactions, X_train)
Original Data

       Age  Systolic_BP

1824 -0.912451 -0.068019
253 -0.302039 1.719538
1114 2.576274 0.155962
3220 1.163621 -2.033931
2108 -0.446238 -0.054554

Data with Interactions

       Age  Systolic_BP  Age_x_Systolic_BP

1824 -0.912451 -0.068019 0.062064
253 -0.302039 1.719538 -0.519367
1114 2.576274 0.155962 0.401800
3220 1.163621 -2.033931 -2.366725
2108 -0.446238 -0.054554 0.024344

Error: Wrong output. for variable in position 0.
Error: Wrong output. for variable in position 1.
Error: Wrong output. for variable in position 2.
Error: Wrong output. for variable in position 3.
Error: Wrong output. for variable in position 4.
2 Tests passed
1 Tests failed

AssertionError Traceback (most recent call last)
in
1 ### test cell ex4: do not edit this cell
----> 2 add_interactions_test(add_interactions, X_train)

~/work/W1A1/public_tests.py in add_interactions_test(target, X_train)
196 ]
197
→ 198 multiple_test(test_cases, test_target)

~/work/W1A1/test_utils.py in multiple_test(test_cases, target)
121 print(‘\033[92m’, success," Tests passed")
122 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
→ 123 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))

AssertionError: Not all tests were passed for test_target. Check your equations and avoid using global variables inside the function.

hi @Fredericvdc

You seem to have edited the grade cell which you werent suppose to do. I also see the markers ###START YOUR CODE HERE AND END YOUR CODE HERE### are removed which might cause you submission failure.

Now comes to your code

you have removed to important codes line in the I loop after get the name of feature ‘i’, you are suppose to get the data of feature ‘i’

Same way in the for loop for j column, after get the name of feature ‘j’, you are suppose to get the data of feature ‘j’

other codes are correct. so the best advise is to get a fresh copy of assignment and only mentioned codes between the assigned markers ###START AND END CODE HERE### without editing, deleting it adding anything other than what instructions are already given when you open your assignment notebook.

Regards
DP