C3_W2_Assignment_Preprocess_Data

After deploying the preprocess function in the notebook successfully, the next cell of code gives the following error on running. I have included the cell with code because it is not user code hence it does not violate the guidelines and it will provide context. I am attaching the two screenshots of my error. It is something I have never seen before hence I’m looking for some guidance and clarification.

Thanks

Prajwal


check in train_val_dataset while calculating the number of sentences did you use correct argument and and function to convert the data into train_size.

Your error is also pointing that probably you have used cast string instead of using a tuple.

Next your error is pointing to check the text vectorizer is correctly adapt to the training sentences.

Lastly make sure your preprocess dataset codes are not hard coded and only uses the correct functional recall for text and label, i.e. text_vectorizer and label_encoder respectively

Let me know if your issue still persist.

Hey @Deepti_Prasad

I rechecked a couple of times. I have not hard-coded anything that should not be done. The vectorizer has correctly adapted I think because it passes the tests and shows the expected output. About casting a string instead of a tuple, unless any of the tf functions have some default setting like that I am not sure what exactly you are referring to.
After performing these checks the problem still persists.

Regards

Prajwal

please click on my name and then message me screenshots of grade function cells.

@pvinod

as suspected your issue if with the train_val_dataset, while computing the number of sentences you were suppose to take len function of data to which apply the int function and to this you need to multiply the TRAINING_SPLIT

Next in the fit-label encoder where you concatenate the two labels, you are using incorrect function concatenate the two labels, use .cancatenate two join the two labels and not dataset.zip

next in your preprocess data, you only need to mention lambda once and not separate for text and label.

Dear @Deepti_Prasad,

Thanks a lot for your help. I have cleared the assignment successfully. I will briefly detail the solutions to my problem.

  1. I used the zip command instead of the concatenate command even though it was explicitly stated there. I assumed it meant that they had to be joined and not that the function itself existed.
  2. In preprocess data, the two predefined functions can be mapped within a single lambda function using a tuple structure. Make sure you get the order of the functions right within the mapping.

I hope this is helpful to others who find themselves stuck in this assignment.

Regards

Prajwal