Word Count Function Not Passing Tests. Need Help

I am doing C1_W1_Assignment and running into issues for extract_features(...) graded portion. I understand it as if I find a dictionary entry exists in freqs, then increment by 1. I am also supposed to do this for the positive and negative labels. However, I am receiving test error while executing. Not sure what i am missing, logic looks correct to me

Code snippet removed

Here are my test output

Positive:  23
Negative:  None
Positive Truth:  1
Positive:  30
Negative:  5
Positive Truth:  1
Negative Truth:  1
Positive:  7
Negative:  None
Positive Truth:  1
Positive:  14
Negative:  6
Positive Truth:  1
Negative Truth:  1
Positive:  27
Negative:  1
Positive Truth:  1
Negative Truth:  1
Positive:  72
Negative:  47
Positive Truth:  1
Negative Truth:  1
Positive:  2960
Negative:  2
Positive Truth:  1
Negative Truth:  1
Wrong output values. Check how you are computing the positive or negative word count. 
	Expected: [[1.000e+00 3.133e+03 6.100e+01]].
	Got: [[1. 7. 5.]].
Positive:  None
Negative:  None
Positive:  None
Negative:  None
Positive:  None
Negative:  None
Positive:  49
Negative:  8
Positive Truth:  1
Negative Truth:  1
Positive:  23
Negative:  15
Positive Truth:  1
Negative Truth:  1
Positive:  None
Negative:  None
Positive:  191
Negative:  83
Positive Truth:  1
Negative Truth:  1
Wrong output values. Check how you are computing the positive or negative word count. 
	Expected: [[  1. 263. 106.]].
	Got: [[1. 3. 3.]].
Positive:  5
Negative:  100
Positive Truth:  1
Negative Truth:  1
Wrong output values. Check how you are computing the positive or negative word count. 
	Expected: [[  1.   5. 100.]].
	Got: [[1. 1. 1.]].
 5  Tests passed
 3  Tests failed

Any assistance is greatly appreciated

1 Like

Solved it. It is not looking for a single increment for each one found, it is looking for the total sum for each neg and positive value. I got confused with 1.000e+00 and just realized this is a larger value and not just 1 haha

1 Like

No, that value is still 1.0, just with a lot of precision.

2 Likes

Hi @Ryan_Llamas

Please remove your solution code (the first block in your post) because it’s against the rules to share code or your solutions (Code of Conduct).

Thanks

1 Like

Sure, will do right now

1 Like

Oop nvm, seems already removed. Sorry about that :sweat_smile:

1 Like