Hi, I’ve read, re-read and re-read the instructions again but I’m getting Triplet Loss: 2.4070153719293854 instead of c.0.70 as indicated. I’m struggling to see what I’m not agreeing with the expected output. I continued with the assignment and although the unit tests for triplet loss are failing, the evaluation results are as expected which is interesting. I’m happy to privately provide code if needed but would really appreciate a steer on this, thanks.
Hey there @mb009 ,
You can send it to me, so we can check it out together!
Hi @Alireza_Saei I have the exact same issue as @mb009. I went through each step individually, and it seems me that 2.4070153719293854 is more correct than c.0.70 because of the negative 1 on the diagonal. Not sure what I’m missing. (it’s passing the other 2 unit tests) thanks.
Hi @hlta
You can find the intermediate values in this post (by clicking on the image, or downloading) and see where your calculations start to differ. That way you can find your mistake.
Cheers
Hey there @hlta
After checking @mb009 's code I found some implementation issues and now I’m waiting for his feedback. Make sure you don’t have implementation issues and your code is completely correct!
Hi @arvyzukai, very helpful - I found the “issue” immediately in the first step - I was doing v1 @ v2.T, but the answer seems to be expecting v2 @ v1.T. The order in theory shouldn’t matter but because of the -1 in the positive diagonal, makes the final number different, while the other test cases are order-invariant. Not sure if I missed some convention on the order of matmul somewhere in the lecture. If not perhaps helpful to add a comment in the lab file. Thanks again and @Alireza_Saei.
Hello again, had another look at the Triplet Loss function code and I’m getting the same higher value - not sure why as I don’t understand where the code is going wrong - re-read the instructions and all of the comments so not sure why my value is still over 2 rather than 0.70. Would appreciate you taking a look - Changed things slightly and happy to dump the code here again if you want or if you want the whole notebook, let me know. btw. enjoying the challenges overall - I’m going this specialization close to retirement purely out of interest - interesting stuff
Hey there, I just shared the issues with your code (in triplet loss calculation) in private messages! I’ll be happy to help if you share your updated code again!
Yep, no worries, I’ll nip to my inbox and follow up.
hi @mb009
although @arvyzukai tag comment was perfect way to check which code could be incorrect by using print option for each step of the code and matching the values with his linked comment but I can see your issue still not resolved.
the most common issues with these grader cells are using v1 before v2.
next common issue could be with the calculation of triplet loss1 and triplet loss2. these two codes require one to use correct tupling. also check if you used margin - positive or positive - margin, as comment mentions to substrate first positive from margin, the correct code be margin- positive.
next while calculating last code, make sure you are mentioning triplet loss1+triplet loss2 to the required function recall.
hope it helps!!
regards
DP
The hint says that you should use:
closest_negative = tf.math.reduce_max(negative_without_positive, axis=None)
However, you must change the value of axis
to a valid number from None
. I’ll wait for your feedback to see how your progress is!
Oops, of course, I should have axis=1 - That was a typo, sorry.
I didn’t expect the higher value to change though as I did have the correct axis values in place before and sure enough, my returned value is the still the same.
Again, I’m following the comments carefully - I have a grasp of the logic, I’ve changed nothing in previous cells that would have any impact so unless there is still something small I missed that I’m still not seeing.
Print screen debugging isn’t really helping me that much.
I’m happy to send across the whole notebook if you like or I might just return to this in a day or two with fresh eyes
Sure, feel free to share the whole notebook in private messages, the issue might be somewhere else!
Hi, I am facing some issues with Exercise 4 . Can you please check my code?
@sidsonly4u, mentors do not have open access to your code.
hi @sidsonly4u
Always create a new topic rather than commenting on older threads. Also make sure when you create new topic provide some information about the issue you are encountering like sharing a screenshot of the error or sharing a screenshot if you different output than expected output. Most importantly make sure not to post any grade cell codes on public post thread as it is against community guidelines.
To have a better understanding to get guidance refer How to Use the Forum Code of Conduct
You can tag any of the NLP mentors in your created post to address your issue