Wk4, Prog. assign., "feature_and_labels()" function: shape of the features array?

My features_and_labels() function returns the features array for the first example of shape (5 , 10), while the “Expected Output” box shows the features array of shape (5, 5) with the extra zeros at the front of the last (longest) n-gram truncated (see the screenshot attached).
I did not set truncating =‘pre’ in the pad_seqs() function and, when tested, it returned a correct output matching the “Expected Output”. Should I? Is it the reason why I got a lower grade for the assignment (see below)?

My model achieved the 80% accuracy threshold and I passed the Grader with 88%. But I am not satisfied, until I figure out why it shows am error (see attached a screenshot of the Grader’s output). The Grader says “operands could not be broadcast together with shapes (5,10) (5,4)”. Any hint where the bug(s) might be?


Please click my name and message your notebook as an attachment.

Thanks, balaji.ambresh for looking into my code! I have just sent it to you couple of minutes ago. Please let me know if you didn’t receive it.

input_sequences passed to the features_and_labels function is already padded. There’s no need to pad it again.

1 Like

Thanks, Balaji for pointing me to the bug! I see it now​:+1: