I’m working through the first problem and getting “AssertionError: Check that you are finding the 4 words.” I’m looping over w and incrementing the average by [w] of word_to_vec_map. Later, the average is set to this previously defined average over the count. I’ve tried to poke around for which for words are in the vector map, but I am uncertain why they aren’t being pulled. ANy general direction is appreciated.
Hi,
You can print out each word w inside for loop to see if it’s expected. In the unit test case, you should see ‘a’, ‘a_nw’, ‘c_w’, ‘a_s’ 4 words. If not, check Step 1.
Tried printing and saw all 4 words being checked - I still get this error. Any assistance why that would be the case?
Did you sum up each word w and assign to avg
in the for loop, and divided by total count outside the loop?
Try to print out each step to see if it’s what you expected, like below.
# Step 2: average the word vectors. You can loop over the words in the list "words".
for w in None:
# Check that word exists in word_to_vec_map
if w in None:
avg += None # your code
# Increment count
count +=1
print('w:', w, ', avg:', avg, ', count:', count)
You should see debug messages as below:
w: a , avg: [3. 3.] , count: 1
w: a_nw , avg: [5. 7.] , count: 2
w: c_w , avg: [2. 8.] , count: 3
w: a_s , avg: [ 5. 10.] , count: 4
Thanks. Problem was with my indentation.
I am getting the same error, my output for this print is
Do you know what is causing this error?
Hi @v_victor
avg is initialised to zeros. If your code is correct, the ‘for’ loop should give some values when word is found in the vector.
There is not enough information to go by to know what your problem might be. Could you provide more details.
can I send you the code?
Hi @v_victor ,
Yes please, I’ll have a look for you. Put it in a DM.