Unit test throwing error on predictions, 'float' object has no attribute 'shape'

I have written my predict_tweet function, and the outputs seem to be correct:

However, when I run the unit test, I get an error on the unit test itself.

Obviously something is wrong on my end, something is not an array when it should be. I have a feeling it is the sigmoid function, which I had to vectorize before, but when I vectorize it here, it gives me a different error…

Hi @Alex_Dore,

Can you share your lab ID with me ? In the assignment, when you click the top right “Help” button, a panel will open and your lab ID will be shown at the bottom.

I shall take a look.

When you reply back, kindly tag me in the post so that I’m notified.

Thanks,
Mubsi

Sorry @Mubsi, I think it was related to my sigmoid function. I was using the regular math.exp() function, which meant that in the 2nd function I had to use vectorize(), which meant that in the next unit test something was output in the wrong format.

I realized numpy also had an exp() function which didn’t require vectorization, and that seemed to make everything go smoothly.

Unfortunately I overwrote my submission, but I guess it would be easy to replicate, NLP Course Week 1

Thanks