Prognosis C2 W1 #UNIQ_C4 help needed

Not sure why is it failing.

Codes removed as posting grade function codes is against community guidelines

Output:

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

Original shape: (5, 2)
New shape: (5, 3)
Sample of new columns: 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
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

Original shape: (5, 2)
New shape: (5, 3)
Sample of new columns: 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
Original shape: (5, 2)
New shape: (5, 3)
Sample of new columns: 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
Original shape: (5, 2)
New shape: (5, 3)
Sample of new columns: 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)
Cell In[430], line 2
1 ### test cell ex4: do not edit this cell
----> 2 add_interactions_test(add_interactions, X_train)

File ~\Downloads\c1w1local\public_tests.py:198, in add_interactions_test(target, X_train)
175 expected_output = (0.062063703881263754, -0.5193674805355649, 0.4017996725326609, -2.366724661667246, 0.024344196818138278)
177 test_cases = [
178 {
179 “name”:“datatype_check”,
(…)
195 }
196 ]
→ 198 multiple_test(test_cases, test_target)

File ~\Downloads\c1w1local\test_utils.py:123, 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.

Expected Output

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

All tests passed.

1 Like

hi @saha10

Click on my name and then message to send screenshot of the codes which gave you this error. Please make sure you send a screenshot rather than copy paste for better! debugging.

Regards
DP

1 Like

Rebooting the notebook helped :slight_smile: Issue resolved !

2 Likes