C1W1 - Assignment error

I cannot understand why i get an error in the features

So i add a function that check the data

Training Set Checks:
quality_check: labels[0] matches data.quality. Test passed.
is_red_check: labels[1] matches data.is_red. Test passed.

Validation Set Checks:
quality_check: labels[0] matches data.quality. Test passed.
is_red_check: labels[1] matches data.is_red. Test passed.

Test Set Checks:
quality_check: labels[0] matches data.quality. Test passed.
is_red_check: labels[1] matches data.is_red. Test passed.

First 5 ‘is_red’ labels in train_Y: [0 0 0 0 0]
First 5 ‘is_red’ values in train_df: [0 0 0 0 0]

But then
train_Y[0]_check: train_Y[0] is not equal to train.quality. Please check your code.
Expected: True
Result: False
Please open utils.py if you want to see the unit test here.

train_Y[1]_check: train_Y[1] is not equal to train.is_red. Please check your code.
Expected: True
Result: False
Please open utils.py if you want to see the unit test here.

val_Y[0]_check: train_Y[0] is not equal to val.quality. Please check your code.
Expected: True
Result: False
Please open utils.py if you want to see the unit test here.

val_Y[1]_check: train_Y[1] is not equal to val.is_red. Please check your code.
Expected: True
Result: False
Please open utils.py if you want to see the unit test here.

2 Tests passed
4 Tests failed

and this create an error.

Exception Traceback (most recent call last)
in
----> 1 utils.test_format_output(df, train_Y, val_Y, test_Y)

~/work/release/W1_Assignment/utils.py in test_format_output(df, train_Y, val_Y, test_Y)
165 ]
166
→ 167 test_loop(test_cases)
168
169 def test_norm(norm_train_X, norm_val_X, norm_test_X, train, val, test):

~/work/release/W1_Assignment/utils.py in test_loop(test_cases)
25 print(‘\033[92m’, success," Tests passed")
26 print(‘\033[91m’, fails, " Tests failed")
—> 27 raise Exception(“Please check the error messages above.”)
28
29 def test_white_df(white_df):

Exception: Please check the error messages above.

What to do ?

Even for us is hard to understand where the error might be given just these, but there should be an error with your code, it would be good to check this file and see what the tests expect, which might help you in fixing your code:

utils.p-> test_format_output function, it can be found on File->Open tabs.

Can I know what code you wrote for the white and red wine df code?

@Deepti_Prasad @gent.spah Can i send u the code in a DM ?

Send, please rename your file with your name Igor Copy of assignment and then send

Hello @Igor_Lessio

ERRORS/Correction required
1.In the train test split grader cell, you do not need to import the below again.
from sklearn.model_selection import train_test_split
import numpy as np

  1. Next just before the instruction, it is clearly mentions you to split into train and test, and but you have created train_val_df, test_df, and train_df, val_df. stick with what instructions mentions you to name like train, test and val.

  2. Next while splitting the train and val, your test size is incorrect. Keep it the way you mentioned for train test split.

See the below image on how it looks, you are only suppose to write where it mentions YOUR CODE HERE

  1. Next under the Get the labels grader cell, you have completely edited out the grader cell. You are only suppose to write codes where it is mentioned to write.

Now see your grader cell :point_down:

Use the below three instructions to make the correction
The following function, format_output, gets these two columns from the dataframe (it’s given to you).
format_output also formats the data into numpy arrays.
Please use the format_output and apply it to the train, val and test sets to get dataframes for the labels.

Let me know if your issue gets resolved.

Regards
DP

1 Like

Oh… what a stupid ! Must be this Flu !

You rock tnks very much!

2 Likes

There is a flu around thats true actually!

1 Like

No joke i got this flu is worse than Covid. Fever coff and it enver go away.
But i’m in Thailand and here we have China influx at maximum now. I hope to go back to office soon.

1 Like

I passed my error was in the split. Tnks for the help.

1 Like

Recover well, I know even my friends in USA are stating the same about the flu. Hope you guys are taking well precautions and medicine.

Take care.

Happy to Help.

Regards
DP

1 Like