Hello, does anyone know what is incorrect in the predict function?

*{moderator edit - solution code removed}*

Hello, does anyone know what is incorrect in the predict function?

*{moderator edit - solution code removed}*

The instructions tell you to compute the cosine similarity, but all youâ€™ve done is just the sum of the two vectors. Thatâ€™s not the same thing, right?

And with a little more careful look, youâ€™re not even implementing the sum correctly. TF â€średuce_sumâ€ť takes a single tensor argument, right? It then sums across the specified axis (default â€śNoneâ€ť).

3 Likes

The below comment helped me correct

this code by @arvyzukai NLP mentor

you need to check v1v2 shape and then check his comment where it mention v1.shape and v2.shape, apply the value to the shape.

Regards

DP

2 Likes

Thank you for your valuable feedback.

1 Like

Also what Paul caught another error in your code about cosine similarity when you tf.math_reduce_sum, you are suppose to use correct operator, and I think you must have used similar code in the previous grader cell classify.

1 Like